h,help show the help
q quiet
d show debug messages
-prefix= the name of the subdir to split out
+p,prefix= the name of the subdir to split out
options for 'split'
annotate= add a prefix to commit message of new commits
b,branch= create a new branch from the split subtree
--annotate) annotate="$1"; shift ;;
--no-annotate) annotate= ;;
-b) branch="$1"; shift ;;
- --prefix) prefix="$1"; shift ;;
+ -p) prefix="$1"; shift ;;
--no-prefix) prefix= ;;
--onto) onto="$1"; shift ;;
--no-onto) onto= ;;
if [ -z "$prefix" ]; then
die "You must provide the --prefix option."
fi
-dir="$prefix"
+dir="$(dirname "$prefix/.")"
if [ "$command" != "pull" ]; then
revs=$(git rev-parse $default --revs-only "$@") || exit $?
sq=
main=
sub=
- git log --grep="^git-subtree-dir: $dir\$" \
+ git log --grep="^git-subtree-dir: $dir/*\$" \
--pretty=format:'START %H%n%s%n%n%b%nEND%n' HEAD |
while read a b junk; do
debug "$a $b $junk"
revs="$2"
main=
sub=
- git log --grep="^git-subtree-dir: $dir\$" \
+ git log --grep="^git-subtree-dir: $dir/*\$" \
--pretty=format:'START %H%n%s%n%n%b%nEND%n' $revs |
while read a b junk; do
case "$a" in
- START) main="$b"; sq="$b" ;;
+ START) sq="$b" ;;
git-subtree-mainline:) main="$b" ;;
git-subtree-split:) sub="$b" ;;
END)
+ debug " Main is: '$main'"
if [ -z "$main" -a -n "$sub" ]; then
# squash commits refer to a subtree
+ debug " Squash: $sq from $sub"
cache_set "$sq" "$sub"
fi
if [ -n "$main" -a -n "$sub" ]; then
cmd_pull()
{
ensure_clean
- set -x
- git pull -s subtree "$@"
+ git fetch "$@" || exit $?
+ revs=FETCH_HEAD
+ cmd_merge
}
"cmd_$command" "$@"