Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2019-04-06 14:34:25 +0300
committerJunio C Hamano <gitster@pobox.com>2019-04-08 11:26:32 +0300
commit546edf37ae427cf5fdb8c00d1820df73cd16eed6 (patch)
tree40292bbd4b01932ce43210ef820f5d1ab384048d /refs.c
parentb3cd33d0792768f3a45bed850fbc884fb499388d (diff)
refs.c: add refs_shorten_unambiguous_ref()
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 'refs.c')
-rw-r--r--refs.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/refs.c b/refs.c
index b869f32d8b..3dde824aab 100644
--- a/refs.c
+++ b/refs.c
@@ -1169,7 +1169,8 @@ int update_ref(const char *msg, const char *refname,
old_oid, flags, onerr);
}
-char *shorten_unambiguous_ref(const char *refname, int strict)
+char *refs_shorten_unambiguous_ref(struct ref_store *refs,
+ const char *refname, int strict)
{
int i;
static char **scanf_fmts;
@@ -1247,7 +1248,7 @@ char *shorten_unambiguous_ref(const char *refname, int strict)
strbuf_reset(&resolved_buf);
strbuf_addf(&resolved_buf, rule,
short_name_len, short_name);
- if (ref_exists(resolved_buf.buf))
+ if (refs_ref_exists(refs, resolved_buf.buf))
break;
}
@@ -1266,6 +1267,12 @@ char *shorten_unambiguous_ref(const char *refname, int strict)
return xstrdup(refname);
}
+char *shorten_unambiguous_ref(const char *refname, int strict)
+{
+ return refs_shorten_unambiguous_ref(get_main_ref_store(the_repository),
+ refname, strict);
+}
+
static struct string_list *hide_refs;
int parse_hide_refs_config(const char *var, const char *value, const char *section)