git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Sverre Rabbelier <srabbelier@gmail.com>
Cc: "Nguyen Thai Ngoc Duy" <pclouds@gmail.com>,
	git <git@vger.kernel.org>, "Junio C Hamano" <gitster@pobox.com>,
	"Frédéric Brière" <fbriere@fbriere.net>,
	"Johannes Schindelin" <johannes.schindelin@gmx.de>,
	"Christian Couder" <chriscool@tuxfamily.org>
Subject: Re: [PATCH] checkout: do not switch branch during a rebase unless -f is given
Date: Tue, 9 Nov 2010 08:36:01 -0600	[thread overview]
Message-ID: <20101109143601.GB18960@burratino> (raw)
In-Reply-To: <AANLkTi=2q1-1zmR=JquN75DP9sGGuPVkAu4mVs1U9DZo@mail.gmail.com>

Sverre Rabbelier wrote:

> And then here you smash my hopes that you were suggesting we stop
> asking the user to mess around in the .git directory :(. After all, if
> we let that rm be handled by some 'git rebase' mode, it could also
> unlock any branches it has locked.

Well, I think that is worth doing, too.  It's just that it's hard to
change existing practices and much easier to change the tools to
keep supporting them.

I don't think the manual advertises .git/rebase-merge anywhere.  I
have witnessed people succumbing to the temptation to delete it when
another rebase fails.

Maybe "git rebase" should have a --override-rebase-in-progress option?
The following is simpler, sort of imitating the "git bisect reset"
command.  With it applied, if you do

	git rebase --abort HEAD

then the rebase will abort without changing the current HEAD (yes,
I know this interface is stupid; please feel free to pick it up
and do better).

Other practices worth abstracting away:

	- Reading .git/rebase-merge/patch and
	  .git/rebase-merge/message when a patch had conflicts
	- Checking for the existence of .git/rebase-merge in $PS1
	  prompt
	- Tweaking .git/rebase-merge/todo to reflect a change of plan

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index 30e5c0e..3a587a1 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -227,6 +227,9 @@ leave out at most one of A and B, in which case it defaults to HEAD.
 --abort::
 	Restore the original branch and abort the rebase operation.
 
+--abort HEAD::
+	Abort the rebase operation, without changing the current branch.
+
 --skip::
 	Restart the rebasing process by skipping the current patch.
 
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index a27952d..2e1c074 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -772,6 +772,14 @@ first and then run 'git rebase --continue' again."
 		do_rest
 		;;
 	--abort)
+		if test "$2" = HEAD
+		then
+			shift
+			is_standalone "$@" || usage
+			get_saved_options
+			rm -rf "$DOTEST"
+			exit
+		fi
 		is_standalone "$@" || usage
 		get_saved_options
 		comment_for_reflog abort
diff --git a/git-rebase.sh b/git-rebase.sh
index e5df23b..0f88a00 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -273,6 +273,11 @@ do
 		test -d "$dotest" -o -d "$GIT_DIR"/rebase-apply ||
 			die "No rebase in progress?"
 
+		if test "$2" = HEAD
+		then
+			rm -r "$dotest"
+			exit
+		fi
 		git rerere clear
 		if test -d "$dotest"
 		then

  reply	other threads:[~2010-11-09 14:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-28  4:52 [PATCH] commit: do not switch branch during a rebase unless -f is given Nguyễn Thái Ngọc Duy
2010-09-28  4:55 ` [PATCH] checkout: " Nguyễn Thái Ngọc Duy
2010-09-28  5:33   ` Jonathan Nieder
2010-09-28  5:47     ` Nguyen Thai Ngoc Duy
2010-11-09 13:40       ` Nguyen Thai Ngoc Duy
2010-11-09 14:06         ` Jonathan Nieder
2010-11-09 14:11           ` Sverre Rabbelier
2010-11-09 14:36             ` Jonathan Nieder [this message]
2010-11-09 14:15           ` Nguyen Thai Ngoc Duy
2010-11-09 14:38             ` Jonathan Nieder
2010-09-28  5:38 ` [PATCH] commit: " Junio C Hamano
2010-09-28 11:24 ` Sverre Rabbelier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101109143601.GB18960@burratino \
    --to=jrnieder@gmail.com \
    --cc=chriscool@tuxfamily.org \
    --cc=fbriere@fbriere.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmx.de \
    --cc=pclouds@gmail.com \
    --cc=srabbelier@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).