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

[PATCHv2] rebase -i: use full onto sha1 in reflog

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Aug 10, 2012, 06:51 UTC
Message-ID
<54180665e1207275db9694cd68f49ff96812284e.1344581316.git.git@drmicha.warpmail.net>
In-Reply-To
<7vwr18nehe.fsf@alter.siamese.dyndns.org>

'git rebase' uses the full onto sha1 for the reflog message whereas 'git rebase -i' uses the short sha1. This is not only inconsistent, but can lead to problems when the reflog is inspected at a later time at which that abbreviation may have become ambiguous.

Make 'rebase -i' use the full onto sha1, as well.
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
So, this is without the now superfluous shortonto definition.
The other place where shortonto is defined is still needed.
 git-rebase--interactive.sh | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 0d2056f..a09e842 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -569,11 +569,10 @@ do_next () {
 	test -s "$todo" && return
 
 	comment_for_reflog finish &&
-	shortonto=$(git rev-parse --short $onto) &&
 	newhead=$(git rev-parse HEAD) &&
 	case $head_name in
 	refs/*)
-		message="$GIT_REFLOG_ACTION: $head_name onto $shortonto" &&
+		message="$GIT_REFLOG_ACTION: $head_name onto $onto" &&
 		git update-ref -m "$message" $head_name $newhead $orig_head &&
 		git symbolic-ref \
 		  -m "$GIT_REFLOG_ACTION: returning to $head_name" \
-- 
1.7.12.rc2.245.g4f94e02
Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 5 in “rebase -i: use full onto sha1 in reflog”
  1. rebase -i: use full onto sha1 in reflogMichael J Gruber, Aug 9, 2012
  2. Martin von ZweigbergkAug 9, 2012
  3. Junio C HamanoAug 9, 2012
  4. [PATCHv2] rebase -i: use full onto sha1 in reflogMichael J Gruber, Aug 10, 2012
  5. Junio C HamanoAug 9, 2012

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.