git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lars Hjemli <hjemli@gmail.com>
To: Michael Coleman <tutufan@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <junkio@cox.net>
Subject: [PATCH] builtin-branch: be prepared for ref-logging
Date: Sat,  3 Feb 2007 19:35:47 +0100	[thread overview]
Message-ID: <11705277471962-git-send-email-hjemli@gmail.com> (raw)
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

  parent reply	other threads:[~2007-02-03 18:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-03 16:49 [PATCH] fix use of sometimes uninitialized variable 'msg' Michael Coleman
2007-02-03 16:49 ` [PATCH] fix uninitialized use of msg buffer Michael Coleman
2007-02-03 18:17   ` [PATCH] builtin-branch: be prepared for ref-logging Lars Hjemli
2007-02-03 18:55     ` Junio C Hamano
2007-02-03 18:35   ` Lars Hjemli [this message]
2007-02-03 19:50     ` Junio C Hamano
2007-02-03 20:38       ` Lars Hjemli
2007-02-03 20:54         ` Junio C Hamano
2007-02-03 21:20           ` Lars Hjemli
2007-02-03 23:21         ` Junio C Hamano
2007-02-03 17:05 ` [PATCH] fix use of sometimes uninitialized variable 'msg' Mike Coleman

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=11705277471962-git-send-email-hjemli@gmail.com \
    --to=hjemli@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    --cc=tutufan@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).