added -m/--message option for setting merge commit message
This commit is contained in:
parent
6da401386e
commit
2da0969a79
@ -17,6 +17,7 @@ h,help show the help
|
|||||||
q quiet
|
q quiet
|
||||||
d show debug messages
|
d show debug messages
|
||||||
p,prefix= the name of the subdir to split out
|
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'
|
options for 'split'
|
||||||
annotate= add a prefix to commit message of new commits
|
annotate= add a prefix to commit message of new commits
|
||||||
b,branch= create a new branch from the split subtree
|
b,branch= create a new branch from the split subtree
|
||||||
@ -40,6 +41,7 @@ rejoin=
|
|||||||
ignore_joins=
|
ignore_joins=
|
||||||
annotate=
|
annotate=
|
||||||
squash=
|
squash=
|
||||||
|
message=
|
||||||
|
|
||||||
debug()
|
debug()
|
||||||
{
|
{
|
||||||
@ -77,6 +79,7 @@ while [ $# -gt 0 ]; do
|
|||||||
--no-annotate) annotate= ;;
|
--no-annotate) annotate= ;;
|
||||||
-b) branch="$1"; shift ;;
|
-b) branch="$1"; shift ;;
|
||||||
-p) prefix="$1"; shift ;;
|
-p) prefix="$1"; shift ;;
|
||||||
|
-m) message="$1"; shift ;;
|
||||||
--no-prefix) prefix= ;;
|
--no-prefix) prefix= ;;
|
||||||
--onto) onto="$1"; shift ;;
|
--onto) onto="$1"; shift ;;
|
||||||
--no-onto) onto= ;;
|
--no-onto) onto= ;;
|
||||||
@ -266,8 +269,13 @@ add_msg()
|
|||||||
dir="$1"
|
dir="$1"
|
||||||
latest_old="$2"
|
latest_old="$2"
|
||||||
latest_new="$3"
|
latest_new="$3"
|
||||||
|
if [ -n "$message" ]; then
|
||||||
|
commit_message="$message"
|
||||||
|
else
|
||||||
|
commit_message="Add '$dir/' from commit '$latest_new'"
|
||||||
|
fi
|
||||||
cat <<-EOF
|
cat <<-EOF
|
||||||
Add '$dir/' from commit '$latest_new'
|
$commit_message
|
||||||
|
|
||||||
git-subtree-dir: $dir
|
git-subtree-dir: $dir
|
||||||
git-subtree-mainline: $latest_old
|
git-subtree-mainline: $latest_old
|
||||||
@ -275,13 +283,27 @@ add_msg()
|
|||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
add_squashed_msg()
|
||||||
|
{
|
||||||
|
if [ -n "$message" ]; then
|
||||||
|
echo "$message"
|
||||||
|
else
|
||||||
|
echo "Merge commit '$1' as '$2'"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
rejoin_msg()
|
rejoin_msg()
|
||||||
{
|
{
|
||||||
dir="$1"
|
dir="$1"
|
||||||
latest_old="$2"
|
latest_old="$2"
|
||||||
latest_new="$3"
|
latest_new="$3"
|
||||||
|
if [ -n "$message" ]; then
|
||||||
|
commit_message="$message"
|
||||||
|
else
|
||||||
|
commit_message="Split '$dir/' into commit '$latest_new'"
|
||||||
|
fi
|
||||||
cat <<-EOF
|
cat <<-EOF
|
||||||
Split '$dir/' into commit '$latest_new'
|
$message
|
||||||
|
|
||||||
git-subtree-dir: $dir
|
git-subtree-dir: $dir
|
||||||
git-subtree-mainline: $latest_old
|
git-subtree-mainline: $latest_old
|
||||||
@ -441,7 +463,7 @@ cmd_add()
|
|||||||
|
|
||||||
if [ -n "$squash" ]; then
|
if [ -n "$squash" ]; then
|
||||||
rev=$(new_squash_commit "" "" "$rev") || exit $?
|
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 $?
|
git commit-tree $tree $headp -p "$rev") || exit $?
|
||||||
else
|
else
|
||||||
commit=$(add_msg "$dir" "$headrev" "$rev" |
|
commit=$(add_msg "$dir" "$headrev" "$rev" |
|
||||||
@ -561,7 +583,7 @@ cmd_merge()
|
|||||||
rev="$new"
|
rev="$new"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
git merge -s subtree $rev
|
git merge -s subtree --message="$message" $rev
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd_pull()
|
cmd_pull()
|
||||||
|
Loading…
Reference in New Issue
Block a user