From: "Michael S. Tsirkin" <mst@redhat.com>
To: git@vger.kernel.org
Subject: [PATCH 1/4] rebase -i: add ack action
Date: Mon, 19 May 2014 00:17:47 +0300 [thread overview]
Message-ID: <1400447743-18513-2-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1400447743-18513-1-git-send-email-mst@redhat.com>
This implements a new ack! action for git rebase -i
It is essentially a middle ground between fixup! and squash!:
- commits are squashed silently without editor being started
- commit logs are concatenated (with action line being discarded)
- because of the above, empty commits aren't discarded,
their log is also included.
I am using it as follows:
git am -s < mailbox #creates first commit
hack ...
get mail with Ack
git commit --allow-empty -m `cat <<-EOF
ack! first
Acked-by: maintainer
EOF`
repeat cycle
git rebase --autosquash -i origin/master
before public branch push
The "cat" command above is actually a script that
parses the Ack mail to create the empty commit -
to be submitted separately.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
git-rebase--interactive.sh | 34 +++++++++++++++++++++++++++-------
1 file changed, 27 insertions(+), 7 deletions(-)
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 6ec9d3c..821872c 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -140,6 +140,7 @@ Commands:
r, reword = use commit, but edit the commit message
e, edit = use commit, but stop for amending
s, squash = use commit, but meld into previous commit
+ a, ack = like "squash", but append commit body only to previous commit
f, fixup = like "squash", but discard this commit's log message
x, exec = run command (the rest of the line) using shell
@@ -412,6 +413,15 @@ update_squash_messages () {
echo
commit_message $2
;;
+ ack)
+ if test -f "$fixup_msg"
+ then
+ commit_message $2 | git stripspace --strip-comments | sed -e '1,2d' >> "$fixup_msg"
+ fi
+ printf '%s\n' "$comment_char This is the $(nth_string $count) commit message:"
+ echo
+ commit_message $2
+ ;;
fixup)
echo
printf '%s\n' "$comment_char The $(nth_string $count) commit message will be skipped:"
@@ -453,7 +463,7 @@ record_in_rewritten() {
echo "$oldsha1" >> "$rewritten_pending"
case "$(peek_next_command)" in
- squash|s|fixup|f)
+ squash|s|fixup|f|ack|a)
;;
*)
flush_rewritten_pending
@@ -521,8 +531,11 @@ do_next () {
warn "Stopped at $sha1... $rest"
exit_with_patch $sha1 0
;;
- squash|s|fixup|f)
+ squash|s|fixup|f|ack|a)
case "$command" in
+ ack|a)
+ squash_style=ack
+ ;;
squash|s)
squash_style=squash
;;
@@ -546,7 +559,7 @@ do_next () {
die_failed_squash $sha1 "$rest"
fi
case "$(peek_next_command)" in
- squash|s|fixup|f)
+ squash|s|fixup|f|ack|a)
# This is an intermediate commit; its message will only be
# used in case of trouble. So use the long version:
do_with_author output git commit --amend --no-verify -F "$squash_msg" \
@@ -557,7 +570,7 @@ do_next () {
# This is the final command of this squash/fixup group
if test -f "$fixup_msg"
then
- do_with_author git commit --amend --no-verify -F "$fixup_msg" \
+ do_with_author git commit --quiet --amend --no-verify -F "$fixup_msg" \
${gpg_sign_opt:+"$gpg_sign_opt"} ||
die_failed_squash $sha1 "$rest"
else
@@ -690,7 +703,7 @@ skip_unnecessary_picks () {
done <"$todo" >"$todo.new" 3>>"$done" &&
mv -f "$todo".new "$todo" &&
case "$(peek_next_command)" in
- squash|s|fixup|f)
+ squash|s|fixup|f|ack|a)
record_in_rewritten "$onto"
;;
esac ||
@@ -732,7 +745,7 @@ rearrange_squash () {
while read -r pick sha1 message
do
case "$message" in
- "squash! "*|"fixup! "*)
+ "squash! "*|"fixup! "*|"ack! "*)
action="${message%%!*}"
rest=$message
prefix=
@@ -740,7 +753,7 @@ rearrange_squash () {
while :
do
case "$rest" in
- "squash! "*|"fixup! "*)
+ "squash! "*|"fixup! "* |"ack! "*)
prefix="$prefix${rest%%!*},"
rest="${rest#*! }"
;;
@@ -975,6 +988,13 @@ do
comment_out=
fi
+ # keep empty ack! commits around: useful to add text to commit log
+ case "$rest" in
+ "ack! "*)
+ comment_out=
+ ;;
+ esac
+
if test t != "$preserve_merges"
then
printf '%s\n' "${comment_out}pick $shortsha1 $rest" >>"$todo"
--
MST
next prev parent reply other threads:[~2014-05-18 21:19 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-18 21:17 [PATCH 0/4] ack recoding in commit log Michael S. Tsirkin
2014-05-18 21:17 ` Michael S. Tsirkin [this message]
2014-05-18 21:17 ` [PATCH 2/4] git-rebase: document ack Michael S. Tsirkin
2014-05-18 23:43 ` Eric Sunshine
2014-05-18 21:17 ` [PATCH 3/4] rebase: test ack Michael S. Tsirkin
2014-05-19 21:34 ` Junio C Hamano
2014-05-19 22:40 ` Michael S. Tsirkin
2014-05-20 14:38 ` Michael S. Tsirkin
2014-05-20 15:13 ` Junio C Hamano
2014-05-21 12:52 ` Michael S. Tsirkin
2014-05-21 16:54 ` Junio C Hamano
2014-05-21 17:39 ` Michael S. Tsirkin
2014-05-21 18:30 ` Junio C Hamano
2014-05-18 21:17 ` [PATCH 4/4] git-ack: record an ack Michael S. Tsirkin
2014-06-03 23:53 ` Fabian Ruch
2014-06-11 8:05 ` [PATCH 0/4] ack recoding in commit log Fabian Ruch
2014-06-11 8:46 ` Michael S. Tsirkin
-- strict thread matches above, loose matches on Subject: below --
2016-04-10 13:54 [PATCH 0/4] support for ack commits Michael S. Tsirkin
2016-04-10 13:54 ` [PATCH 1/4] rebase -i: add ack action Michael S. Tsirkin
2016-04-11 11:02 ` Johannes Schindelin
2016-04-11 11:24 ` Michael S. Tsirkin
2016-04-11 15:36 ` Johannes Schindelin
2016-04-11 16:41 ` Michael S. Tsirkin
2016-04-11 19:48 ` Junio C Hamano
2016-04-11 19:55 ` Michael S. Tsirkin
2016-04-11 20:03 ` Matthieu Moy
2016-04-12 7:51 ` Michael S. Tsirkin
2016-04-12 16:07 ` Junio C Hamano
2016-04-12 16:33 ` Michael S. Tsirkin
2016-04-12 20:00 ` Junio C Hamano
2016-04-11 12:05 ` Christian Neukirchen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1400447743-18513-2-git-send-email-mst@redhat.com \
--to=mst@redhat.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).