summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Jesse Greenwald <jesse.greenwald@gmail.com>2010-11-09 22:18:36 -0600
committerLibravatar Avery Pennarun <apenwarr@gmail.com>2010-11-09 21:20:48 -0800
commit915b9894abe94169e60a14e4dc671f6bd15131f3 (patch)
treed8d528785ef58b932317319c8fc641f563c6a9a0
parentSplit cmd now processes commits in topo order. (diff)
downloadtgif-915b9894abe94169e60a14e4dc671f6bd15131f3.tar.xz
Added check to order of processed commits.
With debug messages enabled, "incorrect order" will be output whenever a commit is processed before its parents have been processed. This can be determined by checking to see if a parent isn't mapped to a new commit, but it has been processed.
-rwxr-xr-xgit-subtree.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/git-subtree.sh b/git-subtree.sh
index 390c0fc574..cf50de150c 100755
--- a/git-subtree.sh
+++ b/git-subtree.sh
@@ -138,6 +138,7 @@ cache_setup()
cachedir="$GIT_DIR/subtree-cache/$$"
rm -rf "$cachedir" || die "Can't delete old cachedir: $cachedir"
mkdir -p "$cachedir" || die "Can't create new cachedir: $cachedir"
+ mkdir -p "$cachedir/notree" || die "Can't create new cachedir: $cachedir/notree"
debug "Using cachedir: $cachedir" >&2
}
@@ -151,6 +152,30 @@ cache_get()
done
}
+cache_miss()
+{
+ for oldrev in $*; do
+ if [ ! -r "$cachedir/$oldrev" ]; then
+ echo $oldrev
+ fi
+ done
+}
+
+check_parents()
+{
+ missed=$(cache_miss $*)
+ for miss in $missed; do
+ if [ ! -r "$cachedir/notree/$miss" ]; then
+ debug " incorrect order: $miss"
+ fi
+ done
+}
+
+set_notree()
+{
+ echo "1" > "$cachedir/notree/$1"
+}
+
cache_set()
{
oldrev="$1"
@@ -568,10 +593,13 @@ cmd_split()
tree=$(subtree_for_commit $rev "$dir")
debug " tree is: $tree"
+
+ check_parents $parents
# ugly. is there no better way to tell if this is a subtree
# vs. a mainline commit? Does it matter?
if [ -z $tree ]; then
+ set_notree $rev
if [ -n "$newparents" ]; then
cache_set $rev $rev
fi