git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Completion: Hint whether amend is the right thing to do.
@ 2008-05-28 14:08 Robin Rosenberg
  2008-05-28 15:53 ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Robin Rosenberg @ 2008-05-28 14:08 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

When you get a conflict during interactive rebase the next
thing to do is not to amend, but to continue the rebase.
With this change you get a reminder in the prompt.

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
 contrib/completion/git-completion.bash |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

I got a couple of broken rebases. Hence this fix.

-- robin

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 1698463..a606328 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -82,7 +82,12 @@ __git_ps1 ()
 			b="$(git symbolic-ref HEAD 2>/dev/null)"
 		elif [ -f "$g/.dotest-merge/interactive" ]
 		then
-			r="|REBASE-i"
+			if [ -f "$g/.dotest-merge/amend" ]
+			then
+				r="|REBASE-i-amend"
+			else
+				r="|REBASE-i-continue"
+			fi
 			b="$(cat "$g/.dotest-merge/head-name")"
 		elif [ -d "$g/.dotest-merge" ]
 		then
-- 
1.5.5.1.178.g1f811

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

* Re: [PATCH] Completion: Hint whether amend is the right thing to do.
  2008-05-28 14:08 [PATCH] Completion: Hint whether amend is the right thing to do Robin Rosenberg
@ 2008-05-28 15:53 ` Junio C Hamano
  2008-05-28 23:16   ` Shawn O. Pearce
  2008-05-28 23:33   ` Robin Rosenberg
  0 siblings, 2 replies; 6+ messages in thread
From: Junio C Hamano @ 2008-05-28 15:53 UTC (permalink / raw)
  To: Robin Rosenberg; +Cc: git, Johannes Schindelin

Robin Rosenberg <robin.rosenberg.lists@dewire.com> writes:

> When you get a conflict during interactive rebase the next
> thing to do is not to amend, but to continue the rebase.
> With this change you get a reminder in the prompt.
>
> Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
> ---
>  contrib/completion/git-completion.bash |    7 ++++++-
>  1 files changed, 6 insertions(+), 1 deletions(-)
>
> I got a couple of broken rebases. Hence this fix.
>
> -- robin
>
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 1698463..a606328 100755
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -82,7 +82,12 @@ __git_ps1 ()
>  			b="$(git symbolic-ref HEAD 2>/dev/null)"
>  		elif [ -f "$g/.dotest-merge/interactive" ]
>  		then
> -			r="|REBASE-i"
> +			if [ -f "$g/.dotest-merge/amend" ]
> +			then
> +				r="|REBASE-i-amend"
> +			else
> +				r="|REBASE-i-continue"
> +			fi
>  			b="$(cat "$g/.dotest-merge/head-name")"
>  		elif [ -d "$g/.dotest-merge" ]
>  		then
> -- 
> 1.5.5.1.178.g1f811

Hmm.  The "|REBASE-blah" prefix is already too long for my liking and this
makes it even longer X-<

Does this mean that it would help reduce mistakes if "git commit --amend"
noticed the presense of .dotest-merge but absense of .dotest-merge/amend
and refused to operate, I have to wonder?

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

* Re: [PATCH] Completion: Hint whether amend is the right thing to do.
  2008-05-28 15:53 ` Junio C Hamano
@ 2008-05-28 23:16   ` Shawn O. Pearce
  2008-05-28 23:33   ` Robin Rosenberg
  1 sibling, 0 replies; 6+ messages in thread
From: Shawn O. Pearce @ 2008-05-28 23:16 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Robin Rosenberg, git, Johannes Schindelin

Junio C Hamano <gitster@pobox.com> wrote:
> Robin Rosenberg <robin.rosenberg.lists@dewire.com> writes:
> 
> > When you get a conflict during interactive rebase the next
> > thing to do is not to amend, but to continue the rebase.
> > With this change you get a reminder in the prompt.
...
> Does this mean that it would help reduce mistakes if "git commit --amend"
> noticed the presense of .dotest-merge but absense of .dotest-merge/amend
> and refused to operate, I have to wonder?

Yea, even though rebase and commit are two different tools we
don't want the user to amend in the middle of a failed conflict
from rebase.  Adding the safety valve to commit --amend makes
more sense to me than teaching bash to show you the state.  Not
all of our users use bash.  Not all of our bash using users use
the bash completion package, or the _git_ps1 function we ship.
Etc.

I'd rather see the amend safety net than the bash prompt change.

-- 
Shawn.

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

* Re: [PATCH] Completion: Hint whether amend is the right thing to do.
  2008-05-28 15:53 ` Junio C Hamano
  2008-05-28 23:16   ` Shawn O. Pearce
@ 2008-05-28 23:33   ` Robin Rosenberg
  2008-05-28 23:39     ` Junio C Hamano
  1 sibling, 1 reply; 6+ messages in thread
From: Robin Rosenberg @ 2008-05-28 23:33 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Johannes Schindelin

onsdagen den 28 maj 2008 17.53.40 skrev Junio C Hamano:
> Does this mean that it would help reduce mistakes if "git commit --amend"
> noticed the presense of .dotest-merge but absense of .dotest-merge/amend
> and refused to operate, I have to wonder?

Well I found myself making these mistakes. That would probably be better. 
Shouldn't one block commit without amend too then? And then rebase needs
another option to be able to commit. Fixing the prompt was easier at the time .)

-- robin

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

* Re: [PATCH] Completion: Hint whether amend is the right thing to do.
  2008-05-28 23:33   ` Robin Rosenberg
@ 2008-05-28 23:39     ` Junio C Hamano
  2008-05-28 23:45       ` Shawn O. Pearce
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2008-05-28 23:39 UTC (permalink / raw)
  To: Robin Rosenberg; +Cc: git, Johannes Schindelin

Robin Rosenberg <robin.rosenberg.lists@dewire.com> writes:

> onsdagen den 28 maj 2008 17.53.40 skrev Junio C Hamano:
>> Does this mean that it would help reduce mistakes if "git commit --amend"
>> noticed the presense of .dotest-merge but absense of .dotest-merge/amend
>> and refused to operate, I have to wonder?
>
> Well I found myself making these mistakes. That would probably be better. 
> Shouldn't one block commit without amend too then?

If you mean to forbid "git commit" during rebase (perhaps interrupted by
s/pick/edit/), I do not think that would fly -- it is the advertised way
to split a commit into two, if I am not mistaken.

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

* Re: [PATCH] Completion: Hint whether amend is the right thing to do.
  2008-05-28 23:39     ` Junio C Hamano
@ 2008-05-28 23:45       ` Shawn O. Pearce
  0 siblings, 0 replies; 6+ messages in thread
From: Shawn O. Pearce @ 2008-05-28 23:45 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Robin Rosenberg, git, Johannes Schindelin

Junio C Hamano <gitster@pobox.com> wrote:
> Robin Rosenberg <robin.rosenberg.lists@dewire.com> writes:
> 
> > onsdagen den 28 maj 2008 17.53.40 skrev Junio C Hamano:
> >> Does this mean that it would help reduce mistakes if "git commit --amend"
> >> noticed the presense of .dotest-merge but absense of .dotest-merge/amend
> >> and refused to operate, I have to wonder?
> >
> > Well I found myself making these mistakes. That would probably be better. 
> > Shouldn't one block commit without amend too then?
> 
> If you mean to forbid "git commit" during rebase (perhaps interrupted by
> s/pick/edit/), I do not think that would fly -- it is the advertised way
> to split a commit into two, if I am not mistaken.

Right, you don't want to block commit if we stopped for an edit.

But if we stopped because merge-recursive failed due to merge
conflicts we want the user to fix up the tree, stage the changes,
and call `git rebase --continue` to let rebase continue further.

If further means finish the commit and then immediately stop (as
we had failed while picking an edit) , rebase will stop and let
the user edit.

We don't need a special flag for rebase to pass to commit, it can
just delete the state flag that prevents commits just before it
calls commit.

-- 
Shawn.

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

end of thread, other threads:[~2008-05-28 23:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-28 14:08 [PATCH] Completion: Hint whether amend is the right thing to do Robin Rosenberg
2008-05-28 15:53 ` Junio C Hamano
2008-05-28 23:16   ` Shawn O. Pearce
2008-05-28 23:33   ` Robin Rosenberg
2008-05-28 23:39     ` Junio C Hamano
2008-05-28 23:45       ` Shawn O. Pearce

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).