File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -587,5 +587,23 @@ public void CanAddAnExistingBlobEntryWithAnExistingTree()
587587                Assert . NotNull ( td [ "1/branch_file.txt" ] ) ; 
588588            } 
589589        } 
590+ 
591+         [ Fact ] 
592+         public  void  CanRemoveADirectoryWithChildren ( ) 
593+         { 
594+             const  string  blobSha  =  "a8233120f6ad708f843d861ce2b7228ec4e3dec6" ; 
595+             string  path  =  SandboxBareTestRepo ( ) ; 
596+             using  ( var  repo  =  new  Repository ( path ) ) 
597+             { 
598+                 TreeDefinition  td  =  new  TreeDefinition ( ) ; 
599+                 var  blob  =  repo . Lookup < Blob > ( blobSha ) ; 
600+                 td . Add ( "folder/subfolder/file1" ,  blob ,  Mode . NonExecutableFile ) ; 
601+                 td . Add ( "folder/file1" ,  blob ,  Mode . NonExecutableFile ) ; 
602+                 td . Remove ( "folder" ) ; 
603+                 Assert . Null ( td [ "folder" ] ) ; 
604+                 Tree  t  =  repo . ObjectDatabase . CreateTree ( td ) ; 
605+                 Assert . Null ( t [ "folder" ] ) ; 
606+             } 
607+         } 
590608    } 
591609} 
Original file line number Diff line number Diff line change @@ -94,6 +94,7 @@ public virtual TreeDefinition Remove(string treeEntryPath)
9494            if  ( segments . Item2  ==  null ) 
9595            { 
9696                entries . Remove ( segments . Item1 ) ; 
97+                 unwrappedTrees . Remove ( segments . Item1 ) ; 
9798            } 
9899
99100            if  ( ! unwrappedTrees . ContainsKey ( segments . Item1 ) ) 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments