summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6da4013)
raw | patch | inline | side by side (parent: 6da4013)
author | Jakub Suder <jakub.suder@gmail.com> | |
Sat, 9 Jan 2010 18:55:35 +0000 (19:55 +0100) | ||
committer | Jakub Suder <jakub.suder@gmail.com> | |
Sun, 10 Jan 2010 12:09:23 +0000 (13:09 +0100) |
git-subtree.sh | patch | blob | history |
diff --git a/git-subtree.sh b/git-subtree.sh
index 28fb8e81fb80349a17763a819666308ebc0a589e..96118735b2c9da6867579dd19ae314add87f8b6d 100755 (executable)
--- a/git-subtree.sh
+++ b/git-subtree.sh
q quiet
d show debug messages
p,prefix= the name of the subdir to split out
+m,message= use the given message as the commit message for the merge commit
options for 'split'
annotate= add a prefix to commit message of new commits
b,branch= create a new branch from the split subtree
ignore_joins=
annotate=
squash=
+message=
debug()
{
--no-annotate) annotate= ;;
-b) branch="$1"; shift ;;
-p) prefix="$1"; shift ;;
+ -m) message="$1"; shift ;;
--no-prefix) prefix= ;;
--onto) onto="$1"; shift ;;
--no-onto) onto= ;;
dir="$1"
latest_old="$2"
latest_new="$3"
+ if [ -n "$message" ]; then
+ commit_message="$message"
+ else
+ commit_message="Add '$dir/' from commit '$latest_new'"
+ fi
cat <<-EOF
- Add '$dir/' from commit '$latest_new'
+ $commit_message
git-subtree-dir: $dir
git-subtree-mainline: $latest_old
EOF
}
+add_squashed_msg()
+{
+ if [ -n "$message" ]; then
+ echo "$message"
+ else
+ echo "Merge commit '$1' as '$2'"
+ fi
+}
+
rejoin_msg()
{
dir="$1"
latest_old="$2"
latest_new="$3"
+ if [ -n "$message" ]; then
+ commit_message="$message"
+ else
+ commit_message="Split '$dir/' into commit '$latest_new'"
+ fi
cat <<-EOF
- Split '$dir/' into commit '$latest_new'
+ $message
git-subtree-dir: $dir
git-subtree-mainline: $latest_old
if [ -n "$squash" ]; then
rev=$(new_squash_commit "" "" "$rev") || exit $?
- commit=$(echo "Merge commit '$rev' as '$dir'" |
+ commit=$(add_squashed_msg "$rev" "$dir" |
git commit-tree $tree $headp -p "$rev") || exit $?
else
commit=$(add_msg "$dir" "$headrev" "$rev" |
rev="$new"
fi
- git merge -s subtree $rev
+ git merge -s subtree --message="$message" $rev
}
cmd_pull()