]> git.ipfire.org Git - thirdparty/git.git/commitdiff
refs: pass NULL to refs_resolve_ref_unsafe() if hash is not needed
authorRené Scharfe <l.s.r@web.de>
Sat, 23 Sep 2017 09:44:57 +0000 (11:44 +0200)
committerJunio C Hamano <gitster@pobox.com>
Sun, 24 Sep 2017 01:18:18 +0000 (10:18 +0900)
This allows us to get rid of two write-only variables, one of them
being a SHA1 buffer.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs/files-backend.c
worktree.c

index 32663a999ea030f76f400608ae1ed6dbaebbc20c..a3134d23ab11f177d0e5f482848cd9d7086f0b71 100644 (file)
@@ -1676,13 +1676,12 @@ static int commit_ref_update(struct files_ref_store *refs,
                 * check with HEAD only which should cover 99% of all usage
                 * scenarios (even 100% of the default ones).
                 */
-               struct object_id head_oid;
                int head_flag;
                const char *head_ref;
 
                head_ref = refs_resolve_ref_unsafe(&refs->base, "HEAD",
                                                   RESOLVE_REF_READING,
-                                                  head_oid.hash, &head_flag);
+                                                  NULL, &head_flag);
                if (head_ref && (head_flag & REF_ISSYMREF) &&
                    !strcmp(head_ref, lock->ref_name)) {
                        struct strbuf log_err = STRBUF_INIT;
index 8aaeea03771cfefa9edd019d0dc5146fef17a9c7..70015629dc69e4bdf7f8ef1973596f3360898da3 100644 (file)
@@ -307,7 +307,6 @@ const struct worktree *find_shared_symref(const char *symref,
        for (i = 0; worktrees[i]; i++) {
                struct worktree *wt = worktrees[i];
                const char *symref_target;
-               unsigned char sha1[20];
                struct ref_store *refs;
                int flags;
 
@@ -327,7 +326,7 @@ const struct worktree *find_shared_symref(const char *symref,
 
                refs = get_worktree_ref_store(wt);
                symref_target = refs_resolve_ref_unsafe(refs, symref, 0,
-                                                       sha1, &flags);
+                                                       NULL, &flags);
                if ((flags & REF_ISSYMREF) && !strcmp(symref_target, target)) {
                        existing = wt;
                        break;