git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] rebase -i: add config to abbreviate command name
@ 2017-04-24  3:23 Liam Beguin
  2017-04-24 10:26 ` Johannes Schindelin
                   ` (3 more replies)
  0 siblings, 4 replies; 28+ messages in thread
From: Liam Beguin @ 2017-04-24  3:23 UTC (permalink / raw)
  To: git; +Cc: liambeguin, martin.von.zweigbergk

Add the 'rebase.abbrevCmd' boolean config option to allow
the user to abbreviate the default command name while editing
the 'git-rebase-todo' file.

Signed-off-by: Liam Beguin <liambeguin@gmail.com>
---
Notes:

 *  This allows the lines to remain aligned when using single
    letter commands.

 Documentation/config.txt     | 3 +++
 Documentation/git-rebase.txt | 3 +++
 git-rebase--interactive.sh   | 8 ++++++--
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 475e874d5155..59b64832aeb4 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -2614,6 +2614,9 @@ rebase.instructionFormat::
 	the instruction list during an interactive rebase.  The format will automatically
 	have the long commit hash prepended to the format.
 
+rebase.abbrevCmd::
+	If set to true, abbreviate command name in interactive mode.
+
 receive.advertiseAtomic::
 	By default, git-receive-pack will advertise the atomic push
 	capability to its clients. If you don't want to advertise this
diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index 67d48e688315..0c423d903625 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -222,6 +222,9 @@ rebase.missingCommitsCheck::
 rebase.instructionFormat::
 	Custom commit list format to use during an `--interactive` rebase.
 
+rebase.abbrevCmd::
+	If set to true, abbreviate command name in interactive mode.
+
 OPTIONS
 -------
 --onto <newbase>::
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 2c9c0165b5ab..9f3e82b79615 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -1210,6 +1210,10 @@ else
 	revisions=$onto...$orig_head
 	shortrevisions=$shorthead
 fi
+
+rebasecmd=pick
+test "$(git config --bool --get rebase.abbrevCmd)" = true && rebasecmd=p
+
 format=$(git config --get rebase.instructionFormat)
 # the 'rev-list .. | sed' requires %m to parse; the instruction requires %H to parse
 git rev-list $merges_option --format="%m%H ${format:-%s}" \
@@ -1228,7 +1232,7 @@ do
 
 	if test t != "$preserve_merges"
 	then
-		printf '%s\n' "${comment_out}pick $sha1 $rest" >>"$todo"
+		printf '%s\n' "${comment_out}${rebasecmd} $sha1 $rest" >>"$todo"
 	else
 		if test -z "$rebase_root"
 		then
@@ -1246,7 +1250,7 @@ do
 		if test f = "$preserve"
 		then
 			touch "$rewritten"/$sha1
-			printf '%s\n' "${comment_out}pick $sha1 $rest" >>"$todo"
+			printf '%s\n' "${comment_out}${rebasecmd} $sha1 $rest" >>"$todo"
 		fi
 	fi
 done
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2017-04-27  1:21 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-24  3:23 [PATCH] rebase -i: add config to abbreviate command name Liam Beguin
2017-04-24 10:26 ` Johannes Schindelin
2017-04-24 11:04   ` liam BEGUIN
2017-04-25  2:57   ` liam BEGUIN
2017-04-25 19:45     ` Johannes Schindelin
2017-04-25 22:58       ` liam BEGUIN
2017-04-24 12:29 ` Jeff King
2017-04-25  4:37 ` [PATCH v2] rebase -i: add config to abbreviate command-names Liam Beguin
2017-04-25  6:29   ` Junio C Hamano
2017-04-25  8:29     ` Jacob Keller
2017-04-25 23:34       ` liam Beguin
2017-04-26  2:09       ` Junio C Hamano
2017-04-25  9:57   ` Andreas Schwab
2017-04-25 13:59     ` Mike Rappazzo
2017-04-25 10:34   ` Philip Oakley
2017-04-25  4:43 ` Liam Beguin
2017-04-25  9:53   ` Andreas Schwab
2017-04-25 21:23     ` Johannes Schindelin
2017-04-25 22:56       ` liam BEGUIN
2017-04-25 20:08   ` Johannes Schindelin
2017-04-26  0:13     ` liam Beguin
2017-04-26  1:47       ` Jeff King
2017-04-26  3:59         ` Junio C Hamano
2017-04-26  9:25           ` Johannes Schindelin
2017-04-27  0:37             ` Junio C Hamano
2017-04-26  9:28       ` Johannes Schindelin
2017-04-26 15:24   ` Ævar Arnfjörð Bjarmason
2017-04-27  1:20     ` liam Beguin

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).