public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Jeff King <peff@peff•net>
Cc: Kyle Meyer <kyle@kyleam•com>, git@vger•kernel.org
Subject: Re: [PATCH 3/3] rename_ref: replace empty deletion message in HEAD's log
Date: Fri, 17 Feb 2017 09:50:54 -0800	[thread overview]
Message-ID: <xmqqk28ou2o1.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20170217083112.vn7m4udsopmlvnn5@sigill.intra.peff.net> (Jeff King's message of "Fri, 17 Feb 2017 03:31:12 -0500")

Jeff King <peff@peff•net> writes:

> On Thu, Feb 16, 2017 at 10:58:00PM -0500, Kyle Meyer wrote:
>
>> When the current branch is renamed, the deletion of the old ref is
>> recorded in HEAD's log with an empty message.  Now that delete_refs()
>> accepts a reflog message, provide a more descriptive message.  This
>> message will not be included in the reflog of the renamed branch, but
>> its log already covers the renaming event with a message of "Branch:
>> renamed ...".
>
> Right, makes sense. The code overall looks fine, though I have one
> nit:
>
>> @@ -2616,10 +2617,15 @@ static int files_rename_ref(struct ref_store *ref_store,
>>  		return error("unable to move logfile logs/%s to "TMP_RENAMED_LOG": %s",
>>  			oldrefname, strerror(errno));
>>  
>> -	if (delete_ref(oldrefname, orig_sha1, REF_NODEREF, NULL)) {
>> +	strbuf_addf(&logmsg_del, "Deleted %s", oldrefname);
>
> We've been anything but consistent with our reflog messages in the past,
> but I think the general guideline for new ones is to use "command:
> action". Of course we don't _know_ the action here, because we're deep
> in rename_ref().
>
> Should we have the caller pass it in for us, as we do with delete_ref()
> and update_ref()?
>
> I see we actually already have a "logmsg" parameter. It already says
> "Branch: renamed %s to %s". Could we just reuse that? I know that this
> step is technically just the deletion, but I think it more accurately
> describes the whole operation that the deletion is part of.

True, but stepping back a bit,...

Do we even want these "internal" delete_ref() invocations to be
logged in HEAD's reflog?  I understand that this is inside the
implementation of renaming an old ref to a new ref, and reflog
message given to delete_ref() would matter only if the HEAD happens
to be pointing at old ref---but then HEAD will be repointed to the
new ref by somebody else [*1*] that called this function to rename
old to new and it _will_ log it.  So I am not sure if it is a good
thing to describe the deletion more readably with a message (which
is what this patch does) in the first place.  If we can just say
"don't log this deletion event in HEAD's reflog", wouldn't that be
more desirable?


[Footnote]

*1* Is the reason why the code in files_rename_ref() we are looking
    at does not adjust HEAD to point at the new ref is because it is
    just handing one ref-store and obviouvious to symrefs in other
    backends?

  reply	other threads:[~2017-02-17 18:16 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-16 23:17 HEAD's reflog entry for a renamed branch Kyle Meyer
2017-01-26 21:12 ` Jeff King
2017-01-26 21:30   ` Junio C Hamano
2017-01-26 21:53     ` Jeff King
2017-02-17  3:57   ` [PATCH 0/3] delete_ref(): support reflog messages Kyle Meyer
2017-02-17  3:57     ` [PATCH 1/3] delete_refs(): accept a reflog message argument Kyle Meyer
2017-02-17  8:12       ` Jeff King
2017-02-17 17:05         ` Junio C Hamano
2017-02-17 23:35           ` Kyle Meyer
2017-02-17  3:57     ` [PATCH 2/3] update-ref: pass reflog message argument to delete_refs Kyle Meyer
2017-02-17  8:22       ` Jeff King
2017-02-17 17:11         ` Junio C Hamano
2017-02-17 23:40         ` Kyle Meyer
2017-02-17 23:41           ` Jeff King
2017-02-17  3:58     ` [PATCH 3/3] rename_ref: replace empty deletion message in HEAD's log Kyle Meyer
2017-02-17  8:31       ` Jeff King
2017-02-17 17:50         ` Junio C Hamano [this message]
2017-02-17 19:43           ` Jeff King
2017-02-17 19:55             ` Jeff King
2017-02-17 22:18               ` Junio C Hamano
2017-02-17 23:42               ` Kyle Meyer
2017-02-17 23:41           ` Kyle Meyer
2017-02-17 23:53             ` Junio C Hamano
2017-02-17 23:53             ` Jeff King
2017-02-17  8:17     ` [PATCH 0/3] delete_ref(): support reflog messages Jeff King
2017-02-21  1:10     ` [PATCH v2 0/4] delete_ref: " Kyle Meyer
2017-02-21  1:10       ` [PATCH v2 1/4] delete_ref: accept a reflog message argument Kyle Meyer
2017-02-23  9:33         ` Duy Nguyen
2017-02-23 22:29           ` Junio C Hamano
2017-02-25  3:05           ` Kyle Meyer
2017-02-21  1:10       ` [PATCH v2 2/4] update-ref: pass reflog message to delete_ref() Kyle Meyer
2017-02-21  1:10       ` [PATCH v2 3/4] rename_ref: replace empty message in HEAD's log Kyle Meyer
2017-02-21  1:10       ` [PATCH v2 4/4] branch: record creation of renamed branch " Kyle Meyer
2017-02-21  7:12       ` [PATCH v2 0/4] delete_ref: support reflog messages Jeff King
2017-02-21  7:18       ` Junio C Hamano
2017-02-21 16:45         ` Kyle Meyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqk28ou2o1.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=kyle@kyleam$(echo .)com \
    --cc=peff@peff$(echo .)net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox