All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC/PATCH] status: suggest 'git merge --abort' when appropriate
@ 2016-07-21 12:58 Matthieu Moy
  2016-07-21 16:58 ` Stefan Beller
  2016-07-22 17:19 ` Junio C Hamano
  0 siblings, 2 replies; 3+ messages in thread
From: Matthieu Moy @ 2016-07-21 12:58 UTC (permalink / raw)
  To: git; +Cc: Thibault Durand, Matthieu Moy

We already suggest 'git rebase --abort' during a conflicted rebase.
Similarly, suggest 'git merge --abort' during conflict resolution on
'git merge'.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
 t/t7060-wtstatus.sh    | 4 ++++
 t/t7512-status-help.sh | 1 +
 wt-status.c            | 7 +++++--
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/t/t7060-wtstatus.sh b/t/t7060-wtstatus.sh
index 44bf1d8..4d17363 100755
--- a/t/t7060-wtstatus.sh
+++ b/t/t7060-wtstatus.sh
@@ -34,6 +34,7 @@ test_expect_success 'M/D conflict does not segfault' '
 On branch side
 You have unmerged paths.
   (fix conflicts and run "git commit")
+  (use "git merge --abort" to abort the merge)
 
 Unmerged paths:
   (use "git add/rm <file>..." as appropriate to mark resolution)
@@ -138,6 +139,7 @@ test_expect_success 'status when conflicts with add and rm advice (deleted by th
 On branch master
 You have unmerged paths.
   (fix conflicts and run "git commit")
+  (use "git merge --abort" to abort the merge)
 
 Unmerged paths:
   (use "git add/rm <file>..." as appropriate to mark resolution)
@@ -171,6 +173,7 @@ test_expect_success 'status when conflicts with add and rm advice (both deleted)
 On branch conflict_second
 You have unmerged paths.
   (fix conflicts and run "git commit")
+  (use "git merge --abort" to abort the merge)
 
 Unmerged paths:
   (use "git add/rm <file>..." as appropriate to mark resolution)
@@ -195,6 +198,7 @@ test_expect_success 'status when conflicts with only rm advice (both deleted)' '
 On branch conflict_second
 You have unmerged paths.
   (fix conflicts and run "git commit")
+  (use "git merge --abort" to abort the merge)
 
 Changes to be committed:
 
diff --git a/t/t7512-status-help.sh b/t/t7512-status-help.sh
index 49d19a3..5c3db65 100755
--- a/t/t7512-status-help.sh
+++ b/t/t7512-status-help.sh
@@ -29,6 +29,7 @@ test_expect_success 'status when conflicts unresolved' '
 On branch conflicts
 You have unmerged paths.
   (fix conflicts and run "git commit")
+  (use "git merge --abort" to abort the merge)
 
 Unmerged paths:
   (use "git add <file>..." to mark resolution)
diff --git a/wt-status.c b/wt-status.c
index de62ab2..1f21b6a 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -948,9 +948,12 @@ static void show_merge_in_progress(struct wt_status *s,
 {
 	if (has_unmerged(s)) {
 		status_printf_ln(s, color, _("You have unmerged paths."));
-		if (s->hints)
+		if (s->hints) {
 			status_printf_ln(s, color,
-				_("  (fix conflicts and run \"git commit\")"));
+					 _("  (fix conflicts and run \"git commit\")"));
+			status_printf_ln(s, color,
+					 _("  (use \"git merge --abort\" to abort the merge)"));
+		}
 	} else {
 		s-> commitable = 1;
 		status_printf_ln(s, color,
-- 
2.8.2.397.gbe91ebf.dirty


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

* Re: [RFC/PATCH] status: suggest 'git merge --abort' when appropriate
  2016-07-21 12:58 [RFC/PATCH] status: suggest 'git merge --abort' when appropriate Matthieu Moy
@ 2016-07-21 16:58 ` Stefan Beller
  2016-07-22 17:19 ` Junio C Hamano
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Beller @ 2016-07-21 16:58 UTC (permalink / raw)
  To: Matthieu Moy; +Cc: git, Thibault Durand

On Thu, Jul 21, 2016 at 5:58 AM, Matthieu Moy <Matthieu.Moy@imag.fr> wrote:
> We already suggest 'git rebase --abort' during a conflicted rebase.
> Similarly, suggest 'git merge --abort' during conflict resolution on
> 'git merge'.

I think this is a good addition.

Thanks,
Stefan

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

* Re: [RFC/PATCH] status: suggest 'git merge --abort' when appropriate
  2016-07-21 12:58 [RFC/PATCH] status: suggest 'git merge --abort' when appropriate Matthieu Moy
  2016-07-21 16:58 ` Stefan Beller
@ 2016-07-22 17:19 ` Junio C Hamano
  1 sibling, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2016-07-22 17:19 UTC (permalink / raw)
  To: Matthieu Moy; +Cc: git, Thibault Durand

Matthieu Moy <Matthieu.Moy@imag.fr> writes:

> We already suggest 'git rebase --abort' during a conflicted rebase.
> Similarly, suggest 'git merge --abort' during conflict resolution on
> 'git merge'.
>
> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
> ---

It wasn't immediately obvious without the context that the changed
code will trigger only during a merge, and not just any other case
where we have unmerged index entries.  show_merge_in_progress() is
only called when s.merge_in_progress is set, which in turn is set
only when MERGE_HEAD is there, so we are good here.

Will apply; thanks.

>  t/t7060-wtstatus.sh    | 4 ++++
>  t/t7512-status-help.sh | 1 +
>  wt-status.c            | 7 +++++--
>  3 files changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/t/t7060-wtstatus.sh b/t/t7060-wtstatus.sh
> index 44bf1d8..4d17363 100755
> --- a/t/t7060-wtstatus.sh
> +++ b/t/t7060-wtstatus.sh
> @@ -34,6 +34,7 @@ test_expect_success 'M/D conflict does not segfault' '
>  On branch side
>  You have unmerged paths.
>    (fix conflicts and run "git commit")
> +  (use "git merge --abort" to abort the merge)
>  
>  Unmerged paths:
>    (use "git add/rm <file>..." as appropriate to mark resolution)
> @@ -138,6 +139,7 @@ test_expect_success 'status when conflicts with add and rm advice (deleted by th
>  On branch master
>  You have unmerged paths.
>    (fix conflicts and run "git commit")
> +  (use "git merge --abort" to abort the merge)
>  
>  Unmerged paths:
>    (use "git add/rm <file>..." as appropriate to mark resolution)
> @@ -171,6 +173,7 @@ test_expect_success 'status when conflicts with add and rm advice (both deleted)
>  On branch conflict_second
>  You have unmerged paths.
>    (fix conflicts and run "git commit")
> +  (use "git merge --abort" to abort the merge)
>  
>  Unmerged paths:
>    (use "git add/rm <file>..." as appropriate to mark resolution)
> @@ -195,6 +198,7 @@ test_expect_success 'status when conflicts with only rm advice (both deleted)' '
>  On branch conflict_second
>  You have unmerged paths.
>    (fix conflicts and run "git commit")
> +  (use "git merge --abort" to abort the merge)
>  
>  Changes to be committed:
>  
> diff --git a/t/t7512-status-help.sh b/t/t7512-status-help.sh
> index 49d19a3..5c3db65 100755
> --- a/t/t7512-status-help.sh
> +++ b/t/t7512-status-help.sh
> @@ -29,6 +29,7 @@ test_expect_success 'status when conflicts unresolved' '
>  On branch conflicts
>  You have unmerged paths.
>    (fix conflicts and run "git commit")
> +  (use "git merge --abort" to abort the merge)
>  
>  Unmerged paths:
>    (use "git add <file>..." to mark resolution)
> diff --git a/wt-status.c b/wt-status.c
> index de62ab2..1f21b6a 100644
> --- a/wt-status.c
> +++ b/wt-status.c
> @@ -948,9 +948,12 @@ static void show_merge_in_progress(struct wt_status *s,
>  {
>  	if (has_unmerged(s)) {
>  		status_printf_ln(s, color, _("You have unmerged paths."));
> -		if (s->hints)
> +		if (s->hints) {
>  			status_printf_ln(s, color,
> -				_("  (fix conflicts and run \"git commit\")"));
> +					 _("  (fix conflicts and run \"git commit\")"));
> +			status_printf_ln(s, color,
> +					 _("  (use \"git merge --abort\" to abort the merge)"));
> +		}
>  	} else {
>  		s-> commitable = 1;
>  		status_printf_ln(s, color,

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

end of thread, other threads:[~2016-07-22 17:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-21 12:58 [RFC/PATCH] status: suggest 'git merge --abort' when appropriate Matthieu Moy
2016-07-21 16:58 ` Stefan Beller
2016-07-22 17:19 ` Junio C Hamano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.