summaryrefslogtreecommitdiff
path: root/bundle.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2011-11-13 10:22:14 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-11-13 20:21:06 (GMT)
commitc6893323917cbf4cb66c29ba2ac03014a44f0f0c (patch)
treecc14f88d5ebfd114e5c80f74506eff6c9a5fa68b /bundle.c
parentbc1bbe0c19a6ff39522b4fa3259f34150e308e1f (diff)
downloadgit-c6893323917cbf4cb66c29ba2ac03014a44f0f0c.zip
git-c6893323917cbf4cb66c29ba2ac03014a44f0f0c.tar.gz
git-c6893323917cbf4cb66c29ba2ac03014a44f0f0c.tar.bz2
Convert many resolve_ref() calls to read_ref*() and ref_exists()
resolve_ref() may return a pointer to a static buffer, which is not safe for long-term use because if another resolve_ref() call happens, the buffer may be changed. Many call sites though do not care about this buffer. They simply check if the return value is NULL or not. Convert all these call sites to new wrappers to reduce resolve_ref() calls from 57 to 34. If we change resolve_ref() prototype later on to avoid passing static buffer out, this helps reduce changes. 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 'bundle.c')
-rw-r--r--bundle.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/bundle.c b/bundle.c
index 08020bc..4742f27 100644
--- a/bundle.c
+++ b/bundle.c
@@ -320,7 +320,7 @@ int create_bundle(struct bundle_header *header, const char *path,
continue;
if (dwim_ref(e->name, strlen(e->name), sha1, &ref) != 1)
continue;
- if (!resolve_ref(e->name, sha1, 1, &flag))
+ if (read_ref_full(e->name, sha1, 1, &flag))
flag = 0;
display_ref = (flag & REF_ISSYMREF) ? e->name : ref;