{"thread":{"id":"6134","subject":"[PATCH 1/2] Teach git-reset to let others override its reflog entry.","startedAt":"2006-12-28T01:43:36Z","lastAt":"2006-12-28T11:52:38Z","messageCount":4,"participants":["Shawn O. Pearce","Junio C Hamano","Shawn Pearce","Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"30384","messageId":"20061228014336.GA16790@spearce.org","threadId":"6134","inReplyTo":null,"subject":"[PATCH 1/2] Teach git-reset to let others override its reflog entry.","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2006-12-28T01:43:36Z","receivedAt":"2006-12-28T01:43:36Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"When git-rebase invokes `git reset --hard` to rewind the user's\nbranch prior to starting to reapply each commit this is showing\nup in the reflog as a simple `git reset --hard <cmt>` but its not\nclear to the end-user inspecting the log why there is a reset.\n\nThe new --reflog-action for git-reset behaves like the same option\nto git-merge; it can be used by the caller to override the message\nentry in the reflog and is intended to be used only when git-reset\nis acting as plumbing, not porcelain.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n Documentation/git-reset.txt |    5 +++++\n git-rebase.sh               |    4 ++--\n git-reset.sh                |    8 ++++++--\n 3 files changed, 13 insertions(+), 4 deletions(-)\n\ndiff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt\nindex 4f42478..7eaa186 100644\n--- a/Documentation/git-reset.txt\n+++ b/Documentation/git-reset.txt\n@@ -45,6 +45,11 @@ OPTIONS\n \tswitched to. Any changes to tracked files in the working tree\n \tsince <commit> are lost.\n \n+--reflog-action=<action>::\n+\tThis is used internally when `git-rebase` calls this command\n+\tto reset the current branch prior to merging the rebased\n+\tcommits onto it.\n+\n <commit>::\n \tCommit to make the current HEAD.\n \ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex ece3142..b99f1e3 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -174,7 +174,7 @@ do\n \t\telse\n \t\t\tdie \"No rebase in progress?\"\n \t\tfi\n-\t\tgit reset --hard ORIG_HEAD\n+\t\tgit reset --reflog-action=\"rebase: abort\" --hard ORIG_HEAD\n \t\texit\n \t\t;;\n \t--onto)\n@@ -293,7 +293,7 @@ fi\n \n # Rewind the head to \"$onto\"; this saves our current head in ORIG_HEAD.\n echo \"First, rewinding head to replay your work on top of it...\"\n-git-reset --hard \"$onto\"\n+git-reset --hard --reflog-action=\"rebase: rewind to $onto_name\" \"$onto\"\n \n # If the $onto is a proper descendant of the tip of the branch, then\n # we just fast forwarded.\ndiff --git a/git-reset.sh b/git-reset.sh\nindex 2379db0..7ef6789 100755\n--- a/git-reset.sh\n+++ b/git-reset.sh\n@@ -6,7 +6,7 @@ USAGE='[--mixed | --soft | --hard]  [<commit-ish>] [ [--] <paths>...]'\n SUBDIRECTORY_OK=Yes\n . git-sh-setup\n \n-update= reset_type=--mixed\n+rloga= update= reset_type=--mixed\n unset rev\n \n while case $# in 0) break ;; esac\n@@ -15,6 +15,9 @@ do\n \t--mixed | --soft | --hard)\n \t\treset_type=\"$1\"\n \t\t;;\n+\t--reflog-action=*)\n+\t\trloga=`expr \"z$1\" : 'z-[^=]*=\\(.*\\)'`\n+\t\t;;\n \t--)\n \t\tbreak\n \t\t;;\n@@ -81,7 +84,8 @@ then\n else\n \trm -f \"$GIT_DIR/ORIG_HEAD\"\n fi\n-git-update-ref -m \"reset $reset_type $*\" HEAD \"$rev\"\n+test \"$rloga\" = '' && rloga=\"reset $reset_type $*\"\n+git-update-ref -m \"$rloga\" HEAD \"$rev\"\n update_ref_status=$?\n \n case \"$reset_type\" in\n-- \n1.4.4.3.gd2e4\n"},{"id":"30402","messageId":"7vslf0zgwp.fsf@assigned-by-dhcp.cox.net","threadId":"6134","inReplyTo":"20061228014336.GA16790@spearce.org","subject":"Re: [PATCH 1/2] Teach git-reset to let others override its reflog entry.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-12-28T06:13:58Z","receivedAt":"2006-12-28T06:13:58Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Shawn O. Pearce\" <spearce@spearce.org> writes:\n\n> The new --reflog-action for git-reset behaves like the same option\n> to git-merge; it can be used by the caller to override the message\n> entry in the reflog and is intended to be used only when git-reset\n> is acting as plumbing, not porcelain.\n\nHonestly, I hate these --reflog-action options everywhere.\n\nI wonder if something like this would be easier to manage in the\nlonger run:\n\n * In git-sh-setup.sh, have this shell function.\n\n\tset_reflog_action () {\n\t\tif test -z \"${GIT_REFLOG_ACTION+set}\"\n                then\n                \tGIT_REFLOG_ACTION=\"$*\"\n                        export GIT_REFLOG_ACTION\n\t\tfi\n\t}\n\n * Begin git-reset.sh with something like this:\n\n\t#!/bin/sh\n\n\t. git-sh-setup\n\tset_reflog_action \"reset $*\"\n\n * Update Porcelain-ish commands that use git-reset in the same\n   way.  For example, git-rebase could say:\n\n\t#!/bin/sh\n\n\t. git-sh-setup\n\tset_reflog_action \"rebase $*\"\n\nThen calls to \"git-update-ref -m\" could use the value of\n\"$GIT_REFLOG_ACTION\", without explicit --reflog-action=\nparameters and $rloga variables.\n\nHmm?\n"},{"id":"30403","messageId":"20061228062233.GA17304@spearce.org","threadId":"6134","inReplyTo":"7vslf0zgwp.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH 1/2] Teach git-reset to let others override its reflog entry.","fromName":"Shawn Pearce","fromEmail":"spearce@spearce.org","sentAt":"2006-12-28T06:22:34Z","receivedAt":"2006-12-28T06:22:34Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Junio C Hamano <junkio@cox.net> wrote:\n> \"Shawn O. Pearce\" <spearce@spearce.org> writes:\n> \n> > The new --reflog-action for git-reset behaves like the same option\n> > to git-merge; it can be used by the caller to override the message\n> > entry in the reflog and is intended to be used only when git-reset\n> > is acting as plumbing, not porcelain.\n> \n> Honestly, I hate these --reflog-action options everywhere.\n\nMe too.  Yet I submit patches to add them.  ;-)\n \n> Then calls to \"git-update-ref -m\" could use the value of\n> \"$GIT_REFLOG_ACTION\", without explicit --reflog-action=\n> parameters and $rloga variables.\n\nI agree.  Your suggestion is way more elegant.\n\nI have some more git-am/git-merge/git-pull/git-rebase patches\nbrewing; I'm finishing the commit message for the last in the\nsequence.  I'll update it to include your suggestion and try to\nstart cleaning up this --reflog-action mess, then ship the series\nout to the list, including this mini 2 patch series you are\nrejecting for good reason.\n\n-- \nShawn.\n"},{"id":"30437","messageId":"en0b0n$bjm$2@sea.gmane.org","threadId":"6134","inReplyTo":"7vslf0zgwp.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH 1/2] Teach git-reset to let others override its reflog entry.","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-12-28T11:52:38Z","receivedAt":"2006-12-28T11:52:38Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Junio C Hamano wrote:\n\n> Then calls to \"git-update-ref -m\" could use the value of\n> \"$GIT_REFLOG_ACTION\", without explicit --reflog-action=\n> parameters and $rloga variables.\n\nI think that --reflog-action should then be used to set GIT_REFLOG_ACTION,\nslightly similarly to how --git-dir sets GIT_DIR variable.\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"}]}