From: Liam Beguin <liambeguin@gmail.com>
To: git@vger.kernel.org
Cc: Johannes.Schindelin@gmx.de, peff@peff.net,
Liam Beguin <liambeguin@gmail.com>
Subject: [PATCH v3 2/6] rebase -i: add abbreviate_commands function
Date: Tue, 2 May 2017 00:00:44 -0400 [thread overview]
Message-ID: <20170502040048.9065-3-liambeguin@gmail.com> (raw)
In-Reply-To: <20170502040048.9065-1-liambeguin@gmail.com>
Once the rest of the processing is done, the `abbreviate_commands`
function is called. If the 'rebase.abbreviateCommands' option is set to
true, the function will replace each command-name by its abbreviated
form.
Signed-off-by: Liam Beguin <liambeguin@gmail.com>
---
git-rebase--interactive.sh | 16 ++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 9b8a030ff045..4fa621062cdf 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -884,6 +884,20 @@ add_exec_commands () {
mv "$1.new" "$1"
}
+abbreviate_commands () {
+ test "$(git config --bool rebase.abbreviateCommands)" = true || return
+
+ while read -r command rest
+ do
+ case $command in
+ x|exec) command=x ;;
+ *) command=${command%${command#?}} ;;
+ esac
+ printf "%s\n" "$command $rest"
+ done <"$1" >"$1.new" &&
+ mv -f "$1.new" "$1"
+}
+
# Check if the SHA-1 passed as an argument is a
# correct one, if not then print $2 in "$todo".badsha
# $1: the SHA-1 to test
@@ -1143,6 +1158,7 @@ edit-todo)
git stripspace --strip-comments <"$todo" >"$todo".new
mv -f "$todo".new "$todo"
collapse_todo_ids
+ abbreviate_commands "$todo"
append_todo_help
gettext "
You are editing the todo file of an ongoing interactive rebase.
@@ -1281,6 +1297,7 @@ fi
test -s "$todo" || echo noop >> "$todo"
test -n "$autosquash" && rearrange_squash "$todo"
test -n "$cmd" && add_exec_commands "$todo"
+abbreviate_commands "$todo"
todocount=$(git stripspace --strip-comments <"$todo" | wc -l)
todocount=${todocount##* }
--
2.9.3
next prev parent reply other threads:[~2017-05-02 4:01 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-02 4:00 [PATCH v3 0/6] rebase -i: add config to abbreviate command-names Liam Beguin
2017-05-02 4:00 ` [PATCH v3 1/6] rebase -i: add abbreviated command-names handling Liam Beguin
2017-05-02 14:37 ` Johannes Schindelin
2017-05-02 4:00 ` Liam Beguin [this message]
2017-05-02 15:32 ` [PATCH v3 2/6] rebase -i: add abbreviate_commands function Johannes Schindelin
2017-05-02 4:00 ` [PATCH v3 3/6] rebase -i: add short command-name in --autosquash Liam Beguin
2017-05-02 15:34 ` Johannes Schindelin
2017-05-02 23:18 ` Liam Beguin
2017-05-02 4:00 ` [PATCH v3 4/6] Documentation: move rebase.* config variables to a separate rebase-config.txt Liam Beguin
2017-05-02 15:40 ` Johannes Schindelin
2017-05-02 4:00 ` [PATCH v3 5/6] Documentation: use preferred name for the 'todo list' script Liam Beguin
2017-05-02 4:00 ` [PATCH v3 6/6] Documentation: document the rebase.abbreviateCommands option Liam Beguin
2017-05-02 8:48 ` [PATCH v3 0/6] rebase -i: add config to abbreviate command-names Ævar Arnfjörð Bjarmason
2017-05-02 15:41 ` Johannes Schindelin
2017-05-02 15:48 ` Johannes Schindelin
2017-05-02 23:56 ` Liam Beguin
2017-05-03 11:22 ` Johannes Schindelin
2017-05-04 5:04 ` Junio C Hamano
2017-05-07 17:13 ` Liam Beguin
2017-05-08 0:27 ` Junio C Hamano
2017-05-08 21:27 ` Liam Beguin
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=20170502040048.9065-3-liambeguin@gmail.com \
--to=liambeguin@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.