aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2015-12-01 17:21:17 -0500
committerJeff King <peff@peff.net>2015-12-01 17:21:17 -0500
commit978b5760a11846ee7e2b928aca629a065a9d876d (patch)
treebeb3e3a37ea7b596f184b18f108e0df6f0fc50bb
parent2cc36407df4eb919c4ad3da0561d1bbdb9e0c0c4 (diff)
parent4d2a3646d1f0285ce072cdfe34a7df64710f9357 (diff)
downloadgit-978b5760a11846ee7e2b928aca629a065a9d876d.tar.gz
git-978b5760a11846ee7e2b928aca629a065a9d876d.tar.xz
Merge branch 'sg/filter-branch-dwim-ambiguity' into maint
Fix for a corner case in filter-branch. * sg/filter-branch-dwim-ambiguity: filter-branch: deal with object name vs. pathname ambiguity in tree-filter
-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 fff8093d4..ad24c8d85 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 377c648e0..869e0bf07 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