Merge branch 'cb/filter-branch-prune-empty-degenerate-merges'
"filter-branch" left an empty single-parent commit that results when all parents of a merge commit gets mapped to the same commit, even under "--prune-empty". * cb/filter-branch-prune-empty-degenerate-merges: filter-branch: eliminate duplicate mapped parentsmaint
commit
6a5713b576
|
@ -332,7 +332,13 @@ while read commit parents; do
|
||||||
parentstr=
|
parentstr=
|
||||||
for parent in $parents; do
|
for parent in $parents; do
|
||||||
for reparent in $(map "$parent"); do
|
for reparent in $(map "$parent"); do
|
||||||
parentstr="$parentstr -p $reparent"
|
case "$parentstr " in
|
||||||
|
*" -p $reparent "*)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
parentstr="$parentstr -p $reparent"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
if [ "$filter_parent" ]; then
|
if [ "$filter_parent" ]; then
|
||||||
|
|
|
@ -308,6 +308,17 @@ test_expect_success 'Prune empty commits' '
|
||||||
test_cmp expect actual
|
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' '
|
test_expect_success '--remap-to-ancestor with filename filters' '
|
||||||
git checkout master &&
|
git checkout master &&
|
||||||
git reset --hard A &&
|
git reset --hard A &&
|
||||||
|
|
Loading…
Reference in New Issue