* git status during interactive rebase @ 2016-01-20 23:21 Stefan Beller 2016-01-21 8:23 ` Matthieu Moy 2016-01-21 9:28 ` Johannes Schindelin 0 siblings, 2 replies; 6+ messages in thread From: Stefan Beller @ 2016-01-20 23:21 UTC (permalink / raw) To: git@vger.kernel.org; +Cc: Guillaume Pages, Matthieu Moy So I ran an interactive rebase, and while editing .git/rebase-merge/git-rebase-todo I tried to run `git status` in another terminal to inquire about a filename of an untracked file. However, I got: $ git status On branch submodule-groups-v3 fatal: Could not open file .git/rebase-merge/done for reading: No such file or directory Was this behavior always the case? (IIRC it worked a long time ago?) Would it make sense to not abort completely but give a limited status? Thanks, Stefan ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: git status during interactive rebase 2016-01-20 23:21 git status during interactive rebase Stefan Beller @ 2016-01-21 8:23 ` Matthieu Moy 2016-01-21 22:16 ` Stefan Beller 2016-01-21 9:28 ` Johannes Schindelin 1 sibling, 1 reply; 6+ messages in thread From: Matthieu Moy @ 2016-01-21 8:23 UTC (permalink / raw) To: Stefan Beller; +Cc: git@vger.kernel.org, Guillaume Pages Stefan Beller <sbeller@google.com> writes: > So I ran an interactive rebase, and while editing > .git/rebase-merge/git-rebase-todo I tried to run > `git status` in another terminal to inquire about a > filename of an untracked file. > > However, I got: > > $ git status > On branch submodule-groups-v3 > fatal: Could not open file .git/rebase-merge/done for reading: No such > file or directory > > Was this behavior always the case? (IIRC it worked a long time ago?) >From the list of recipients, I guess you already found that the issue probably comes from 84e6fb9 (status: give more information during rebase -i, 2015-07-06), which introduced read_rebase_todolist("rebase-merge/done", &have_done); in wt-status.c. > Would it make sense to not abort completely but give a limited status? Yes. I guess read_rebase_todolist should be changed: static void 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) die_errno("Could not open file %s for reading", git_path("%s", fname)); This should return an empty string_list instead of dying when the file does not exist. The case of an empty list is already dealt with later: if (have_done.nr == 0) status_printf_ln(s, color, _("No commands done.")); No time to work on a patch for now :-(. -- Matthieu Moy http://www-verimag.imag.fr/~moy/ ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: git status during interactive rebase 2016-01-21 8:23 ` Matthieu Moy @ 2016-01-21 22:16 ` Stefan Beller 2016-01-21 22:35 ` Junio C Hamano 0 siblings, 1 reply; 6+ messages in thread From: Stefan Beller @ 2016-01-21 22:16 UTC (permalink / raw) To: Matthieu Moy; +Cc: git@vger.kernel.org, Guillaume Pages On Thu, Jan 21, 2016 at 12:23 AM, Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> wrote: > Stefan Beller <sbeller@google.com> writes: > >> So I ran an interactive rebase, and while editing >> .git/rebase-merge/git-rebase-todo I tried to run >> `git status` in another terminal to inquire about a >> filename of an untracked file. >> >> However, I got: >> >> $ git status >> On branch submodule-groups-v3 >> fatal: Could not open file .git/rebase-merge/done for reading: No such >> file or directory >> >> Was this behavior always the case? (IIRC it worked a long time ago?) > > From the list of recipients, I guess you already found that the issue > probably comes from 84e6fb9 (status: give more information during rebase > -i, 2015-07-06), which introduced > read_rebase_todolist("rebase-merge/done", &have_done); in wt-status.c. I just remembered you working on git-status specially during rebase, so I figured you may have a clue here. > No time to work on a patch for now :-(. :-( > The cop-out would be to write an empty 'done' file before editing the > todo, but it would give the wrong impression that it is safe to run `git > rebase --continue` now... Interactive rebase is *definitely* not > thread-safe ;-) ok. As I did not start the rebase yet, I figured I may still ask a thing. :P > So the proper fix might be to test for the presence of the "done" file and > otherwise tell the user that this rebase has not even started yet. So what Matthieu said? Thanks, Stefan ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: git status during interactive rebase 2016-01-21 22:16 ` Stefan Beller @ 2016-01-21 22:35 ` Junio C Hamano 2016-01-22 16:28 ` Johannes Schindelin 0 siblings, 1 reply; 6+ messages in thread From: Junio C Hamano @ 2016-01-21 22:35 UTC (permalink / raw) To: Stefan Beller; +Cc: Matthieu Moy, git@vger.kernel.org, Guillaume Pages Stefan Beller <sbeller@google.com> writes: >> So the proper fix might be to test for the presence of the "done" file and >> otherwise tell the user that this rebase has not even started yet. > > So what Matthieu said? Yup, I think that is the right thing to do. Perhaps something along this line (not tested and done on 'pu', so I am not committing it to anywhere myself)? wt-status.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/wt-status.c b/wt-status.c index ab4f80d..90b2474 100644 --- a/wt-status.c +++ b/wt-status.c @@ -1068,14 +1068,17 @@ static void abbrev_sha1_in_line(struct strbuf *line) } -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; @@ -1085,6 +1088,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, @@ -1098,12 +1102,12 @@ static void show_rebase_information(struct wt_status *s, struct string_list have_done = STRING_LIST_INIT_DUP; 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 (have_done.nr == 0) + if ((read_rebase_todolist("rebase-merge/done", &have_done) < 0) || + (read_rebase_todolist("rebase-merge/git-rebase-todo", &yet_to_do) < 0)) { + status_printf_ln(s, color, _("rebase-i not started yet.")); + } else if (have_done.nr == 0) { status_printf_ln(s, color, _("No commands done.")); - else { + } else { status_printf_ln(s, color, Q_("Last command done (%d command done):", "Last commands done (%d commands done):", ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: git status during interactive rebase 2016-01-21 22:35 ` Junio C Hamano @ 2016-01-22 16:28 ` Johannes Schindelin 0 siblings, 0 replies; 6+ messages in thread From: Johannes Schindelin @ 2016-01-22 16:28 UTC (permalink / raw) To: Junio C Hamano Cc: Stefan Beller, Matthieu Moy, git@vger.kernel.org, Guillaume Pages Hi, [Stefan, please do not drop me from the Cc: list ;-)] On Thu, 21 Jan 2016, Junio C Hamano wrote: > Perhaps something along this line (not tested and done on 'pu', so I > am not committing it to anywhere myself)? I like it! I tested it, amended it and am about to send out a mail with a commit message. Ciao, Dscho ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: git status during interactive rebase 2016-01-20 23:21 git status during interactive rebase Stefan Beller 2016-01-21 8:23 ` Matthieu Moy @ 2016-01-21 9:28 ` Johannes Schindelin 1 sibling, 0 replies; 6+ messages in thread From: Johannes Schindelin @ 2016-01-21 9:28 UTC (permalink / raw) To: Stefan Beller; +Cc: git@vger.kernel.org, Guillaume Pages, Matthieu Moy Hi Stefan, On Wed, 20 Jan 2016, Stefan Beller wrote: > So I ran an interactive rebase, and while editing > .git/rebase-merge/git-rebase-todo I tried to run > `git status` in another terminal to inquire about a > filename of an untracked file. Heh, I don't think that anybody did that before, because the rebase has not even quite started yet... The cop-out would be to write an empty 'done' file before editing the todo, but it would give the wrong impression that it is safe to run `git rebase --continue` now... Interactive rebase is *definitely* not thread-safe ;-) So the proper fix might be to test for the presence of the "done" file and otherwise tell the user that this rebase has not even started yet. Ciao, Dscho ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-01-22 16:28 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-01-20 23:21 git status during interactive rebase Stefan Beller 2016-01-21 8:23 ` Matthieu Moy 2016-01-21 22:16 ` Stefan Beller 2016-01-21 22:35 ` Junio C Hamano 2016-01-22 16:28 ` Johannes Schindelin 2016-01-21 9:28 ` Johannes Schindelin
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 NNTP newsgroup(s).