|
|
a98108 |
From 68e7090f31b4d4f2c7b9a25240af61149fbebb5c Mon Sep 17 00:00:00 2001
|
|
|
a98108 |
From: Alban Gruin <alban.gruin@gmail.com>
|
|
|
a98108 |
Date: Mon, 30 Mar 2020 14:42:35 +0200
|
|
|
a98108 |
Subject: [PATCH 1/2] sequencer: don't abbreviate a command if it doesn't have
|
|
|
a98108 |
a short form
|
|
|
a98108 |
|
|
|
a98108 |
When the sequencer is requested to abbreviate commands, it will replace
|
|
|
a98108 |
those that do not have a short form (eg. `noop') by a comment mark.
|
|
|
a98108 |
`noop' serves no purpose, except when fast-forwarding (ie. by running
|
|
|
a98108 |
`git rebase'). Removing it will break this command when
|
|
|
a98108 |
`rebase.abbreviateCommands' is set to true.
|
|
|
a98108 |
|
|
|
a98108 |
Teach todo_list_to_strbuf() to check if a command has an actual
|
|
|
a98108 |
short form, and to ignore it if not.
|
|
|
a98108 |
|
|
|
a98108 |
Signed-off-by: Alban Gruin <alban.gruin@gmail.com>
|
|
|
a98108 |
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|
|
|
a98108 |
---
|
|
|
a98108 |
sequencer.c | 9 ++++++---
|
|
|
a98108 |
1 file changed, 6 insertions(+), 3 deletions(-)
|
|
|
a98108 |
|
|
|
a98108 |
diff --git a/sequencer.c b/sequencer.c
|
|
|
a98108 |
index e528225e78..c2f97f94ba 100644
|
|
|
a98108 |
--- a/sequencer.c
|
|
|
a98108 |
+++ b/sequencer.c
|
|
|
a98108 |
@@ -1564,7 +1564,7 @@ static const char *command_to_string(const enum todo_command command)
|
|
|
a98108 |
|
|
|
a98108 |
static char command_to_char(const enum todo_command command)
|
|
|
a98108 |
{
|
|
|
a98108 |
- if (command < TODO_COMMENT && todo_command_info[command].c)
|
|
|
a98108 |
+ if (command < TODO_COMMENT)
|
|
|
a98108 |
return todo_command_info[command].c;
|
|
|
a98108 |
return comment_line_char;
|
|
|
a98108 |
}
|
|
|
a98108 |
@@ -4947,6 +4947,8 @@ static void todo_list_to_strbuf(struct repository *r, struct todo_list *todo_lis
|
|
|
a98108 |
max = num;
|
|
|
a98108 |
|
|
|
a98108 |
for (item = todo_list->items, i = 0; i < max; i++, item++) {
|
|
|
a98108 |
+ char cmd;
|
|
|
a98108 |
+
|
|
|
a98108 |
/* if the item is not a command write it and continue */
|
|
|
a98108 |
if (item->command >= TODO_COMMENT) {
|
|
|
a98108 |
strbuf_addf(buf, "%.*s\n", item->arg_len,
|
|
|
a98108 |
@@ -4955,8 +4957,9 @@ static void todo_list_to_strbuf(struct repository *r, struct todo_list *todo_lis
|
|
|
a98108 |
}
|
|
|
a98108 |
|
|
|
a98108 |
/* add command to the buffer */
|
|
|
a98108 |
- if (flags & TODO_LIST_ABBREVIATE_CMDS)
|
|
|
a98108 |
- strbuf_addch(buf, command_to_char(item->command));
|
|
|
a98108 |
+ cmd = command_to_char(item->command);
|
|
|
a98108 |
+ if ((flags & TODO_LIST_ABBREVIATE_CMDS) && cmd)
|
|
|
a98108 |
+ strbuf_addch(buf, cmd);
|
|
|
a98108 |
else
|
|
|
a98108 |
strbuf_addstr(buf, command_to_string(item->command));
|
|
|
a98108 |
|
|
|
a98108 |
--
|
|
|
a98108 |
2.26.0
|