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

Re: [PATCH 3/3] rename_ref: replace empty deletion message in HEAD's log

From
Jeff King <peff@peff.net>
Date
Feb 17, 2017, 08:31 UTC
Message-ID
<20170217083112.vn7m4udsopmlvnn5@sigill.intra.peff.net>
In-Reply-To
<20170217035800.13214-4-kyle@kyleam.com>
On Thu, Feb 16, 2017 at 10:58:00PM -0500, Kyle Meyer wrote:
Show 6 quoted lines
> 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:

Show 6 quoted lines
> @@ -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.

-Peff
Previous: Kyle MeyerNext: Junio C Hamano
Message 16 of 36 in “HEAD's reflog entry for a renamed branch”
  1. Kyle MeyerJan 16, 2017
  2. Jeff KingJan 26, 2017
  3. Junio C HamanoJan 26, 2017
  4. Jeff KingJan 26, 2017
  5. 0/3 delete_ref(): support reflog messagesKyle Meyer, Feb 17, 2017
  6. 1/3 delete_refs(): accept a reflog message argumentKyle Meyer, Feb 17, 2017
  7. Jeff KingFeb 17, 2017
  8. Junio C HamanoFeb 17, 2017
  9. Kyle MeyerFeb 17, 2017
  10. 2/3 update-ref: pass reflog message argument to delete_refsKyle Meyer, Feb 17, 2017
  11. Jeff KingFeb 17, 2017
  12. Junio C HamanoFeb 17, 2017
  13. Kyle MeyerFeb 17, 2017
  14. Jeff KingFeb 17, 2017
  15. 3/3 rename_ref: replace empty deletion message in HEAD's logKyle Meyer, Feb 17, 2017
  16. Jeff KingFeb 17, 2017
  17. Junio C HamanoFeb 17, 2017
  18. Jeff KingFeb 17, 2017
  19. Jeff KingFeb 17, 2017
  20. Junio C HamanoFeb 17, 2017
  21. Kyle MeyerFeb 17, 2017
  22. Kyle MeyerFeb 17, 2017
  23. Jeff KingFeb 17, 2017
  24. Junio C HamanoFeb 17, 2017
  25. Jeff KingFeb 17, 2017
  26. 0/4 delete_ref: support reflog messagesKyle Meyer, Feb 21, 2017
  27. 1/4 delete_ref: accept a reflog message argumentKyle Meyer, Feb 21, 2017
  28. Duy NguyenFeb 23, 2017
  29. Junio C HamanoFeb 23, 2017
  30. Kyle MeyerFeb 25, 2017
  31. 2/4 update-ref: pass reflog message to delete_ref()Kyle Meyer, Feb 21, 2017
  32. 4/4 branch: record creation of renamed branch in HEAD's logKyle Meyer, Feb 21, 2017
  33. 3/4 rename_ref: replace empty message in HEAD's logKyle Meyer, Feb 21, 2017
  34. Jeff KingFeb 21, 2017
  35. Junio C HamanoFeb 21, 2017
  36. Kyle MeyerFeb 21, 2017

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.