git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 30/31] sha1-name.c: remove the_repo from other get_oid_*
Date: Sun, 17 Feb 2019 17:09:12 +0700	[thread overview]
Message-ID: <20190217100913.4127-31-pclouds@gmail.com> (raw)
In-Reply-To: <20190217100913.4127-1-pclouds@gmail.com>

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 cache.h     | 18 ++++++++++++------
 sha1-name.c | 35 ++++++++++++++++++++---------------
 2 files changed, 32 insertions(+), 21 deletions(-)

diff --git a/cache.h b/cache.h
index da7035c261..7ce8c566fc 100644
--- a/cache.h
+++ b/cache.h
@@ -1355,12 +1355,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);
@@ -1368,6 +1367,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)
diff --git a/sha1-name.c b/sha1-name.c
index b94d381bef..d49496397d 100644
--- a/sha1-name.c
+++ b/sha1-name.c
@@ -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);
 }
 
-- 
2.21.0.rc0.328.g0e39304f8d


  parent reply	other threads:[~2019-02-17 10:11 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-17 10:08 [PATCH 00/31] Kill the_repository in sha1-name.c Nguyễn Thái Ngọc Duy
2019-02-17 10:08 ` [PATCH 01/31] packfile.c: add repo_approximate_object_count() Nguyễn Thái Ngọc Duy
2019-02-17 10:08 ` [PATCH 02/31] refs.c: add refs_ref_exists() Nguyễn Thái Ngọc Duy
2019-02-17 10:08 ` [PATCH 03/31] refs.c: add refs_shorten_unambiguous_ref() Nguyễn Thái Ngọc Duy
2019-02-17 10:08 ` [PATCH 04/31] refs.c: remove the_repo from substitute_branch_name() Nguyễn Thái Ngọc Duy
2019-02-17 10:08 ` [PATCH 05/31] refs.c: remove the_repo from expand_ref() Nguyễn Thái Ngọc Duy
2019-02-17 10:08 ` [PATCH 06/31] refs.c: add repo_dwim_ref() Nguyễn Thái Ngọc Duy
2019-02-17 10:08 ` [PATCH 07/31] refs.c: add repo_dwim_log() Nguyễn Thái Ngọc Duy
2019-02-17 10:08 ` [PATCH 08/31] refs.c: remove the_repo from read_ref_at() Nguyễn Thái Ngọc Duy
2019-02-17 10:08 ` [PATCH 09/31] commit.c: add repo_get_commit_tree() Nguyễn Thái Ngọc Duy
2019-02-17 10:08 ` [PATCH 10/31] sha1-name.c: remove the_repo from sort_ambiguous() Nguyễn Thái Ngọc Duy
2019-02-17 10:08 ` [PATCH 11/31] sha1-name.c: remove the_repo from find_abbrev_len_packed() Nguyễn Thái Ngọc Duy
2019-02-17 10:08 ` [PATCH 12/31] sha1-name.c: add repo_find_unique_abbrev_r() Nguyễn Thái Ngọc Duy
2019-02-17 10:08 ` [PATCH 13/31] sha1-name.c: store and use repo in struct disambiguate_state Nguyễn Thái Ngọc Duy
2019-02-17 10:08 ` [PATCH 14/31] sha1-name.c: add repo_for_each_abbrev() Nguyễn Thái Ngọc Duy
2019-02-17 10:08 ` [PATCH 15/31] sha1-name.c: remove the_repo from get_short_oid() Nguyễn Thái Ngọc Duy
2019-02-17 10:08 ` [PATCH 16/31] sha1-name.c: remove the_repo from interpret_nth_prior_checkout() Nguyễn Thái Ngọc Duy
2019-02-17 10:08 ` [PATCH 17/31] sha1-name.c: remove the_repo from interpret_branch_mark() Nguyễn Thái Ngọc Duy
2019-02-17 10:09 ` [PATCH 18/31] sha1-name.c: add repo_interpret_branch_name() Nguyễn Thái Ngọc Duy
2019-02-17 10:09 ` [PATCH 19/31] sha1-name.c: remove the_repo from get_oid_oneline() Nguyễn Thái Ngọc Duy
2019-02-17 10:09 ` [PATCH 20/31] sha1-name.c: remove the_repo from get_describe_name() Nguyễn Thái Ngọc Duy
2019-02-17 10:09 ` [PATCH 21/31] sha1-name.c: remove the_repo from get_oid_basic() Nguyễn Thái Ngọc Duy
2019-02-17 10:09 ` [PATCH 22/31] sha1-name.c: remove the_repo from get_oid_1() Nguyễn Thái Ngọc Duy
2019-02-17 10:09 ` [PATCH 23/31] sha1-name.c: remove the_repo from handle_one_ref() Nguyễn Thái Ngọc Duy
2019-02-17 10:09 ` [PATCH 24/31] sha1-name.c: remove the_repo from diagnose_invalid_index_path() Nguyễn Thái Ngọc Duy
2019-02-17 10:09 ` [PATCH 25/31] sha1-name.c: remove the_repo from resolve_relative_path() Nguyễn Thái Ngọc Duy
2019-02-17 10:09 ` [PATCH 26/31] sha1-name.c: remove the_repo from get_oid_with_context_1() Nguyễn Thái Ngọc Duy
2019-02-17 10:09 ` [PATCH 27/31] sha1-name.c: add repo_get_oid() Nguyễn Thái Ngọc Duy
2019-02-17 10:09 ` [PATCH 28/31] submodule-config.c: use repo_get_oid for reading .gitmodules Nguyễn Thái Ngọc Duy
2019-02-17 10:09 ` [PATCH 29/31] sha1-name.c: remove the_repo from maybe_die_on_misspelt_object_name Nguyễn Thái Ngọc Duy
2019-02-17 10:09 ` Nguyễn Thái Ngọc Duy [this message]
2019-02-17 10:09 ` [PATCH 31/31] sha1-name.c: remove the_repo from get_oid_mb() Nguyễn Thái Ngọc Duy
  -- strict thread matches above, loose matches on Subject: below --
2019-03-30 11:18 [PATCH 00/31] Kill the_repository in sha1-name.c Nguyễn Thái Ngọc Duy
2019-03-30 11:19 ` [PATCH 30/31] sha1-name.c: remove the_repo from other get_oid_* Nguyễn Thái Ngọc Duy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190217100913.4127-31-pclouds@gmail.com \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).