From f94741324e26af42093a89e955ff9a923abff951 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Thu, 28 Dec 2006 02:34:48 -0500 Subject: Use GIT_REFLOG_ACTION environment variable instead. Junio rightly pointed out that the --reflog-action parameter was starting to get out of control, as most porcelain code needed to hand it to other porcelain and plumbing alike to ensure the reflog contained the top-level user action and not the lower-level actions it invoked. At Junio's suggestion we are introducing the new set_reflog_action function to all shell scripts, allowing them to declare early on what their default reflog name should be, but this setting only takes effect if the caller has not already set the GIT_REFLOG_ACTION environment variable. Signed-off-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- git-fetch.sh | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'git-fetch.sh') diff --git a/git-fetch.sh b/git-fetch.sh index ffbd44f0e..7fb47f69f 100755 --- a/git-fetch.sh +++ b/git-fetch.sh @@ -4,6 +4,8 @@ USAGE=' ...' SUBDIRECTORY_OK=Yes . git-sh-setup +set_reflog_action "fetch $*" + TOP=$(git-rev-parse --show-cdup) if test ! -z "$TOP" then @@ -17,7 +19,6 @@ LF=' ' IFS="$LF" -rloga=fetch no_tags= tags= append= @@ -59,9 +60,6 @@ do -k|--k|--ke|--kee|--keep) keep='-k -k' ;; - --reflog-action=*) - rloga=`expr "z$1" : 'z-[^=]*=\(.*\)'` - ;; -*) usage ;; @@ -86,9 +84,6 @@ refs= rref= rsync_slurped_objects= -rloga="$rloga $remote_nick" -test "$remote_nick" = "$remote" || rloga="$rloga $remote" - if test "" = "$append" then : >"$GIT_DIR/FETCH_HEAD" @@ -172,12 +167,12 @@ update_local_ref () { else echo >&2 "* $1: updating with $3" echo >&2 " $label_: $newshort_" - git-update-ref -m "$rloga: updating tag" "$1" "$2" + git-update-ref -m "$GIT_REFLOG_ACTION: updating tag" "$1" "$2" fi else echo >&2 "* $1: storing $3" echo >&2 " $label_: $newshort_" - git-update-ref -m "$rloga: storing tag" "$1" "$2" + git-update-ref -m "$GIT_REFLOG_ACTION: storing tag" "$1" "$2" fi ;; @@ -200,7 +195,7 @@ update_local_ref () { *,$local) echo >&2 "* $1: fast forward to $3" echo >&2 " old..new: $oldshort_..$newshort_" - git-update-ref -m "$rloga: fast-forward" "$1" "$2" "$local" + git-update-ref -m "$GIT_REFLOG_ACTION: fast-forward" "$1" "$2" "$local" ;; *) false @@ -210,7 +205,7 @@ update_local_ref () { *,t,*) echo >&2 "* $1: forcing update to non-fast forward $3" echo >&2 " old...new: $oldshort_...$newshort_" - git-update-ref -m "$rloga: forced-update" "$1" "$2" "$local" + git-update-ref -m "$GIT_REFLOG_ACTION: forced-update" "$1" "$2" "$local" ;; *) echo >&2 "* $1: not updating to non-fast forward $3" @@ -222,7 +217,7 @@ update_local_ref () { else echo >&2 "* $1: storing $3" echo >&2 " $label_: $newshort_" - git-update-ref -m "$rloga: storing head" "$1" "$2" + git-update-ref -m "$GIT_REFLOG_ACTION: storing head" "$1" "$2" fi ;; esac @@ -465,7 +460,7 @@ case "$orig_head" in if test "$curr_head" != "$orig_head" then git-update-ref \ - -m "$rloga: Undoing incorrectly fetched HEAD." \ + -m "$GIT_REFLOG_ACTION: Undoing incorrectly fetched HEAD." \ HEAD "$orig_head" die "Cannot fetch into the current branch." fi -- cgit v1.2.1