Skip to content

Commit 49cf822

Browse files
committed
Only copy a commit if it has at least one nonidentical parent.
This is a simplification of the previous logic. I don't *think* it'll break anything. Results in far fewer useless merge commmits when playing with gitweb in the git project: git subtree split --prefix=gitweb --annotate='(split) ' 0a8f4f0^^..f2e7330 --onto=1130ef3 ...and it doesn't *seem* to eliminate anything important.
1 parent a64f3a7 commit 49cf822

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

git-subtree.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ copy_or_skip()
258258
assert [ -n "$tree" ]
259259

260260
identical=
261+
nonidentical=
261262
p=
262263
gotparents=
263264
for parent in $newparents; do
@@ -266,6 +267,8 @@ copy_or_skip()
266267
if [ "$ptree" = "$tree" ]; then
267268
# an identical parent could be used in place of this rev.
268269
identical="$parent"
270+
else
271+
nonidentical="$parent"
269272
fi
270273

271274
# sometimes both old parents map to the same newparent;
@@ -283,7 +286,7 @@ copy_or_skip()
283286
fi
284287
done
285288

286-
if [ -n "$identical" -a "$gotparents" = " $identical" ]; then
289+
if [ -n "$identical" -a -z "$nonidentical" ]; then
287290
echo $identical
288291
else
289292
copy_commit $rev $tree "$p" || exit $?

0 commit comments

Comments
 (0)