Print out the newly created commitid at the end, for use in other scripts.
Avery Pennarun committed
Apr 24, 2009 at 14:52 UTC
e25a6bf837ba378b0a8264e580c61069951dce66
1 file changed
+7
-2
git-subtree.sh
+7
-2
@@ -93,7 +93,7 @@ cache_set()
93
{
94
oldrev="$1"
95
newrev="$2"
96
- if [ -e "$cachedir/$oldrev" ]; then
96
+ if [ "$oldrev" != "latest" -a -e "$cachedir/$oldrev" ]; then
97
die "cache for $oldrev already exists!"
98
fi
99
echo "$newrev" >"$cachedir/$oldrev"
@@ -140,9 +140,14 @@ cmd_split()
140
newrev=$(copy_commit $rev $tree "$p") || exit $?
141
debug " newrev is: $newrev"
142
cache_set $rev $newrev
143
+ cache_set latest $newrev
144
done || exit $?
145
done || exit $?
145
-
146
+ latest=$(cache_get latest)
147
+ if [ -z "$latest" ]; then
148
+ die "No new revisions were found"
149
+ fi
150
+ echo $latest
151
exit 0
152
}
153