@matheusbsbs / matheus-bagliano / commits / 49cf82288a
Fork 0

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.

Avery Pennarun committed Apr 26, 2009 at 17:07 UTC 49cf82288aac5f0dcb152e2d75cd340e48d9e760
1 file changed +4 -1
git-subtree.sh
+4 -1
@@ -258,6 +258,7 @@ copy_or_skip()
258 assert [ -n "$tree" ]
259
260 identical=
261 + nonidentical=
262 p=
263 gotparents=
264 for parent in $newparents; do
@@ -266,6 +267,8 @@ copy_or_skip()
267 if [ "$ptree" = "$tree" ]; then
268 # an identical parent could be used in place of this rev.
269 identical="$parent"
270 + else
271 + nonidentical="$parent"
272 fi
273
274 # sometimes both old parents map to the same newparent;
@@ -283,7 +286,7 @@ copy_or_skip()
286 fi
287 done
288
286 - if [ -n "$identical" -a "$gotparents" = " $identical" ]; then
289 + if [ -n "$identical" -a -z "$nonidentical" ]; then
290 echo $identical
291 else
292 copy_commit $rev $tree "$p" || exit $?