Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
register_ref(): make a copy of the bad reference SHA-1
author
Michael Haggerty
<mhagger@alum.mit.edu>
Sat, 25 May 2013 09:08:23 +0000
(11:08 +0200)
committer
Junio C Hamano
<gitster@pobox.com>
Sun, 2 Jun 2013 22:28:47 +0000
(15:28 -0700)
The lifetime of the sha1 parameter passed to an each_ref_fn callback
is not guaranteed, so make a copy for later use.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
bisect.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
66ce036
)
diff --git
a/bisect.c
b/bisect.c
index 374d9e24bd0a18b0453f3e948db93251a859ba18..71c19581daccffc87e5128c61d9adfae0be3e7de 100644
(file)
--- a/
bisect.c
+++ b/
bisect.c
@@
-15,7
+15,7
@@
static struct sha1_array good_revs;
static struct sha1_array skipped_revs;
static struct sha1_array good_revs;
static struct sha1_array skipped_revs;
-static
const
unsigned char *current_bad_sha1;
+static unsigned char *current_bad_sha1;
static const char *argv_checkout[] = {"checkout", "-q", NULL, "--", NULL};
static const char *argv_show_branch[] = {"show-branch", NULL, NULL};
static const char *argv_checkout[] = {"checkout", "-q", NULL, "--", NULL};
static const char *argv_show_branch[] = {"show-branch", NULL, NULL};
@@
-404,7
+404,8
@@
static int register_ref(const char *refname, const unsigned char *sha1,
int flags, void *cb_data)
{
if (!strcmp(refname, "bad")) {
int flags, void *cb_data)
{
if (!strcmp(refname, "bad")) {
- current_bad_sha1 = sha1;
+ current_bad_sha1 = xmalloc(20);
+ hashcpy(current_bad_sha1, sha1);
} else if (!prefixcmp(refname, "good-")) {
sha1_array_append(&good_revs, sha1);
} else if (!prefixcmp(refname, "skip-")) {
} else if (!prefixcmp(refname, "good-")) {
sha1_array_append(&good_revs, sha1);
} else if (!prefixcmp(refname, "skip-")) {