sha1-name.c: remove the_repo from other get_oid_*
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Tue, 16 Apr 2019 09:33:40 +0000 (16:33 +0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 16 Apr 2019 09:56:53 +0000 (18:56 +0900)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
cache.h
sha1-name.c
diff --git a/cache.h b/cache.h
index 3718b3db8a8c74cb6c4aad6ff6aaf81a7da792f6..871a167bf8a952c1712e33ab0bd7423eee1b62fd 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -1381,12 +1381,11 @@ enum get_oid_result {
 };
 
 int repo_get_oid(struct repository *r, const char *str, struct object_id *oid);
-#define get_oid(str, oid) repo_get_oid(the_repository, str, oid)
-extern int get_oid_commit(const char *str, struct object_id *oid);
-extern int get_oid_committish(const char *str, struct object_id *oid);
-extern int get_oid_tree(const char *str, struct object_id *oid);
-extern int get_oid_treeish(const char *str, struct object_id *oid);
-extern int get_oid_blob(const char *str, struct object_id *oid);
+int repo_get_oid_commit(struct repository *r, const char *str, struct object_id *oid);
+int repo_get_oid_committish(struct repository *r, const char *str, struct object_id *oid);
+int repo_get_oid_tree(struct repository *r, const char *str, struct object_id *oid);
+int repo_get_oid_treeish(struct repository *r, const char *str, struct object_id *oid);
+int repo_get_oid_blob(struct repository *r, const char *str, struct object_id *oid);
 void maybe_die_on_misspelt_object_name(struct repository *repo,
                                       const char *name,
                                       const char *prefix);
@@ -1394,6 +1393,13 @@ extern enum get_oid_result get_oid_with_context(struct repository *repo, const c
                                unsigned flags, struct object_id *oid,
                                struct object_context *oc);
 
+#define get_oid(str, oid)              repo_get_oid(the_repository, str, oid)
+#define get_oid_commit(str, oid)       repo_get_oid_commit(the_repository, str, oid)
+#define get_oid_committish(str, oid)   repo_get_oid_committish(the_repository, str, oid)
+#define get_oid_tree(str, oid)         repo_get_oid_tree(the_repository, str, oid)
+#define get_oid_treeish(str, oid)      repo_get_oid_treeish(the_repository, str, oid)
+#define get_oid_blob(str, oid)         repo_get_oid_blob(the_repository, str, oid)
+
 typedef int each_abbrev_fn(const struct object_id *oid, void *);
 int repo_for_each_abbrev(struct repository *r, const char *prefix, each_abbrev_fn, void *);
 #define for_each_abbrev(prefix, fn, data) repo_for_each_abbrev(the_repository, prefix, fn, data)
index b94d381befb3810aed89910c00382c95b9267af8..d49496397d922aa1c1ae8b59c451a0b1b0e1a661 100644 (file)
@@ -1590,43 +1590,48 @@ int repo_get_oid(struct repository *r, const char *name, struct object_id *oid)
  * commit-ish. It is merely to give a hint to the disambiguation
  * machinery.
  */
-int get_oid_committish(const char *name, struct object_id *oid)
+int repo_get_oid_committish(struct repository *r,
+                           const char *name,
+                           struct object_id *oid)
 {
        struct object_context unused;
-       return get_oid_with_context(the_repository,
-                                   name, GET_OID_COMMITTISH,
+       return get_oid_with_context(r, name, GET_OID_COMMITTISH,
                                    oid, &unused);
 }
 
-int get_oid_treeish(const char *name, struct object_id *oid)
+int repo_get_oid_treeish(struct repository *r,
+                        const char *name,
+                        struct object_id *oid)
 {
        struct object_context unused;
-       return get_oid_with_context(the_repository,
-                                   name, GET_OID_TREEISH,
+       return get_oid_with_context(r, name, GET_OID_TREEISH,
                                    oid, &unused);
 }
 
-int get_oid_commit(const char *name, struct object_id *oid)
+int repo_get_oid_commit(struct repository *r,
+                       const char *name,
+                       struct object_id *oid)
 {
        struct object_context unused;
-       return get_oid_with_context(the_repository,
-                                   name, GET_OID_COMMIT,
+       return get_oid_with_context(r, name, GET_OID_COMMIT,
                                    oid, &unused);
 }
 
-int get_oid_tree(const char *name, struct object_id *oid)
+int repo_get_oid_tree(struct repository *r,
+                     const char *name,
+                     struct object_id *oid)
 {
        struct object_context unused;
-       return get_oid_with_context(the_repository,
-                                   name, GET_OID_TREE,
+       return get_oid_with_context(r, name, GET_OID_TREE,
                                    oid, &unused);
 }
 
-int get_oid_blob(const char *name, struct object_id *oid)
+int repo_get_oid_blob(struct repository *r,
+                     const char *name,
+                     struct object_id *oid)
 {
        struct object_context unused;
-       return get_oid_with_context(the_repository,
-                                   name, GET_OID_BLOB,
+       return get_oid_with_context(r, name, GET_OID_BLOB,
                                    oid, &unused);
 }