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

[PATCH] builtin-branch: be prepared for ref-logging

From
LHLars Hjemli <hjemli@gmail.com>
Date
Feb 3, 2007, 18:35 UTC
Message-ID
<11705277471962-git-send-email-hjemli@gmail.com>
In-Reply-To
<11705213662728-git-send-email-tutufan@gmail.com>

The test for reflog parameter to create_branch() should also have tested for log_all_ref_updates. But there is no good reason not to prepare a reflog message, so lets just do it.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
---

Sorry, the previous patch was obviously no good, since it didn't honour the case where (reflog==1 && log_all_ref_updates==0)

This one should be better.
 builtin-branch.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/builtin-branch.c b/builtin-branch.c
index d60690b..a8c8c98 100644
--- a/builtin-branch.c
+++ b/builtin-branch.c
@@ -342,12 +342,10 @@ static void create_branch(const char *name, const char *start_name,
 	if (!lock)
 		die("Failed to lock ref for update: %s.", strerror(errno));
 
-	if (reflog) {
+	if (reflog)
 		log_all_ref_updates = 1;
-		snprintf(msg, sizeof msg, "branch: Created from %s",
-			 start_name);
-	}
 
+	snprintf(msg, sizeof msg, "branch: Created from %s", start_name);
 	if (write_ref_sha1(lock, sha1, msg) < 0)
 		die("Failed to write ref: %s.", strerror(errno));
 }
-- 
1.5.0.rc2.ge4b0e
Previous: Junio C HamanoNext: Junio C Hamano
Message 5 of 11 in “fix use of sometimes uninitialized variable 'msg'”
  1. fix use of sometimes uninitialized variable 'msg'Michael Coleman, Feb 3, 2007
  2. fix uninitialized use of msg bufferMichael Coleman, Feb 3, 2007
  3. builtin-branch: be prepared for ref-loggingLars Hjemli, Feb 3, 2007
  4. Junio C HamanoFeb 3, 2007
  5. builtin-branch: be prepared for ref-loggingLars Hjemli, Feb 3, 2007
  6. Junio C HamanoFeb 3, 2007
  7. Lars HjemliFeb 3, 2007
  8. Junio C HamanoFeb 3, 2007
  9. Lars HjemliFeb 3, 2007
  10. Junio C HamanoFeb 3, 2007
  11. Mike ColemanFeb 3, 2007

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.