{"thread":{"id":"44025","subject":"Bug? ran into a \"fatal\" using interactive rebase","startedAt":"2016-09-06T18:08:08Z","lastAt":"2016-09-08T06:57:38Z","messageCount":4,"participants":["Ralf Thielow","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"301216","messageId":"CAN0XMO+ZOV3M02wJ_=oMPbN4ch-=7gA_pXEegfHApvSNeOu3KA@mail.gmail.com","threadId":"44025","inReplyTo":null,"subject":"Bug? ran into a \"fatal\" using interactive rebase","fromName":"Ralf Thielow","fromEmail":"ralf.thielow@gmail.com","sentAt":"2016-09-06T18:08:01Z","receivedAt":"2016-09-06T18:08:08Z","isPatch":false,"sender":{"key":"ralf.thielow@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1275832?v=4"},"body":"Hi,\n\ntoday I accidentally triggered a \"fatal\" using interactive rebase.\n\nIf you edit the instruction sheet after 'rebase -i' and add an unknown\ncommand, Git stops because it doesn't know the command.\nThat's fine, however, now we are in a state where 'git status' fails with\n\ninteractive rebase in progress; onto 311f279\nfatal: Could not open file .git/rebase-merge/done for reading: No such\nfile or directory\n\nAfter finishing the interactive rebase, things are fixed.  Looks like a\nspecial case that isn't handled well, yet.\n\nMy Git version is the current 'next' branch.\n\nRalf\n"},{"id":"301285","messageId":"alpine.DEB.2.20.1609071714540.129229@virtualbox","threadId":"44025","inReplyTo":"CAN0XMO+ZOV3M02wJ_=oMPbN4ch-=7gA_pXEegfHApvSNeOu3KA@mail.gmail.com","subject":"Re: Bug? ran into a \"fatal\" using interactive rebase","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2016-09-07T15:19:58Z","receivedAt":"2016-09-07T15:20:30Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Ralf,\n\nOn Tue, 6 Sep 2016, Ralf Thielow wrote:\n\n> today I accidentally triggered a \"fatal\" using interactive rebase.\n> \n> If you edit the instruction sheet after 'rebase -i' and add an unknown\n> command, Git stops because it doesn't know the command.\n> That's fine, however, now we are in a state where 'git status' fails with\n> \n> interactive rebase in progress; onto 311f279\n> fatal: Could not open file .git/rebase-merge/done for reading: No such\n> file or directory\n\nThere was some discussion revolving around this (IIRC Matthieu was\ninvolved, hence I Cc:ed him) and I was under the impression that we fixed\nthe status code not to assume the presence of the \"done\" file.\n\nApparently I was wrong...\n\nSo, something like this should help (if you are interested in seeing this\npatch included, please run with it, as I am running short on time):\n\n-- snipsnap --\ndiff --git a/wt-status.c b/wt-status.c\nindex 6225a2d..8e4d999 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -1072,14 +1072,17 @@ static void abbrev_sha1_in_line(struct strbuf *line)\n \tstrbuf_list_free(split);\n }\n \n-static void read_rebase_todolist(const char *fname, struct string_list *lines)\n+static void read_rebase_todolist(const char *fname, struct string_list *lines, int gently)\n {\n \tstruct strbuf line = STRBUF_INIT;\n \tFILE *f = fopen(git_path(\"%s\", fname), \"r\");\n \n-\tif (!f)\n+\tif (!f) {\n+\t\tif (gently)\n+\t\t\treturn;\n \t\tdie_errno(\"Could not open file %s for reading\",\n \t\t\t  git_path(\"%s\", fname));\n+\t}\n \twhile (!strbuf_getline_lf(&line, f)) {\n \t\tif (line.len && line.buf[0] == comment_line_char)\n \t\t\tcontinue;\n@@ -1102,8 +1105,8 @@ static void show_rebase_information(struct wt_status *s,\n \t\tstruct string_list have_done = STRING_LIST_INIT_DUP;\n \t\tstruct string_list yet_to_do = STRING_LIST_INIT_DUP;\n \n-\t\tread_rebase_todolist(\"rebase-merge/done\", &have_done);\n-\t\tread_rebase_todolist(\"rebase-merge/git-rebase-todo\",\n\t\t&yet_to_do);\n+\t\tread_rebase_todolist(\"rebase-merge/done\", &have_done, 1);\n+\t\tread_rebase_todolist(\"rebase-merge/git-rebase-todo\", &yet_to_do, 0);\n \n \t\tif (have_done.nr == 0)\n \t\t\tstatus_printf_ln(s, color, _(\"No commands done.\"));\n\n\n\n"},{"id":"301293","messageId":"CAN0XMOL7LEcJAHhmSwq8QWH7mD7+jQXRkAdQA+3hZ2JQUJ99Gw@mail.gmail.com","threadId":"44025","inReplyTo":"alpine.DEB.2.20.1609071714540.129229@virtualbox","subject":"Re: Bug? ran into a \"fatal\" using interactive rebase","fromName":"Ralf Thielow","fromEmail":"ralf.thielow@gmail.com","sentAt":"2016-09-07T17:02:03Z","receivedAt":"2016-09-07T17:02:10Z","isPatch":false,"sender":{"key":"ralf.thielow@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1275832?v=4"},"body":"2016-09-07 17:19 GMT+02:00 Johannes Schindelin <Johannes.Schindelin@gmx.de>:\n>\n> So, something like this should help (if you are interested in seeing this\n> patch included, please run with it, as I am running short on time):\n>\n> -- snipsnap --\n> diff --git a/wt-status.c b/wt-status.c\n> index 6225a2d..8e4d999 100644\n> --- a/wt-status.c\n> +++ b/wt-status.c\n> @@ -1072,14 +1072,17 @@ static void abbrev_sha1_in_line(struct strbuf *line)\n>         strbuf_list_free(split);\n>  }\n>\n> -static void read_rebase_todolist(const char *fname, struct string_list *lines)\n> +static void read_rebase_todolist(const char *fname, struct string_list *lines, int gently)\n>  {\n>         struct strbuf line = STRBUF_INIT;\n>         FILE *f = fopen(git_path(\"%s\", fname), \"r\");\n>\n> -       if (!f)\n> +       if (!f) {\n> +               if (gently)\n> +                       return;\n>                 die_errno(\"Could not open file %s for reading\",\n>                           git_path(\"%s\", fname));\n> +       }\n>         while (!strbuf_getline_lf(&line, f)) {\n>                 if (line.len && line.buf[0] == comment_line_char)\n>                         continue;\n> @@ -1102,8 +1105,8 @@ static void show_rebase_information(struct wt_status *s,\n>                 struct string_list have_done = STRING_LIST_INIT_DUP;\n>                 struct string_list yet_to_do = STRING_LIST_INIT_DUP;\n>\n> -               read_rebase_todolist(\"rebase-merge/done\", &have_done);\n> -               read_rebase_todolist(\"rebase-merge/git-rebase-todo\",\n>                 &yet_to_do);\n> +               read_rebase_todolist(\"rebase-merge/done\", &have_done, 1);\n> +               read_rebase_todolist(\"rebase-merge/git-rebase-todo\", &yet_to_do, 0);\n>\n>                 if (have_done.nr == 0)\n>                         status_printf_ln(s, color, _(\"No commands done.\"));\n>\n>\n\nThat works for me. Thanks.\n"},{"id":"301368","messageId":"alpine.DEB.2.20.1609080856290.129229@virtualbox","threadId":"44025","inReplyTo":"CAN0XMOL7LEcJAHhmSwq8QWH7mD7+jQXRkAdQA+3hZ2JQUJ99Gw@mail.gmail.com","subject":"Re: Bug? ran into a \"fatal\" using interactive rebase","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2016-09-08T06:57:22Z","receivedAt":"2016-09-08T06:57:38Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Ralf,\n\nOn Wed, 7 Sep 2016, Ralf Thielow wrote:\n\n> 2016-09-07 17:19 GMT+02:00 Johannes Schindelin <Johannes.Schindelin@gmx.de>:\n> >\n> > So, something like this should help (if you are interested in seeing this\n> > patch included, please run with it, as I am running short on time):\n\nWhat I meant is: could you craft a test, a proper commit message, and\nsubmit it? I will be mostly offline during the second half of September\nand have many other things to take care of right now.\n\nThanks,\nDscho\n"}]}