All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lars Hjemli <hjemli@gmail.com>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: [PATCH] Fix bad usage of mkpath in builtin-branch.sh
Date: Tue, 24 Oct 2006 03:59:36 +0200
Date: Tue, 24 Oct 2006 03:55:02 +0200	[thread overview]
Message-ID: <1161655176461-git-send-email-hjemli@gmail.com> (raw)

When checking if a branch start point referred to a commit-object,
the result of mkpath() was used as argument to get_sha1(), which
didn't work out as planned.

Now it's xstrdup'd first.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
---
 builtin-branch.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/builtin-branch.c b/builtin-branch.c
index ffc2db0..f86bf68 100755
--- a/builtin-branch.c
+++ b/builtin-branch.c
@@ -125,6 +125,7 @@ static void create_branch(const char *na
 	struct ref_lock *lock;
 	unsigned char sha1[20];
 	char ref[PATH_MAX], msg[PATH_MAX + 20];
+	const char *commitref;
 
 	snprintf(ref, sizeof ref, "refs/heads/%s", name);
 	if (check_ref_format(ref))
@@ -137,8 +138,10 @@ static void create_branch(const char *na
 			die("Cannot force update the current branch.");
 	}
 
-	if (get_sha1(mkpath("%s^0", start), sha1))
+	commitref = xstrdup(mkpath("%s^0", start));
+	if (get_sha1(commitref, sha1))
 		die("Not a valid branch point: '%s'.", start);
+	free(commitref);
 
 	lock = lock_any_ref_for_update(ref, NULL);
 	if (!lock)
-- 
1.4.3.1.ga4cc-dirty

             reply	other threads:[~2006-10-24  1:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-24  1:59 Lars Hjemli [this message]
2006-10-24  6:46 ` [PATCH] Fix bad usage of mkpath in builtin-branch.sh Junio C Hamano
2006-10-24 11:38   ` Petr Baudis
2006-10-25  4:00     ` Junio C Hamano
2006-10-25  4:46       ` Junio C Hamano
2006-10-25 22:43         ` Petr Baudis
2006-10-25 22:51           ` Junio C Hamano

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=1161655176461-git-send-email-hjemli@gmail.com \
    --to=hjemli@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.