threads / patch / 6448

patchhonor GIT_REFLOG_ACTION in git-commit

Subject: [PATCH] honor GIT_REFLOG_ACTION in git-commit

## tl;dr

3 messages between Jan 20, 2007 and Jan 20, 2007. Diffs are folded; open one to read it.

replies: 2people: 2as markdown or json

Junio C Hamano· Jan 20, 2007, 01:12 UTC · lore

This allows git-cherry-pick and git-revert to properly identify themselves in the resulting reflog entries. Earlier they were recorded as what git-commit has done.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
Show changes to 2 files +4 −1

git-commit.sh, git-revert.sh

diff --git a/git-commit.sh b/git-commit.sh
index e23918c..eb211e5 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -524,6 +524,7 @@ else
 	rloga='commit (initial)'
 	current=''
 fi
+set_reflog_action "$rloga"
 
 if test -z "$no_edit"
 then
@@ -598,7 +599,7 @@ then
 	fi &&
 	commit=$(cat "$GIT_DIR"/COMMIT_MSG | git-commit-tree $tree $PARENTS) &&
 	rlogm=$(sed -e 1q "$GIT_DIR"/COMMIT_MSG) &&
-	git-update-ref -m "$rloga: $rlogm" HEAD $commit "$current" &&
+	git-update-ref -m "$GIT_REFLOG_ACTION: $rlogm" HEAD $commit "$current" &&
 	rm -f -- "$GIT_DIR/MERGE_HEAD" "$GIT_DIR/MERGE_MSG" &&
 	if test -f "$NEXT_INDEX"
 	then
diff --git a/git-revert.sh b/git-revert.sh
index bb8f1ca..8207c9e 100755
--- a/git-revert.sh
+++ b/git-revert.sh
@@ -54,6 +54,8 @@ do
 	shift
 done
 
+set_reflog_action "$me"
+
 test "$me,$replay" = "revert,t" && usage
 
 case "$no_commit" in
Shawn O. Pearce· Jan 20, 2007, 02:15 UTC · re: Junio C Hamano · lore

Re: [PATCH] honor GIT_REFLOG_ACTION in git-commit

Junio C Hamano <junkio@cox.net> wrote:
> This allows git-cherry-pick and git-revert to properly identify
> themselves in the resulting reflog entries.  Earlier they were
> recorded as what git-commit has done.

Not sure how I missed that one when I introduced GIT_REFLOG_ACTION, but thanks for finding and fixing it. :-)

-- 
Shawn.
Junio C Hamano· Jan 20, 2007, 02:22 UTC · re: Shawn O. Pearce · lore

Re: [PATCH] honor GIT_REFLOG_ACTION in git-commit

"Shawn O. Pearce" <spearce@spearce.org> writes:
Show 7 quoted lines
> Junio C Hamano <junkio@cox.net> wrote:
>> This allows git-cherry-pick and git-revert to properly identify
>> themselves in the resulting reflog entries.  Earlier they were
>> recorded as what git-commit has done.
>
> Not sure how I missed that one when I introduced GIT_REFLOG_ACTION,
> but thanks for finding and fixing it.  :-)

The fact that it went unnoticed for this long time shows how we lack proper tools to read the message part of the reflog, although we use @{N} and @{ago} notation every day and some people might even rely on it. I'd like to do something about it, and my earlier "show-branch --reflog" enhancement series (I'll park that in 'next' for now) was my attempt for that goal.

I found this out by accident while working on it.

← back to recent threads