git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* working out where git-rebase is up to?
@ 2010-02-22 10:09 Jon Seymour
  2010-02-22 10:19 ` Marc Weber
  2010-02-22 10:26 ` Thomas Rast
  0 siblings, 2 replies; 6+ messages in thread
From: Jon Seymour @ 2010-02-22 10:09 UTC (permalink / raw)
  To: Git Mailing List

Hi,

For my funky "compensating rebases" I need to know where an automated
rebase has stopped. In particular, I need to know the sha1 of the
commit that caused the rebase to stop.

No doubt rebase is tracking this info, but is there a supported way to
discover it?

jon.

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

* Re: working out where git-rebase is up to?
  2010-02-22 10:09 working out where git-rebase is up to? Jon Seymour
@ 2010-02-22 10:19 ` Marc Weber
  2010-02-22 10:26 ` Thomas Rast
  1 sibling, 0 replies; 6+ messages in thread
From: Marc Weber @ 2010-02-22 10:19 UTC (permalink / raw)
  To: git

> No doubt rebase is tracking this info, but is there a supported way to
> discover it?

I may be mistaken. But git-rebase basically applies patches on top of a
branch. And the branch it's operating on is checked out.
So can't you just do 

  git rev-parse HEAD

to find out?

Also have a look at the output. git rebase tells you which patch it is
applying.

Marc Weber

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

* Re: working out where git-rebase is up to?
  2010-02-22 10:09 working out where git-rebase is up to? Jon Seymour
  2010-02-22 10:19 ` Marc Weber
@ 2010-02-22 10:26 ` Thomas Rast
  2010-02-22 10:47   ` Jon Seymour
  2010-02-22 10:49   ` Thomas Rast
  1 sibling, 2 replies; 6+ messages in thread
From: Thomas Rast @ 2010-02-22 10:26 UTC (permalink / raw)
  To: Jon Seymour; +Cc: Git Mailing List

On Monday 22 February 2010 11:09:18 Jon Seymour wrote:
> Hi,
> 
> For my funky "compensating rebases" I need to know where an automated
> rebase has stopped. In particular, I need to know the sha1 of the
> commit that caused the rebase to stop.
> 
> No doubt rebase is tracking this info, but is there a supported way to
> discover it?

It's in .git/rebase-merge/done (and .git/rebase-merge/git-rebase-todo
for the remaining TODO file).  Maybe we should add a 'git rebase
--whydiditstop' command ;-)

-- 
Thomas Rast
trast@{inf,student}.ethz.ch

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

* Re: working out where git-rebase is up to?
  2010-02-22 10:26 ` Thomas Rast
@ 2010-02-22 10:47   ` Jon Seymour
  2010-02-22 10:49   ` Thomas Rast
  1 sibling, 0 replies; 6+ messages in thread
From: Jon Seymour @ 2010-02-22 10:47 UTC (permalink / raw)
  To: Thomas Rast; +Cc: Git Mailing List

Once I am done with my compensating rebase, rebase won't have to stop :-)

jon.

On Mon, Feb 22, 2010 at 9:26 PM, Thomas Rast <trast@student.ethz.ch> wrote:
> On Monday 22 February 2010 11:09:18 Jon Seymour wrote:
>> Hi,
>>
>> For my funky "compensating rebases" I need to know where an automated
>> rebase has stopped. In particular, I need to know the sha1 of the
>> commit that caused the rebase to stop.
>>
>> No doubt rebase is tracking this info, but is there a supported way to
>> discover it?
>
> It's in .git/rebase-merge/done (and .git/rebase-merge/git-rebase-todo
> for the remaining TODO file).  Maybe we should add a 'git rebase
> --whydiditstop' command ;-)
>
> --
> Thomas Rast
> trast@{inf,student}.ethz.ch
>

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

* Re: working out where git-rebase is up to?
  2010-02-22 10:26 ` Thomas Rast
  2010-02-22 10:47   ` Jon Seymour
@ 2010-02-22 10:49   ` Thomas Rast
  2010-02-22 10:51     ` Jon Seymour
  1 sibling, 1 reply; 6+ messages in thread
From: Thomas Rast @ 2010-02-22 10:49 UTC (permalink / raw)
  To: Jon Seymour; +Cc: Git Mailing List

On Monday 22 February 2010 11:26:47 Thomas Rast wrote:
> On Monday 22 February 2010 11:09:18 Jon Seymour wrote:
> > For my funky "compensating rebases" I need to know where an automated
> > rebase has stopped. In particular, I need to know the sha1 of the
> > commit that caused the rebase to stop.
> > 
> > No doubt rebase is tracking this info, but is there a supported way to
> > discover it?
> 
> It's in .git/rebase-merge/done (and .git/rebase-merge/git-rebase-todo
> for the remaining TODO file).  Maybe we should add a 'git rebase
> --whydiditstop' command ;-)

Here's a lightly tested draft patch.  I should stop stealing work time
for this, but you're welcome to fill in docs and tests and submit it.

diff --git i/git-rebase--interactive.sh w/git-rebase--interactive.sh
index 415ae72..d34c057 100755
--- i/git-rebase--interactive.sh
+++ w/git-rebase--interactive.sh
@@ -13,7 +13,7 @@
 OPTIONS_KEEPDASHDASH=
 OPTIONS_SPEC="\
 git-rebase [-i] [options] [--] <upstream> [<branch>]
-git-rebase [-i] (--continue | --abort | --skip)
+git-rebase [-i] (--continue | --abort | --skip | --status)
 --
  Available options are
 v,verbose          display a diffstat of what changed upstream
@@ -26,6 +26,7 @@ i,interactive      always used (no-op)
 continue           continue rebasing process
 abort              abort rebasing process and restore original branch
 skip               skip current patch and continue rebasing process
+status	           show where the rebasing process stopped
 no-verify          override pre-rebase hook from stopping the operation
 root               rebase all reachable commmits up to the root(s)
 autosquash         move commits that begin with squash!/fixup! under -i
@@ -103,6 +104,10 @@ AMEND="$DOTEST"/amend
 REWRITTEN_LIST="$DOTEST"/rewritten-list
 REWRITTEN_PENDING="$DOTEST"/rewritten-pending
 
+# This file holds the status message that we showed to the user when
+# stopping, so that it can be retrieved by 'git rebase --status'.
+STATUS="$DOTEST"/status
+
 PRESERVE_MERGES=
 STRATEGY=
 ONTO=
@@ -204,11 +209,16 @@ make_patch () {
 		get_author_ident_from_commit "$1" > "$AUTHOR_SCRIPT"
 }
 
+status_message () {
+	cat >> "$STATUS"
+	"$1" "$(cat "$STATUS")"
+}
+
 die_with_patch () {
 	echo "$1" > "$DOTEST"/stopped-sha
 	make_patch "$1"
 	git rerere
-	die "$2"
+	status_message die "$2"
 }
 
 die_abort () {
@@ -429,8 +439,10 @@ die_failed_squash() {
 	mv "$SQUASH_MSG" "$MSG" || exit
 	rm -f "$FIXUP_MSG"
 	cp "$MSG" "$GIT_DIR"/MERGE_MSG || exit
-	warn
-	warn "Could not apply $1... $2"
+	status_message warn <<EOF
+
+Could not apply $1... $2
+EOF
 	die_with_patch $1 ""
 }
 
@@ -455,7 +467,7 @@ record_in_rewritten() {
 }
 
 do_next () {
-	rm -f "$MSG" "$AUTHOR_SCRIPT" "$AMEND" || exit
+	rm -f "$MSG" "$AUTHOR_SCRIPT" "$AMEND" "$STATUS" || exit
 	read command sha1 rest < "$TODO"
 	case "$command" in
 	'#'*|''|noop)
@@ -487,15 +499,17 @@ do_next () {
 		echo "$1" > "$DOTEST"/stopped-sha
 		make_patch $sha1
 		git rev-parse --verify HEAD > "$AMEND"
-		warn "Stopped at $sha1... $rest"
-		warn "You can amend the commit now, with"
-		warn
-		warn "	git commit --amend"
-		warn
-		warn "Once you are satisfied with your changes, run"
-		warn
-		warn "	git rebase --continue"
-		warn
+		status_message warn <<EOF
+Stopped at $sha1... $rest
+You can amend the commit now, with
+
+	git commit --amend
+
+Once you are satisfied with your changes, run
+
+	git rebase --continue
+
+EOF
 		exit 0
 		;;
 	squash|s|fixup|f)
@@ -767,6 +781,24 @@ first and then run 'git rebase --continue' again."
 
 		output git reset --hard && do_rest
 		;;
+	--status)
+		is_standalone "$@" || usage
+		warn "Your rebase stopped at the following action:"
+		warn
+		warn "    $(tail -1 "$DOTEST"/done)"
+		warn
+		next="$(sed -n -e "/^#/d" -e '/^$/d' -e "/ /p" -e "q" < "$TODO")"
+		if test -n "$next"; then
+			warn "The next action will be:"
+			warn
+			warn "    $next"
+		else
+			warn "There are no more actions left after this one."
+		fi
+		warn
+		cat "$STATUS" >&2
+		exit
+		;;
 	-s)
 		case "$#,$1" in
 		*,*=*)


-- 
Thomas Rast
trast@{inf,student}.ethz.ch

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

* Re: working out where git-rebase is up to?
  2010-02-22 10:49   ` Thomas Rast
@ 2010-02-22 10:51     ` Jon Seymour
  0 siblings, 0 replies; 6+ messages in thread
From: Jon Seymour @ 2010-02-22 10:51 UTC (permalink / raw)
  To: Thomas Rast; +Cc: Git Mailing List

> Here's a lightly tested draft patch.  I should stop stealing work time
> for this, but you're welcome to fill in docs and tests and submit it.
>

Thanks! I'll give it a whirl.

jon.

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

end of thread, other threads:[~2010-02-22 10:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-22 10:09 working out where git-rebase is up to? Jon Seymour
2010-02-22 10:19 ` Marc Weber
2010-02-22 10:26 ` Thomas Rast
2010-02-22 10:47   ` Jon Seymour
2010-02-22 10:49   ` Thomas Rast
2010-02-22 10:51     ` Jon Seymour

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