filter-branch: fix --prune-empty on parentless commits
commita582a82d2444b627260a764c17d3137d9d255531
authorDevin J. Pohly <djpohly@gmail.com>
Thu, 23 Feb 2017 08:27:35 +0000 (23 02:27 -0600)
committerJunio C Hamano <gitster@pobox.com>
Fri, 3 Mar 2017 20:43:37 +0000 (3 12:43 -0800)
treee352502dbc0c4427e4b582040a36cbab4145eda9
parent4dacc8f11d4acfb43d76e2a1abc2d2a57d5a2691
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>
Documentation/git-filter-branch.txt
git-filter-branch.sh
t/t7003-filter-branch.sh