Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerrick Stolee <derrickstolee@github.com>2022-10-12 15:52:33 +0300
committerJunio C Hamano <gitster@pobox.com>2022-10-12 19:13:24 +0300
commit738e5245fa423fc43495e2e17e053365dc6b2fc0 (patch)
treebf89e0f0b38a201e8b814b2881583817a36158f0 /bundle-uri.h
parentd796cedbe8ca77310a7dabcafe60b040aa0e2b67 (diff)
bundle-uri: parse bundle list in config format
When a bundle provider wants to operate independently from a Git remote, they want to provide a single, consistent URI that users can use in their 'git clone --bundle-uri' commands. At this point, the Git client expects that URI to be a single bundle that can be unbundled and used to bootstrap the rest of the clone from the Git server. This single bundle cannot be re-used to assist with future incremental fetches. To allow for the incremental fetch case, teach Git to understand a bundle list that could be advertised at an independent bundle URI. Such a bundle list is likely to be inspected by human readers, even if only by the bundle provider creating the list. For this reason, we can take our expected "key=value" pairs and instead format them using Git config format. Create bundle_uri_parse_config_format() to parse a file in config format and convert that into a 'struct bundle_list' filled with its understanding of the contents. Be careful to use error_action CONFIG_ERROR_ERROR when calling git_config_from_file_with_options() because the default action for git_config_from_file() is to die() on a parsing error. The current warning isn't particularly helpful if it arises to a user, but it will be made more verbose at a higher layer later. Update 'test-tool bundle-uri' to take this config file format as input. It uses a filename instead of stdin because there is no existing way to parse a FILE pointer in the config machinery. Using git_config_from_mem() is overly complicated and more likely to introduce bugs than this simpler version. Signed-off-by: Derrick Stolee <derrickstolee@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'bundle-uri.h')
-rw-r--r--bundle-uri.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/bundle-uri.h b/bundle-uri.h
index 0e56ab2ae5..bc13d4c992 100644
--- a/bundle-uri.h
+++ b/bundle-uri.h
@@ -63,6 +63,15 @@ struct FILE;
void print_bundle_list(FILE *fp, struct bundle_list *list);
/**
+ * A bundle URI may point to a bundle list where the key=value
+ * pairs are provided in config file format. This method is
+ * exposed publicly for testing purposes.
+ */
+int bundle_uri_parse_config_format(const char *uri,
+ const char *filename,
+ struct bundle_list *list);
+
+/**
* Fetch data from the given 'uri' and unbundle the bundle data found
* based on that information.
*