{"thread":{"id":"42899","subject":"[RFC/PATCH] status: suggest 'git merge --abort' when appropriate","startedAt":"2016-07-21T12:59:43Z","lastAt":"2016-07-22T17:20:13Z","messageCount":3,"participants":["Matthieu Moy","Stefan Beller","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"291912","messageId":"20160721125837.3127-1-Matthieu.Moy@imag.fr","threadId":"42899","inReplyTo":null,"subject":"[RFC/PATCH] status: suggest 'git merge --abort' when appropriate","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2016-07-21T12:58:37Z","receivedAt":"2016-07-21T12:59:43Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"We already suggest 'git rebase --abort' during a conflicted rebase.\nSimilarly, suggest 'git merge --abort' during conflict resolution on\n'git merge'.\n\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\n t/t7060-wtstatus.sh    | 4 ++++\n t/t7512-status-help.sh | 1 +\n wt-status.c            | 7 +++++--\n 3 files changed, 10 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t7060-wtstatus.sh b/t/t7060-wtstatus.sh\nindex 44bf1d8..4d17363 100755\n--- a/t/t7060-wtstatus.sh\n+++ b/t/t7060-wtstatus.sh\n@@ -34,6 +34,7 @@ test_expect_success 'M/D conflict does not segfault' '\n On branch side\n You have unmerged paths.\n   (fix conflicts and run \"git commit\")\n+  (use \"git merge --abort\" to abort the merge)\n \n Unmerged paths:\n   (use \"git add/rm <file>...\" as appropriate to mark resolution)\n@@ -138,6 +139,7 @@ test_expect_success 'status when conflicts with add and rm advice (deleted by th\n On branch master\n You have unmerged paths.\n   (fix conflicts and run \"git commit\")\n+  (use \"git merge --abort\" to abort the merge)\n \n Unmerged paths:\n   (use \"git add/rm <file>...\" as appropriate to mark resolution)\n@@ -171,6 +173,7 @@ test_expect_success 'status when conflicts with add and rm advice (both deleted)\n On branch conflict_second\n You have unmerged paths.\n   (fix conflicts and run \"git commit\")\n+  (use \"git merge --abort\" to abort the merge)\n \n Unmerged paths:\n   (use \"git add/rm <file>...\" as appropriate to mark resolution)\n@@ -195,6 +198,7 @@ test_expect_success 'status when conflicts with only rm advice (both deleted)' '\n On branch conflict_second\n You have unmerged paths.\n   (fix conflicts and run \"git commit\")\n+  (use \"git merge --abort\" to abort the merge)\n \n Changes to be committed:\n \ndiff --git a/t/t7512-status-help.sh b/t/t7512-status-help.sh\nindex 49d19a3..5c3db65 100755\n--- a/t/t7512-status-help.sh\n+++ b/t/t7512-status-help.sh\n@@ -29,6 +29,7 @@ test_expect_success 'status when conflicts unresolved' '\n On branch conflicts\n You have unmerged paths.\n   (fix conflicts and run \"git commit\")\n+  (use \"git merge --abort\" to abort the merge)\n \n Unmerged paths:\n   (use \"git add <file>...\" to mark resolution)\ndiff --git a/wt-status.c b/wt-status.c\nindex de62ab2..1f21b6a 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -948,9 +948,12 @@ static void show_merge_in_progress(struct wt_status *s,\n {\n \tif (has_unmerged(s)) {\n \t\tstatus_printf_ln(s, color, _(\"You have unmerged paths.\"));\n-\t\tif (s->hints)\n+\t\tif (s->hints) {\n \t\t\tstatus_printf_ln(s, color,\n-\t\t\t\t_(\"  (fix conflicts and run \\\"git commit\\\")\"));\n+\t\t\t\t\t _(\"  (fix conflicts and run \\\"git commit\\\")\"));\n+\t\t\tstatus_printf_ln(s, color,\n+\t\t\t\t\t _(\"  (use \\\"git merge --abort\\\" to abort the merge)\"));\n+\t\t}\n \t} else {\n \t\ts-> commitable = 1;\n \t\tstatus_printf_ln(s, color,\n-- \n2.8.2.397.gbe91ebf.dirty\n\n"},{"id":"291927","messageId":"CAGZ79kZ5So-tXRX60CTCxrsgW8Vv7QH5gXGDk89EP69Qk28Kcw@mail.gmail.com","threadId":"42899","inReplyTo":"20160721125837.3127-1-Matthieu.Moy@imag.fr","subject":"Re: [RFC/PATCH] status: suggest 'git merge --abort' when appropriate","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2016-07-21T16:58:35Z","receivedAt":"2016-07-21T16:58:58Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Thu, Jul 21, 2016 at 5:58 AM, Matthieu Moy <Matthieu.Moy@imag.fr> wrote:\n> We already suggest 'git rebase --abort' during a conflicted rebase.\n> Similarly, suggest 'git merge --abort' during conflict resolution on\n> 'git merge'.\n\nI think this is a good addition.\n\nThanks,\nStefan\n"},{"id":"291982","messageId":"xmqqa8h9bneo.fsf@gitster.mtv.corp.google.com","threadId":"42899","inReplyTo":"20160721125837.3127-1-Matthieu.Moy@imag.fr","subject":"Re: [RFC/PATCH] status: suggest 'git merge --abort' when appropriate","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-07-22T17:19:59Z","receivedAt":"2016-07-22T17:20:13Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthieu Moy <Matthieu.Moy@imag.fr> writes:\n\n> We already suggest 'git rebase --abort' during a conflicted rebase.\n> Similarly, suggest 'git merge --abort' during conflict resolution on\n> 'git merge'.\n>\n> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n> ---\n\nIt wasn't immediately obvious without the context that the changed\ncode will trigger only during a merge, and not just any other case\nwhere we have unmerged index entries.  show_merge_in_progress() is\nonly called when s.merge_in_progress is set, which in turn is set\nonly when MERGE_HEAD is there, so we are good here.\n\nWill apply; thanks.\n\n>  t/t7060-wtstatus.sh    | 4 ++++\n>  t/t7512-status-help.sh | 1 +\n>  wt-status.c            | 7 +++++--\n>  3 files changed, 10 insertions(+), 2 deletions(-)\n>\n> diff --git a/t/t7060-wtstatus.sh b/t/t7060-wtstatus.sh\n> index 44bf1d8..4d17363 100755\n> --- a/t/t7060-wtstatus.sh\n> +++ b/t/t7060-wtstatus.sh\n> @@ -34,6 +34,7 @@ test_expect_success 'M/D conflict does not segfault' '\n>  On branch side\n>  You have unmerged paths.\n>    (fix conflicts and run \"git commit\")\n> +  (use \"git merge --abort\" to abort the merge)\n>  \n>  Unmerged paths:\n>    (use \"git add/rm <file>...\" as appropriate to mark resolution)\n> @@ -138,6 +139,7 @@ test_expect_success 'status when conflicts with add and rm advice (deleted by th\n>  On branch master\n>  You have unmerged paths.\n>    (fix conflicts and run \"git commit\")\n> +  (use \"git merge --abort\" to abort the merge)\n>  \n>  Unmerged paths:\n>    (use \"git add/rm <file>...\" as appropriate to mark resolution)\n> @@ -171,6 +173,7 @@ test_expect_success 'status when conflicts with add and rm advice (both deleted)\n>  On branch conflict_second\n>  You have unmerged paths.\n>    (fix conflicts and run \"git commit\")\n> +  (use \"git merge --abort\" to abort the merge)\n>  \n>  Unmerged paths:\n>    (use \"git add/rm <file>...\" as appropriate to mark resolution)\n> @@ -195,6 +198,7 @@ test_expect_success 'status when conflicts with only rm advice (both deleted)' '\n>  On branch conflict_second\n>  You have unmerged paths.\n>    (fix conflicts and run \"git commit\")\n> +  (use \"git merge --abort\" to abort the merge)\n>  \n>  Changes to be committed:\n>  \n> diff --git a/t/t7512-status-help.sh b/t/t7512-status-help.sh\n> index 49d19a3..5c3db65 100755\n> --- a/t/t7512-status-help.sh\n> +++ b/t/t7512-status-help.sh\n> @@ -29,6 +29,7 @@ test_expect_success 'status when conflicts unresolved' '\n>  On branch conflicts\n>  You have unmerged paths.\n>    (fix conflicts and run \"git commit\")\n> +  (use \"git merge --abort\" to abort the merge)\n>  \n>  Unmerged paths:\n>    (use \"git add <file>...\" to mark resolution)\n> diff --git a/wt-status.c b/wt-status.c\n> index de62ab2..1f21b6a 100644\n> --- a/wt-status.c\n> +++ b/wt-status.c\n> @@ -948,9 +948,12 @@ static void show_merge_in_progress(struct wt_status *s,\n>  {\n>  \tif (has_unmerged(s)) {\n>  \t\tstatus_printf_ln(s, color, _(\"You have unmerged paths.\"));\n> -\t\tif (s->hints)\n> +\t\tif (s->hints) {\n>  \t\t\tstatus_printf_ln(s, color,\n> -\t\t\t\t_(\"  (fix conflicts and run \\\"git commit\\\")\"));\n> +\t\t\t\t\t _(\"  (fix conflicts and run \\\"git commit\\\")\"));\n> +\t\t\tstatus_printf_ln(s, color,\n> +\t\t\t\t\t _(\"  (use \\\"git merge --abort\\\" to abort the merge)\"));\n> +\t\t}\n>  \t} else {\n>  \t\ts-> commitable = 1;\n>  \t\tstatus_printf_ln(s, color,\n"}]}