aboutsummaryrefslogtreecommitdiff
path: root/builtin/remote.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2011-12-12 18:20:32 +0700
committerJunio C Hamano <gitster@pobox.com>2011-12-13 09:39:46 -0800
commit8cad4744ee37ebec1d9491a1381ec1771a1ba795 (patch)
tree064bbe938f38727dd163aae9c95e2185b8075234 /builtin/remote.c
parent96ec7b1e708863d0cd6b8e72a986d6f0a1bb64db (diff)
downloadgit-8cad4744ee37ebec1d9491a1381ec1771a1ba795.tar.gz
git-8cad4744ee37ebec1d9491a1381ec1771a1ba795.tar.xz
Rename resolve_ref() to resolve_ref_unsafe()
resolve_ref() may return a pointer to a shared buffer and can be overwritten by the next resolve_ref() calls. Callers need to pay attention, not to keep the pointer when the next call happens. Rename with "_unsafe" suffix to warn developers (or reviewers) before introducing new call sites. This patch is generated using the following command git grep -l 'resolve_ref(' -- '*.[ch]'|xargs sed -i 's/resolve_ref(/resolve_ref_unsafe(/g' Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/remote.c')
-rw-r--r--builtin/remote.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/remote.c b/builtin/remote.c
index 407abfb0f..583eec90e 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -573,7 +573,7 @@ static int read_remote_branches(const char *refname,
strbuf_addf(&buf, "refs/remotes/%s/", rename->old);
if (!prefixcmp(refname, buf.buf)) {
item = string_list_append(rename->remote_branches, xstrdup(refname));
- symref = resolve_ref(refname, orig_sha1, 1, &flag);
+ symref = resolve_ref_unsafe(refname, orig_sha1, 1, &flag);
if (flag & REF_ISSYMREF)
item->util = xstrdup(symref);
else