diff options
| author | Junio C Hamano <gitster@pobox.com> | 2017-09-28 14:47:56 +0900 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2017-09-28 14:47:56 +0900 |
| commit | 73ecdc606eedbfd98ec66d50d44b3374425fd13b (patch) | |
| tree | 6a2aeb6eb0b30e1645c8af06b10c9f4ec2815dd8 /remote.c | |
| parent | 2812ca7f0e11f6a46c8b1b5b4450df20412c22be (diff) | |
| parent | 744c040b19412fa5075810eb1aced105fad96726 (diff) | |
| download | git-73ecdc606eedbfd98ec66d50d44b3374425fd13b.tar.xz | |
Merge branch 'rs/resolve-ref-optional-result'
Code clean-up.
* rs/resolve-ref-optional-result:
refs: pass NULL to resolve_ref_unsafe() if hash is not needed
refs: pass NULL to refs_resolve_ref_unsafe() if hash is not needed
refs: make sha1 output parameter of refs_resolve_ref_unsafe() optional
Diffstat (limited to 'remote.c')
| -rw-r--r-- | remote.c | 12 |
1 files changed, 4 insertions, 8 deletions
@@ -466,7 +466,6 @@ static void alias_all_urls(void) static void read_config(void) { static int loaded; - struct object_id oid; int flag; if (loaded) @@ -475,7 +474,7 @@ static void read_config(void) current_branch = NULL; if (startup_info->have_repository) { - const char *head_ref = resolve_ref_unsafe("HEAD", 0, oid.hash, &flag); + const char *head_ref = resolve_ref_unsafe("HEAD", 0, NULL, &flag); if (head_ref && (flag & REF_ISSYMREF) && skip_prefix(head_ref, "refs/heads/", &head_ref)) { current_branch = make_branch(head_ref, 0); @@ -1105,10 +1104,9 @@ static struct ref *make_linked_ref(const char *name, struct ref ***tail) static char *guess_ref(const char *name, struct ref *peer) { struct strbuf buf = STRBUF_INIT; - struct object_id oid; const char *r = resolve_ref_unsafe(peer->name, RESOLVE_REF_READING, - oid.hash, NULL); + NULL, NULL); if (!r) return NULL; @@ -1166,12 +1164,11 @@ static int match_explicit(struct ref *src, struct ref *dst, return -1; if (!dst_value) { - struct object_id oid; int flag; dst_value = resolve_ref_unsafe(matched_src->name, RESOLVE_REF_READING, - oid.hash, &flag); + NULL, &flag); if (!dst_value || ((flag & REF_ISSYMREF) && !starts_with(dst_value, "refs/heads/"))) @@ -1792,10 +1789,9 @@ const char *branch_get_push(struct branch *branch, struct strbuf *err) static int ignore_symref_update(const char *refname) { - struct object_id oid; int flag; - if (!resolve_ref_unsafe(refname, 0, oid.hash, &flag)) + if (!resolve_ref_unsafe(refname, 0, NULL, &flag)) return 0; /* non-existing refs are OK */ return (flag & REF_ISSYMREF); } |
