summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2016-01-28 16:10:12 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2016-01-28 16:10:12 -0800
commita2ec9484c1517305e2e28d64d8d77642f05e9a02 (patch)
tree7e6486c835da8f8a676e2be9f9f03652e2882a45
parentThird batch for 2.8 cycle (diff)
parentfilter-branch: resolve $commit^{tree} in no-index case (diff)
downloadtgif-a2ec9484c1517305e2e28d64d8d77642f05e9a02.tar.xz
Merge branch 'jk/filter-branch-no-index'
A recent optimization to filter-branch in v2.7.0 introduced a regression when --prune-empty filter is used, which has been corrected. * jk/filter-branch-no-index: filter-branch: resolve $commit^{tree} in no-index case
-rwxr-xr-xgit-filter-branch.sh2
-rwxr-xr-xt/t7003-filter-branch.sh8
2 files changed, 9 insertions, 1 deletions
diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index 98f1779cf3..86b2ff1e07 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 8868e6e090..cb8fbd8e5e 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 &&