diff options
author | Junio C Hamano <gitster@pobox.com> | 2014-07-22 10:28:30 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-07-22 10:28:30 -0700 |
commit | 5796c5baa3ef0a7d179fdac6cb5815f75f65fd53 (patch) | |
tree | 1df36d2be4b34422fc7db95cbd8934278b4acb78 | |
parent | 1a1f7b2c522814a251b77cb7dd7b0ee2e7410f88 (diff) | |
parent | 79bc4ef3686bc6795aa79a1d4aa6d3060a2cbd93 (diff) | |
download | git-5796c5baa3ef0a7d179fdac6cb5815f75f65fd53.tar.gz |
Merge branch 'cb/filter-branch-prune-empty-degenerate-merges' into maint
* cb/filter-branch-prune-empty-degenerate-merges:
filter-branch: eliminate duplicate mapped parents
-rwxr-xr-x | git-filter-branch.sh | 8 | ||||
-rwxr-xr-x | t/t7003-filter-branch.sh | 11 |
2 files changed, 18 insertions, 1 deletions
diff --git a/git-filter-branch.sh b/git-filter-branch.sh index 86d6994619..e6e99f5bb5 100755 --- a/git-filter-branch.sh +++ b/git-filter-branch.sh @@ -332,7 +332,13 @@ while read commit parents; do parentstr= for parent in $parents; do for reparent in $(map "$parent"); do - parentstr="$parentstr -p $reparent" + case "$parentstr " in + *" -p $reparent "*) + ;; + *) + parentstr="$parentstr -p $reparent" + ;; + esac done done if [ "$filter_parent" ]; then diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh index 9496736a89..66643e4bd7 100755 --- a/t/t7003-filter-branch.sh +++ b/t/t7003-filter-branch.sh @@ -308,6 +308,17 @@ test_expect_success 'Prune empty commits' ' test_cmp expect actual ' +test_expect_success 'prune empty collapsed merges' ' + test_config merge.ff false && + git rev-list HEAD >expect && + test_commit to_remove_2 && + git reset --hard HEAD^ && + test_merge non-ff to_remove_2 && + git filter-branch -f --index-filter "git update-index --remove to_remove_2.t" --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 && |