diff options
Diffstat (limited to 'rebase-interactive.c')
-rw-r--r-- | rebase-interactive.c | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/rebase-interactive.c b/rebase-interactive.c index 87649d0..c343e16 100644 --- a/rebase-interactive.c +++ b/rebase-interactive.c @@ -1,11 +1,16 @@ -#include "cache.h" +#include "git-compat-util.h" #include "commit.h" +#include "editor.h" +#include "environment.h" +#include "gettext.h" #include "sequencer.h" #include "rebase-interactive.h" +#include "repository.h" #include "strbuf.h" #include "commit-slab.h" #include "config.h" #include "dir.h" +#include "object-name.h" static const char edit_todo_list_advice[] = N_("You can fix this with 'git rebase --edit-todo' " @@ -54,22 +59,26 @@ void append_todo_help(int command_count, "l, label <label> = label current HEAD with a name\n" "t, reset <label> = reset HEAD to a label\n" "m, merge [-C <commit> | -c <commit>] <label> [# <oneline>]\n" -". create a merge commit using the original merge commit's\n" -". message (or the oneline, if no original merge commit was\n" -". specified); use -c <commit> to reword the commit message\n" +" create a merge commit using the original merge commit's\n" +" message (or the oneline, if no original merge commit was\n" +" specified); use -c <commit> to reword the commit message\n" +"u, update-ref <ref> = track a placeholder for the <ref> to be updated\n" +" to this position in the new commits. The <ref> is\n" +" updated at the end of the rebase\n" "\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), + strbuf_commented_addf(buf, comment_line_str, + 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)); + strbuf_add_commented_lines(buf, msg, strlen(msg), comment_line_str); if (get_missing_commit_check_level() == MISSING_COMMIT_CHECK_ERROR) msg = _("\nDo not remove any line. Use 'drop' " @@ -78,7 +87,7 @@ void append_todo_help(int command_count, msg = _("\nIf you remove a line here " "THAT COMMIT WILL BE LOST.\n"); - strbuf_add_commented_lines(buf, msg, strlen(msg)); + strbuf_add_commented_lines(buf, msg, strlen(msg), comment_line_str); if (edit_todo) msg = _("\nYou are editing the todo file " @@ -89,7 +98,7 @@ void append_todo_help(int command_count, msg = _("\nHowever, if you remove everything, " "the rebase will be aborted.\n\n"); - strbuf_add_commented_lines(buf, msg, strlen(msg)); + strbuf_add_commented_lines(buf, msg, strlen(msg), comment_line_str); } int edit_todo_list(struct repository *r, struct todo_list *todo_list, @@ -121,7 +130,7 @@ int edit_todo_list(struct repository *r, struct todo_list *todo_list, if (launch_sequence_editor(todo_file, &new_todo->buf, NULL)) return -2; - strbuf_stripspace(&new_todo->buf, 1); + strbuf_stripspace(&new_todo->buf, comment_line_str); if (initial && new_todo->buf.len == 0) return -3; @@ -143,6 +152,12 @@ int edit_todo_list(struct repository *r, struct todo_list *todo_list, return -4; } + /* + * See if branches need to be added or removed from the update-refs + * file based on the new todo list. + */ + todo_list_filter_update_refs(r, new_todo); + return 0; } @@ -178,7 +193,7 @@ int todo_list_check(struct todo_list *old_todo, struct todo_list *new_todo) struct commit *commit = item->commit; if (commit && !*commit_seen_at(&commit_seen, commit)) { strbuf_addf(&missing, " - %s %.*s\n", - find_unique_abbrev(&commit->object.oid, DEFAULT_ABBREV), + repo_find_unique_abbrev(the_repository, &commit->object.oid, DEFAULT_ABBREV), item->arg_len, todo_item_get_arg(old_todo, item)); *commit_seen_at(&commit_seen, commit) = 1; |