git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Bug? ran into a "fatal" using interactive rebase
@ 2016-09-06 18:08 Ralf Thielow
  2016-09-07 15:19 ` Johannes Schindelin
  0 siblings, 1 reply; 4+ messages in thread
From: Ralf Thielow @ 2016-09-06 18:08 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin, Junio C Hamano

Hi,

today I accidentally triggered a "fatal" using interactive rebase.

If you edit the instruction sheet after 'rebase -i' and add an unknown
command, Git stops because it doesn't know the command.
That's fine, however, now we are in a state where 'git status' fails with

interactive rebase in progress; onto 311f279
fatal: Could not open file .git/rebase-merge/done for reading: No such
file or directory

After finishing the interactive rebase, things are fixed.  Looks like a
special case that isn't handled well, yet.

My Git version is the current 'next' branch.

Ralf

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bug? ran into a "fatal" using interactive rebase
  2016-09-06 18:08 Bug? ran into a "fatal" using interactive rebase Ralf Thielow
@ 2016-09-07 15:19 ` Johannes Schindelin
  2016-09-07 17:02   ` Ralf Thielow
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Schindelin @ 2016-09-07 15:19 UTC (permalink / raw)
  To: Ralf Thielow; +Cc: git, Junio C Hamano

Hi Ralf,

On Tue, 6 Sep 2016, Ralf Thielow wrote:

> today I accidentally triggered a "fatal" using interactive rebase.
> 
> If you edit the instruction sheet after 'rebase -i' and add an unknown
> command, Git stops because it doesn't know the command.
> That's fine, however, now we are in a state where 'git status' fails with
> 
> interactive rebase in progress; onto 311f279
> fatal: Could not open file .git/rebase-merge/done for reading: No such
> file or directory

There was some discussion revolving around this (IIRC Matthieu was
involved, hence I Cc:ed him) and I was under the impression that we fixed
the status code not to assume the presence of the "done" file.

Apparently I was wrong...

So, something like this should help (if you are interested in seeing this
patch included, please run with it, as I am running short on time):

-- snipsnap --
diff --git a/wt-status.c b/wt-status.c
index 6225a2d..8e4d999 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -1072,14 +1072,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 void read_rebase_todolist(const char *fname, struct string_list *lines, int gently)
 {
 	struct strbuf line = STRBUF_INIT;
 	FILE *f = fopen(git_path("%s", fname), "r");
 
-	if (!f)
+	if (!f) {
+		if (gently)
+			return;
 		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;
@@ -1102,8 +1105,8 @@ 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);
+		read_rebase_todolist("rebase-merge/done", &have_done, 1);
+		read_rebase_todolist("rebase-merge/git-rebase-todo", &yet_to_do, 0);
 
 		if (have_done.nr == 0)
 			status_printf_ln(s, color, _("No commands done."));




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: Bug? ran into a "fatal" using interactive rebase
  2016-09-07 15:19 ` Johannes Schindelin
@ 2016-09-07 17:02   ` Ralf Thielow
  2016-09-08  6:57     ` Johannes Schindelin
  0 siblings, 1 reply; 4+ messages in thread
From: Ralf Thielow @ 2016-09-07 17:02 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git, Junio C Hamano

2016-09-07 17:19 GMT+02:00 Johannes Schindelin <Johannes.Schindelin@gmx.de>:
>
> So, something like this should help (if you are interested in seeing this
> patch included, please run with it, as I am running short on time):
>
> -- snipsnap --
> diff --git a/wt-status.c b/wt-status.c
> index 6225a2d..8e4d999 100644
> --- a/wt-status.c
> +++ b/wt-status.c
> @@ -1072,14 +1072,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 void read_rebase_todolist(const char *fname, struct string_list *lines, int gently)
>  {
>         struct strbuf line = STRBUF_INIT;
>         FILE *f = fopen(git_path("%s", fname), "r");
>
> -       if (!f)
> +       if (!f) {
> +               if (gently)
> +                       return;
>                 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;
> @@ -1102,8 +1105,8 @@ 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);
> +               read_rebase_todolist("rebase-merge/done", &have_done, 1);
> +               read_rebase_todolist("rebase-merge/git-rebase-todo", &yet_to_do, 0);
>
>                 if (have_done.nr == 0)
>                         status_printf_ln(s, color, _("No commands done."));
>
>

That works for me. Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bug? ran into a "fatal" using interactive rebase
  2016-09-07 17:02   ` Ralf Thielow
@ 2016-09-08  6:57     ` Johannes Schindelin
  0 siblings, 0 replies; 4+ messages in thread
From: Johannes Schindelin @ 2016-09-08  6:57 UTC (permalink / raw)
  To: Ralf Thielow; +Cc: git, Junio C Hamano

Hi Ralf,

On Wed, 7 Sep 2016, Ralf Thielow wrote:

> 2016-09-07 17:19 GMT+02:00 Johannes Schindelin <Johannes.Schindelin@gmx.de>:
> >
> > So, something like this should help (if you are interested in seeing this
> > patch included, please run with it, as I am running short on time):

What I meant is: could you craft a test, a proper commit message, and
submit it? I will be mostly offline during the second half of September
and have many other things to take care of right now.

Thanks,
Dscho

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-09-08  6:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-06 18:08 Bug? ran into a "fatal" using interactive rebase Ralf Thielow
2016-09-07 15:19 ` Johannes Schindelin
2016-09-07 17:02   ` Ralf Thielow
2016-09-08  6:57     ` 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).