summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorDevin J. Pohly <djpohly@gmail.com>2017-02-23 08:27:35 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-03-03 20:43:37 (GMT)
commita582a82d2444b627260a764c17d3137d9d255531 (patch)
treee352502dbc0c4427e4b582040a36cbab4145eda9 /t
parent4dacc8f11d4acfb43d76e2a1abc2d2a57d5a2691 (diff)
downloadgit-a582a82d2444b627260a764c17d3137d9d255531.zip
git-a582a82d2444b627260a764c17d3137d9d255531.tar.gz
git-a582a82d2444b627260a764c17d3137d9d255531.tar.bz2
filter-branch: fix --prune-empty on parentless commits
Previously, the git_commit_non_empty_tree function would always pass any commit with no parents to git-commit-tree, regardless of whether the tree was nonempty. The new commit would then be recorded in the filter-branch revision map, and subsequent commits which leave the tree untouched would be correctly filtered. With this change, parentless commits with an empty tree are correctly pruned, and an empty file is recorded in the revision map, signifying that it was rewritten to "no commits." This works naturally with the parent mapping for subsequent commits. Signed-off-by: Devin J. Pohly <djpohly@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t7003-filter-branch.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh
index 40526d1..7cb6079 100755
--- a/t/t7003-filter-branch.sh
+++ b/t/t7003-filter-branch.sh
@@ -362,7 +362,7 @@ test_expect_success 'prune empty works even without index/tree filters' '
test_cmp expect actual
'
-test_expect_failure '--prune-empty is able to prune root commit' '
+test_expect_success '--prune-empty is able to prune root commit' '
git rev-list branch-no-a >expect &&
git branch testing H &&
git filter-branch -f --prune-empty --index-filter "git update-index --remove A.t" testing &&
@@ -371,7 +371,7 @@ test_expect_failure '--prune-empty is able to prune root commit' '
test_cmp expect actual
'
-test_expect_failure '--prune-empty is able to prune entire branch' '
+test_expect_success '--prune-empty is able to prune entire branch' '
git branch prune-entire B &&
git filter-branch -f --prune-empty --index-filter "git update-index --remove A.t B.t" prune-entire &&
test_path_is_missing .git/refs/heads/prune-entire &&