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

[PATCH 3/4] checkout: add '\n' to reflog message

From
Han-Wen Nienhuys via GitGitGadget <gitgitgadget@gmail.com>
Date
Jun 30, 2020, 12:05 UTC
Message-ID
<8a62cc26686b1bb2f04cb01c79e336dca397a330.1593518738.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.669.git.1593518738.gitgitgadget@gmail.com>
From: Han-Wen Nienhuys <hanwen@google.com>

This makes check consistent with the rest of the git code, which tends to use a trailing '\n' when writing reflog messages. (The storage layer adds a '\n' when it is missing.)

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
---
 builtin/checkout.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/builtin/checkout.c b/builtin/checkout.c
index af849c644f..bb11fcc4e9 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -884,8 +884,9 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
 
 	reflog_msg = getenv("GIT_REFLOG_ACTION");
 	if (!reflog_msg)
-		strbuf_addf(&msg, "checkout: moving from %s to %s",
-			old_desc ? old_desc : "(invalid)", new_branch_info->name);
+		strbuf_addf(&msg, "checkout: moving from %s to %s\n",
+			    old_desc ? old_desc : "(invalid)",
+			    new_branch_info->name);
 	else
 		strbuf_insertstr(&msg, 0, reflog_msg);
 
-- 
gitgitgadget
Previous: Han-Wen Nienhuys via GitGitGadgetNext: Han-Wen Nienhuys via GitGitGadget
Message 4 of 13 in “Preliminary fixes for reftable support”
  1. 0/4 Preliminary fixes for reftable supportHan-Wen Nienhuys via GitGitGadget, Jun 30, 2020
  2. 1/4 lib-t6000.sh: write tag using git-update-refHan-Wen Nienhuys via GitGitGadget, Jun 30, 2020
  3. 2/4 t3432: use git-reflog to inspect the reflog for HEADHan-Wen Nienhuys via GitGitGadget, Jun 30, 2020
  4. 3/4 checkout: add '\n' to reflog messageHan-Wen Nienhuys via GitGitGadget, Jun 30, 2020
  5. 4/4 Treat BISECT_HEAD as a pseudo refHan-Wen Nienhuys via GitGitGadget, Jun 30, 2020
  6. Junio C HamanoJul 7, 2020
  7. 0/4 Preliminary fixes for reftable supportHan-Wen Nienhuys via GitGitGadget, Jul 10, 2020
  8. 1/4 lib-t6000.sh: write tag using git-update-refHan-Wen Nienhuys via GitGitGadget, Jul 10, 2020
  9. 3/4 Treat BISECT_HEAD as a pseudo refHan-Wen Nienhuys via GitGitGadget, Jul 10, 2020
  10. 2/4 t3432: use git-reflog to inspect the reflog for HEADHan-Wen Nienhuys via GitGitGadget, Jul 10, 2020
  11. 4/4 Cleanse reflog messages in the refs.c layerJunio C Hamano via GitGitGadget, Jul 10, 2020
  12. Junio C HamanoJul 10, 2020
  13. Junio C HamanoJul 10, 2020

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.