From c6893323917cbf4cb66c29ba2ac03014a44f0f0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Sun, 13 Nov 2011 17:22:14 +0700 Subject: Convert many resolve_ref() calls to read_ref*() and ref_exists() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Junio C Hamano --- notes-merge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'notes-merge.c') diff --git a/notes-merge.c b/notes-merge.c index e9e4199311..e33c2c9f16 100644 --- a/notes-merge.c +++ b/notes-merge.c @@ -568,7 +568,7 @@ int notes_merge(struct notes_merge_options *o, o->local_ref, o->remote_ref); /* Dereference o->local_ref into local_sha1 */ - if (!resolve_ref(o->local_ref, local_sha1, 0, NULL)) + if (read_ref_full(o->local_ref, local_sha1, 0, NULL)) die("Failed to resolve local notes ref '%s'", o->local_ref); else if (!check_refname_format(o->local_ref, 0) && is_null_sha1(local_sha1)) -- cgit v1.2.3