diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-02-02 13:36:54 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-02-02 13:36:54 -0800 |
commit | 93d2387718b20b9b0784dce4a361c0b74ab632b7 (patch) | |
tree | e860ba41b67819b846eb7bcc8a945505fa5279e8 /wt-status.c | |
parent | 9dec2c652fdfebf8861b526405422088e7022bc0 (diff) | |
parent | df9ded4984ca9a2d8da9007049f4fb5275eaa3ac (diff) | |
download | git-93d2387718b20b9b0784dce4a361c0b74ab632b7.tar.gz |
Merge branch 'js/status-pre-rebase-i'
After starting "git rebase -i", which first opens the user's editor
to edit the series of patches to apply, but before saving the
contents of that file, "git status" failed to show the current
state (i.e. you are in an interactive rebase session, but you have
applied no steps yet) correctly.
* js/status-pre-rebase-i:
status: be prepared for not-yet-started interactive rebase
Diffstat (limited to 'wt-status.c')
-rw-r--r-- | wt-status.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/wt-status.c b/wt-status.c index a715e71906..4dff0b3e21 100644 --- a/wt-status.c +++ b/wt-status.c @@ -1135,14 +1135,17 @@ static void abbrev_sha1_in_line(struct strbuf *line) strbuf_list_free(split); } -static void read_rebase_todolist(const char *fname, struct string_list *lines) +static int read_rebase_todolist(const char *fname, struct string_list *lines) { struct strbuf line = STRBUF_INIT; FILE *f = fopen(git_path("%s", fname), "r"); - if (!f) + if (!f) { + if (errno == ENOENT) + return -1; die_errno("Could not open file %s for reading", git_path("%s", fname)); + } while (!strbuf_getline_lf(&line, f)) { if (line.len && line.buf[0] == comment_line_char) continue; @@ -1152,6 +1155,7 @@ static void read_rebase_todolist(const char *fname, struct string_list *lines) abbrev_sha1_in_line(&line); string_list_append(lines, line.buf); } + return 0; } static void show_rebase_information(struct wt_status *s, @@ -1166,8 +1170,10 @@ static void show_rebase_information(struct wt_status *s, struct string_list yet_to_do = STRING_LIST_INIT_DUP; read_rebase_todolist("rebase-merge/done", &have_done); - read_rebase_todolist("rebase-merge/git-rebase-todo", &yet_to_do); - + if (read_rebase_todolist("rebase-merge/git-rebase-todo", + &yet_to_do)) + status_printf_ln(s, color, + _("git-rebase-todo is missing.")); if (have_done.nr == 0) status_printf_ln(s, color, _("No commands done.")); else { |