git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/2] rebase: create HEAD reflog entry when aborting

From
Jeff King <peff@peff.net>
Date
May 27, 2011, 20:13 UTC
Message-ID
<20110527201302.GA29836@sigill.intra.peff.net>
In-Reply-To
<BANLkTinyKQJQUHa8tn43=cCJMsVbgaZXjA@mail.gmail.com>
From: Csaba Henk <csaba@lowlife.hu>

When we abort a rebase, we return to the original value of HEAD. Failing to write a reflog entry means we create a gap in the reflog (which can cause "git show HEAD@{5.minutes.ago}" to issue a warning). Plus having the extra entry makes the reflog easier to follow for a human.

Signed-off-by: Jeff King <peff@peff.net>
---
This is the one that actually gave you trouble. It's different than
other cases (dealt with in 2/2) in that it actually creates a gap in the
reflog. So I think fixing it is the right thing to do, and your original
patch is fine.
 git-rebase.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/git-rebase.sh b/git-rebase.sh
index 7a54bfc..57cbe49 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -332,7 +332,7 @@ abort)
 	read_basic_state
 	case "$head_name" in
 	refs/*)
-		git symbolic-ref HEAD $head_name ||
+		git symbolic-ref -m "rebase: aborting" HEAD $head_name ||
 		die "Could not move back to $head_name"
 		;;
 	esac
-- 
1.7.5.3.12.g99e25
Previous: Csaba HenkNext: Jeff King
Message 6 of 11 in “git symbolic-ref vs. reflog (vs. rebase)”
  1. Csaba HenkApr 29, 2011
  2. Junio C HamanoApr 29, 2011
  3. Csaba HenkApr 29, 2011
  4. Jeff KingApr 30, 2011
  5. Csaba HenkMay 2, 2011
  6. 1/2 rebase: create HEAD reflog entry when abortingJeff King, May 27, 2011
  7. 2/2 rebase: write a reflog entry when finishingJeff King, May 27, 2011
  8. Jeff KingApr 29, 2011
  9. Junio C HamanoApr 29, 2011
  10. Jeff KingApr 30, 2011
  11. Csaba HenkMay 2, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.