path: root/rebase-interactive.c
diff options
authorAlban Gruin <>2019-03-05 19:18:02 (GMT)
committerJunio C Hamano <>2019-03-07 00:17:57 (GMT)
commitaf1fc3adc5bf0d831ee3c1c8e86c1b7ce59e070e (patch)
tree18138a3a1ab2301972df0700fa66bd90fb48a94c /rebase-interactive.c
parentddb81e50724002645d7ec7d9ffdb714d02a47759 (diff)
rebase-interactive: append_todo_help() changes
This moves the writing of the comment "Rebase $shortrevisions onto $shortonto ($command_count commands)" from todo_list_write_to_file() to append_todo_help(). shortrevisions, shortonto, and command_count are passed as parameters to append_todo_help(). During the initial edit of the todo list, shortrevisions and shortonto are not NULL. Therefore, if shortrevisions or shortonto is NULL, then edit_todo would be true, otherwise it would be false. Thus, edit_todo is removed from the parameters of append_todo_help(). Signed-off-by: Alban Gruin <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'rebase-interactive.c')
1 files changed, 11 insertions, 1 deletions
diff --git a/rebase-interactive.c b/rebase-interactive.c
index d396ecc..807f837 100644
--- a/rebase-interactive.c
+++ b/rebase-interactive.c
@@ -28,7 +28,8 @@ static enum missing_commit_check_level get_missing_commit_check_level(void)
-void append_todo_help(unsigned edit_todo, unsigned keep_empty,
+void append_todo_help(unsigned keep_empty, int command_count,
+ const char *shortrevisions, const char *shortonto,
struct strbuf *buf)
const char *msg = _("\nCommands:\n"
@@ -48,6 +49,15 @@ void append_todo_help(unsigned edit_todo, unsigned keep_empty,
". specified). Use -c <commit> to reword the commit message.\n"
"These lines can be re-ordered; they are executed from top to bottom.\n");
+ unsigned edit_todo = !(shortrevisions && shortonto);
+ if (!edit_todo) {
+ strbuf_addch(buf, '\n');
+ strbuf_commented_addf(buf, Q_("Rebase %s onto %s (%d command)",
+ "Rebase %s onto %s (%d commands)",
+ command_count),
+ shortrevisions, shortonto, command_count);
+ }
strbuf_add_commented_lines(buf, msg, strlen(msg));