'git subtree split' now basically works.
This commit is contained in:
parent
0ca71b3737
commit
2573354e9b
@ -28,6 +28,16 @@ debug()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert()
|
||||||
|
{
|
||||||
|
if "$@"; then
|
||||||
|
:
|
||||||
|
else
|
||||||
|
die "assertion failed: " "$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#echo "Options: $*"
|
#echo "Options: $*"
|
||||||
|
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
@ -63,7 +73,7 @@ debug "dir: {$dir}"
|
|||||||
|
|
||||||
cache_setup()
|
cache_setup()
|
||||||
{
|
{
|
||||||
cachedir="$GIT_DIR/subtree-cache/$dir"
|
cachedir="$GIT_DIR/subtree-cache/$$"
|
||||||
rm -rf "$cachedir" || die "Can't delete old cachedir: $cachedir"
|
rm -rf "$cachedir" || die "Can't delete old cachedir: $cachedir"
|
||||||
mkdir -p "$cachedir" || die "Can't create new cachedir: $cachedir"
|
mkdir -p "$cachedir" || die "Can't create new cachedir: $cachedir"
|
||||||
debug "Using cachedir: $cachedir" >&2
|
debug "Using cachedir: $cachedir" >&2
|
||||||
@ -98,19 +108,23 @@ cmd_split()
|
|||||||
git rev-list --reverse --parents $revs -- "$dir" |
|
git rev-list --reverse --parents $revs -- "$dir" |
|
||||||
while read rev parents; do
|
while read rev parents; do
|
||||||
newparents=$(cache_get $parents)
|
newparents=$(cache_get $parents)
|
||||||
echo "rev: $rev / $newparents"
|
debug
|
||||||
|
debug "Processing commit: $rev / $newparents"
|
||||||
|
|
||||||
git ls-tree $rev -- "$dir" |
|
git ls-tree $rev -- "$dir" |
|
||||||
while read mode type tree name; do
|
while read mode type tree name; do
|
||||||
|
assert [ "$name" = "$dir" ]
|
||||||
|
debug " tree is: $tree"
|
||||||
p=""
|
p=""
|
||||||
for parent in $newparents; do
|
for parent in $newparents; do
|
||||||
p="$p -p $parent"
|
p="$p -p $parent"
|
||||||
done
|
done
|
||||||
newrev=$(echo synthetic | git commit-tree $tree $p) \
|
newrev=$(echo synthetic | git commit-tree $tree $p) \
|
||||||
|| die "Can't create new commit for $rev / $tree"
|
|| die "Can't create new commit for $rev / $tree"
|
||||||
|
echo " newrev is: $newrev"
|
||||||
cache_set $rev $newrev
|
cache_set $rev $newrev
|
||||||
done
|
done || exit $?
|
||||||
done
|
done || exit $?
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user