Skip to content
  • veillette@yahoo.ca's avatar
    filter-branch: Fix renaming a directory in the tree-filter · 6a589fda
    veillette@yahoo.ca authored and Junio C Hamano's avatar Junio C Hamano committed
    Commit d89c1dfa
    
     (filter-branch: don't use xargs -0, 2008-03-12) replaced a
    'ls-files | xargs rm' pipeline by 'git clean'. 'git clean' however does
    not recurse and remove directories by default.
    
    Now, consider a tree-filter that renames a directory.
    
      1. For the first commit everything works as expected
    
      2. Then filter-branch checks out the files for the next commit. This
         leaves the new directory behind because there is no real "branch
         switching" involved that would notice that the directory can be
         removed.
    
      3. Then filter-branch invokes 'git clean' to remove exactly those
         left-overs. But here it does not remove the directory.
    
      4. The next tree-filter does not work as expected because there already
         exists a directory with the new name.
    
    Just add -d to 'git clean', so that empty directories are removed.
    
    Signed-off-by: default avatarJohannes Sixt <johannes.sixt@telecom.at>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    6a589fda