]> git.ipfire.org Git - thirdparty/git.git/commitdiff
refs: move dwim_ref() to header file
authorJonathan Tan <jonathantanmy@google.com>
Tue, 1 Sep 2020 22:28:08 +0000 (15:28 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 2 Sep 2020 21:39:17 +0000 (14:39 -0700)
This makes it clear that dwim_ref() is just repo_dwim_ref() without the
first parameter.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs.c
refs.h

diff --git a/refs.c b/refs.c
index 84c51a2ce4facf66bd50bdbd957dbd94c8fff31e..e107919b94305a9260b253d4bc70578f3e881b9b 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -623,11 +623,6 @@ int repo_dwim_ref(struct repository *r, const char *str, int len,
        return refs_found;
 }
 
-int dwim_ref(const char *str, int len, struct object_id *oid, char **ref)
-{
-       return repo_dwim_ref(the_repository, str, len, oid, ref);
-}
-
 int expand_ref(struct repository *repo, const char *str, int len,
               struct object_id *oid, char **ref)
 {
diff --git a/refs.h b/refs.h
index f212f8945e10a5a041a7f1c49a07f8f468589748..04a68540c33be812b04cc71b04b8ecb2c120bf63 100644 (file)
--- a/refs.h
+++ b/refs.h
@@ -1,6 +1,8 @@
 #ifndef REFS_H
 #define REFS_H
 
+#include "cache.h"
+
 struct object_id;
 struct ref_store;
 struct repository;
@@ -151,7 +153,11 @@ void expand_ref_prefix(struct argv_array *prefixes, const char *prefix);
 int expand_ref(struct repository *r, const char *str, int len, struct object_id *oid, char **ref);
 int repo_dwim_ref(struct repository *r, const char *str, int len, struct object_id *oid, char **ref);
 int repo_dwim_log(struct repository *r, const char *str, int len, struct object_id *oid, char **ref);
-int dwim_ref(const char *str, int len, struct object_id *oid, char **ref);
+static inline int dwim_ref(const char *str, int len, struct object_id *oid,
+                          char **ref)
+{
+       return repo_dwim_ref(the_repository, str, len, oid, ref);
+}
 int dwim_log(const char *str, int len, struct object_id *oid, char **ref);
 
 /*