summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0ca71b3)
raw | patch | inline | side by side (parent: 0ca71b3)
author | Avery Pennarun <apenwarr@gmail.com> | |
Fri, 24 Apr 2009 18:24:38 +0000 (14:24 -0400) | ||
committer | Avery Pennarun <apenwarr@gmail.com> | |
Fri, 24 Apr 2009 18:24:38 +0000 (14:24 -0400) |
git-subtree.sh | patch | blob | history |
diff --git a/git-subtree.sh b/git-subtree.sh
index 5e5b27f8ad065341287d5183aba656b05cc9c9f1..c59759baa63c241170fd112de907b32da65d6ccb 100755 (executable)
--- a/git-subtree.sh
+++ b/git-subtree.sh
fi
}
+assert()
+{
+ if "$@"; then
+ :
+ else
+ die "assertion failed: " "$@"
+ fi
+}
+
+
#echo "Options: $*"
while [ $# -gt 0 ]; do
cache_setup()
{
- cachedir="$GIT_DIR/subtree-cache/$dir"
+ 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"
debug "Using cachedir: $cachedir" >&2
git rev-list --reverse --parents $revs -- "$dir" |
while read rev parents; do
newparents=$(cache_get $parents)
- echo "rev: $rev / $newparents"
+ debug
+ debug "Processing commit: $rev / $newparents"
git ls-tree $rev -- "$dir" |
while read mode type tree name; do
+ assert [ "$name" = "$dir" ]
+ debug " tree is: $tree"
p=""
for parent in $newparents; do
p="$p -p $parent"
done
newrev=$(echo synthetic | git commit-tree $tree $p) \
|| die "Can't create new commit for $rev / $tree"
+ echo " newrev is: $newrev"
cache_set $rev $newrev
- done
- done
+ done || exit $?
+ done || exit $?
exit 0
}