Skip to content

Commit

Permalink
Merge branch 'sg/filter-branch-dwim-ambiguity' into maint
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Jeff King committed Dec 1, 2015
2 parents 2cc3640 + 4d2a364 commit 978b576
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion git-filter-branch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
7 changes: 7 additions & 0 deletions t/t7003-filter-branch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 978b576

Please sign in to comment.