summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 13648af)
raw | patch | inline | side by side (parent: 13648af)
author | Avery Pennarun <apenwarr@gmail.com> | |
Sat, 25 Apr 2009 04:06:45 +0000 (00:06 -0400) | ||
committer | Avery Pennarun <apenwarr@gmail.com> | |
Sat, 25 Apr 2009 04:06:45 +0000 (00:06 -0400) |
git-subtree.sh | patch | blob | history |
diff --git a/git-subtree.sh b/git-subtree.sh
index f2a1c6aae4561fa7d85a4a7faabe4ea8771d74b1..aeafadac95d4bb25e38d90ee58d0d9ba4f85d59f 100755 (executable)
--- a/git-subtree.sh
+++ b/git-subtree.sh
echo "$newrev" >"$cachedir/$oldrev"
}
+# if a commit doesn't have a parent, this might not work. But we only want
+# to remove the parent from the rev-list, and since it doesn't exist, it won't
+# be there anyway, so do nothing in that case.
+try_remove_previous()
+{
+ if git rev-parse "$1^" >/dev/null 2>&1; then
+ echo "^$1^"
+ fi
+}
+
find_existing_splits()
{
debug "Looking for prior splits..."
if [ -n "$main" -a -n "$sub" ]; then
debug " Prior: $main -> $sub"
cache_set $main $sub
- echo "^$main^ ^$sub^"
+ try_remove_previous "$main"
+ try_remove_previous "$sub"
main=
sub=
fi