From c468da4e2796868362c2f33b499d9bb6d6cd7043 Mon Sep 17 00:00:00 2001 From: Michael Haggerty Date: Fri, 10 Feb 2017 12:16:12 +0100 Subject: refs: make some ref_store lookup functions private The following functions currently don't need to be exposed: * ref_store_init() * lookup_ref_store() That might change in the future, but for now make them private. Signed-off-by: Michael Haggerty Reviewed-by: Jeff King Signed-off-by: Junio C Hamano --- refs/refs-internal.h | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'refs/refs-internal.h') diff --git a/refs/refs-internal.h b/refs/refs-internal.h index 708b26082a..d8a7eb1841 100644 --- a/refs/refs-internal.h +++ b/refs/refs-internal.h @@ -652,25 +652,6 @@ void base_ref_store_init(struct ref_store *refs, const struct ref_storage_be *be, const char *submodule); -/* - * Create, record, and return a ref_store instance for the specified - * submodule (or the main repository if submodule is NULL). - * - * For backwards compatibility, submodule=="" is treated the same as - * submodule==NULL. - */ -struct ref_store *ref_store_init(const char *submodule); - -/* - * Return the ref_store instance for the specified submodule (or the - * main repository if submodule is NULL). If that ref_store hasn't - * been initialized yet, return NULL. - * - * For backwards compatibility, submodule=="" is treated the same as - * submodule==NULL. - */ -struct ref_store *lookup_ref_store(const char *submodule); - /* * Return the ref_store instance for the specified submodule. For the * main repository, use submodule==NULL; such a call cannot fail. For -- cgit v1.2.3 From 7d4558c462f0d1a280abec59e8c64a2f2b42a9f2 Mon Sep 17 00:00:00 2001 From: Michael Haggerty Date: Fri, 10 Feb 2017 12:16:15 +0100 Subject: refs: store submodule ref stores in a hashmap Aside from scaling better, this means that the submodule name needn't be stored in the ref_store instance anymore (which will be changed in a moment). This, in turn, will help loosen the strict 1:1 relationship between ref_stores and submodules. Signed-off-by: Michael Haggerty Reviewed-by: Jeff King Signed-off-by: Junio C Hamano --- refs/refs-internal.h | 6 ------ 1 file changed, 6 deletions(-) (limited to 'refs/refs-internal.h') diff --git a/refs/refs-internal.h b/refs/refs-internal.h index d8a7eb1841..07fd208f2c 100644 --- a/refs/refs-internal.h +++ b/refs/refs-internal.h @@ -636,12 +636,6 @@ struct ref_store { * reference store: */ const char *submodule; - - /* - * Submodule reference store instances are stored in a linked - * list using this pointer. - */ - struct ref_store *next; }; /* -- cgit v1.2.3 From 32c597e7b2d85c1ae313e369b21398638cafe45d Mon Sep 17 00:00:00 2001 From: Michael Haggerty Date: Fri, 10 Feb 2017 12:16:16 +0100 Subject: refs: push the submodule attribute down Push the submodule attribute down from ref_store to files_ref_store. This is another step towards loosening the 1:1 connection between ref_stores and submodules. Signed-off-by: Michael Haggerty Reviewed-by: Jeff King Signed-off-by: Junio C Hamano --- refs/refs-internal.h | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'refs/refs-internal.h') diff --git a/refs/refs-internal.h b/refs/refs-internal.h index 07fd208f2c..008822d67c 100644 --- a/refs/refs-internal.h +++ b/refs/refs-internal.h @@ -629,13 +629,6 @@ extern struct ref_storage_be refs_be_files; struct ref_store { /* The backend describing this ref_store's storage scheme: */ const struct ref_storage_be *be; - - /* - * The name of the submodule represented by this object, or - * the empty string if it represents the main repository's - * reference store: - */ - const char *submodule; }; /* @@ -658,10 +651,4 @@ void base_ref_store_init(struct ref_store *refs, */ struct ref_store *get_ref_store(const char *submodule); -/* - * Die if refs is for a submodule (i.e., not for the main repository). - * caller is used in any necessary error messages. - */ -void assert_main_repository(struct ref_store *refs, const char *caller); - #endif /* REFS_REFS_INTERNAL_H */ -- cgit v1.2.3 From fbfd0a291596a698773d3f687af3ab4c36a841bf Mon Sep 17 00:00:00 2001 From: Michael Haggerty Date: Fri, 10 Feb 2017 12:16:17 +0100 Subject: base_ref_store_init(): remove submodule argument This is another step towards weakening the 1:1 relationship between ref_stores and submodules. Signed-off-by: Michael Haggerty Reviewed-by: Jeff King Signed-off-by: Junio C Hamano --- refs/refs-internal.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'refs/refs-internal.h') diff --git a/refs/refs-internal.h b/refs/refs-internal.h index 008822d67c..793c850e98 100644 --- a/refs/refs-internal.h +++ b/refs/refs-internal.h @@ -632,12 +632,11 @@ struct ref_store { }; /* - * Fill in the generic part of refs for the specified submodule and - * add it to our collection of reference stores. + * Fill in the generic part of refs and add it to our collection of + * reference stores. */ void base_ref_store_init(struct ref_store *refs, - const struct ref_storage_be *be, - const char *submodule); + const struct ref_storage_be *be); /* * Return the ref_store instance for the specified submodule. For the -- cgit v1.2.3 From 3c0cb0cbaef699f699b79c8be716086053760ea9 Mon Sep 17 00:00:00 2001 From: Michael Haggerty Date: Thu, 9 Feb 2017 21:53:52 +0100 Subject: read_loose_refs(): read refs using resolve_ref_recursively() There is no need to call read_ref_full() or resolve_gitlink_ref() from read_loose_refs(), because we already have a ref_store object in hand. So we can call resolve_ref_recursively() ourselves. Happily, this unifies the code for the submodule vs. non-submodule cases. This requires resolve_ref_recursively() to be exposed to the refs subsystem, though not to non-refs code. Signed-off-by: Michael Haggerty Reviewed-by: Jeff King Signed-off-by: Junio C Hamano --- refs/refs-internal.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'refs/refs-internal.h') diff --git a/refs/refs-internal.h b/refs/refs-internal.h index 793c850e98..33adbf93b5 100644 --- a/refs/refs-internal.h +++ b/refs/refs-internal.h @@ -650,4 +650,9 @@ void base_ref_store_init(struct ref_store *refs, */ struct ref_store *get_ref_store(const char *submodule); +const char *resolve_ref_recursively(struct ref_store *refs, + const char *refname, + int resolve_flags, + unsigned char *sha1, int *flags); + #endif /* REFS_REFS_INTERNAL_H */ -- cgit v1.2.3