summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgit-filter-branch.sh2
-rwxr-xr-xt/t7003-filter-branch.sh7
2 files changed, 8 insertions, 1 deletions
diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index fff8093d4f..ad24c8d854 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -319,7 +319,7 @@ while read commit parents; do
die "tree filter failed: $filter_tree"
(
- git diff-index -r --name-only --ignore-submodules $commit &&
+ git diff-index -r --name-only --ignore-submodules $commit -- &&
git ls-files --others
) > "$tempdir"/tree-state || exit
git update-index --add --replace --remove --stdin \
diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh
index 377c648e04..869e0bf073 100755
--- a/t/t7003-filter-branch.sh
+++ b/t/t7003-filter-branch.sh
@@ -418,4 +418,11 @@ test_expect_success 'filter commit message without trailing newline' '
test_cmp expect actual
'
+test_expect_success 'tree-filter deals with object name vs pathname ambiguity' '
+ test_when_finished "git reset --hard original" &&
+ ambiguous=$(git rev-list -1 HEAD) &&
+ git filter-branch --tree-filter "mv file.t $ambiguous" HEAD^.. &&
+ git show HEAD:$ambiguous
+'
+
test_done