diff options
-rwxr-xr-x | git-filter-branch.sh | 2 | ||||
-rwxr-xr-x | t/t7003-filter-branch.sh | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/git-filter-branch.sh b/git-filter-branch.sh index 98f1779cf..86b2ff1e0 100755 --- a/git-filter-branch.sh +++ b/git-filter-branch.sh @@ -404,7 +404,7 @@ while read commit parents; do then tree=$(git write-tree) else - tree="$commit^{tree}" + tree=$(git rev-parse "$commit^{tree}") fi workdir=$workdir @SHELL_PATH@ -c "$filter_commit" "git commit-tree" \ "$tree" $parentstr < ../message > ../map/$commit || diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh index 869e0bf07..edb834187 100755 --- a/t/t7003-filter-branch.sh +++ b/t/t7003-filter-branch.sh @@ -333,6 +333,14 @@ test_expect_success 'prune empty collapsed merges' ' test_cmp expect actual ' +test_expect_success 'prune empty works even without index/tree filters' ' + git rev-list HEAD >expect && + git commit --allow-empty -m empty && + git filter-branch -f --prune-empty HEAD && + git rev-list HEAD >actual && + test_cmp expect actual +' + test_expect_success '--remap-to-ancestor with filename filters' ' git checkout master && git reset --hard A && |