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.
Jesse Greenwald committed
Nov 9, 2010 at 22:18 UTC
915b9894abe94169e60a14e4dc671f6bd15131f3
1 file changed
+28
git-subtree.sh
+28
@@ -138,6 +138,7 @@ cache_setup()
138
cachedir="$GIT_DIR/subtree-cache/$$"
139
rm -rf "$cachedir" || die "Can't delete old cachedir: $cachedir"
140
mkdir -p "$cachedir" || die "Can't create new cachedir: $cachedir"
141
+ mkdir -p "$cachedir/notree" || die "Can't create new cachedir: $cachedir/notree"
142
debug "Using cachedir: $cachedir" >&2
143
}
144
@@ -151,6 +152,30 @@ cache_get()
152
done
153
}
154
155
+cache_miss()
156
+{
157
+ for oldrev in $*; do
158
+ if [ ! -r "$cachedir/$oldrev" ]; then
159
+ echo $oldrev
160
+ fi
161
+ done
162
+}
163
+
164
+check_parents()
165
+{
166
+ missed=$(cache_miss $*)
167
+ for miss in $missed; do
168
+ if [ ! -r "$cachedir/notree/$miss" ]; then
169
+ debug " incorrect order: $miss"
170
+ fi
171
+ done
172
+}
173
+
174
+set_notree()
175
+{
176
+ echo "1" > "$cachedir/notree/$1"
177
+}
178
+
179
cache_set()
180
{
181
oldrev="$1"
@@ -568,10 +593,13 @@ cmd_split()
593
594
tree=$(subtree_for_commit $rev "$dir")
595
debug " tree is: $tree"
596
+
597
+ check_parents $parents
598
599
# ugly. is there no better way to tell if this is a subtree
600
# vs. a mainline commit? Does it matter?
601
if [ -z $tree ]; then
602
+ set_notree $rev
603
if [ -n "$newparents" ]; then
604
cache_set $rev $rev
605
fi