summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9035628)
raw | patch | inline | side by side (parent: 9035628)
author | veillette@yahoo.ca <veillette@yahoo.ca> | |
Mon, 31 Mar 2008 07:14:15 +0000 (09:14 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 31 Mar 2008 08:09:50 +0000 (01:09 -0700) |
Commit d89c1df (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: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
'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: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-filter-branch.sh | patch | blob | history | |
t/t7003-filter-branch.sh | patch | blob | history |
diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index 22b6ed4a784192bb865dff83731255b1979a1e39..ea59015baa2507fdc8fe77d1c77ebdb2d5db2fa7 100755 (executable)
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
die "Could not checkout the index"
# files that $commit removed are now still in the working tree;
# remove them, else they would be added again
- git clean -q -f -x
+ git clean -d -q -f -x
eval "$filter_tree" < /dev/null ||
die "tree filter failed: $filter_tree"
index 53b5ce605e424172fc3fb40624d8abcabf67b631..efd658adb6d6327863f430b10ab65aa3f112f996 100755 (executable)
--- a/t/t7003-filter-branch.sh
+++ b/t/t7003-filter-branch.sh
git-filter-branch -f --tree-filter "mv dir diroh || :" HEAD
'
-test_expect_failure 'test that the directory was renamed' '
+test_expect_success 'test that the directory was renamed' '
test dir/d = "$(git show HEAD:diroh/d --)" &&
! test -d dir &&
test -d diroh &&