The v3 bundle format has capabilities, allowing newer versions of Git to
create bundles with newer features. Older versions that do not
understand these new capabilities will fail with a helpful warning.
Create a new capability allowing Git to understand that the contained
pack-file is filtered according to some object filter. Typically, this
filter will be "blob:none" for a blobless partial clone.
This change teaches Git to parse this capability, place its value in the
bundle header, and demonstrate this understanding by adding a message to
'git bundle verify'.
Since we will use gently_parse_list_objects_filter() outside of
list-objects-filter-options.c, make it an external method and move its
API documentation to before its declaration.
Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Derrick Stolee committedMar 9, 2022 at 16:01 UTC105c6f14ad34b417c1e78bc9a8704dcda7b059f2
6 files changed+50-22
Documentation/git-bundle.txt
+5-2
index 72ab813905..ac4c4352aa 100644--- a/Documentation/git-bundle.txt+++ b/Documentation/git-bundle.txt@@ -75,8 +75,11 @@ verify <file>:: cleanly to the current repository. This includes checks on the bundle format itself as well as checking that the prerequisite commits exist and are fully linked in the current repository.- 'git bundle' prints a list of missing commits, if any, and exits- with a non-zero status.+ Information about additional capabilities, such as "object filter",+ is printed. See "Capabilities" in link:technical/bundle-format.html+ for more information. Finally, 'git bundle' prints a list of+ missing commits, if any. The exit code is zero for success, but+ will be nonzero if the bundle file is invalid. list-heads <file>:: Lists the references defined in the bundle. If followed by a
Documentation/technical/bundle-format.txt
+8-3
index bac558d049..b9be8644cf 100644--- a/Documentation/technical/bundle-format.txt+++ b/Documentation/technical/bundle-format.txt@@ -71,6 +71,11 @@ and the Git bundle v2 format cannot represent a shallow clone repository. == Capabilities Because there is no opportunity for negotiation, unknown capabilities cause 'git-bundle' to abort. The only known capability is `object-format`, which specifies-the hash algorithm in use, and can take the same values as the-`extensions.objectFormat` configuration value.+bundle' to abort.++* `object-format` specifies the hash algorithm in use, and can take the same+ values as the `extensions.objectFormat` configuration value.++* `filter` specifies an object filter as in the `--filter` option in+ linkgit:git-rev-list[1]. The resulting pack-file must be marked as a+ `.promisor` pack-file after it is unbundled.
index 449d53af69..f02d8df142 100644--- a/list-objects-filter-options.c+++ b/list-objects-filter-options.c@@ -40,22 +40,7 @@ const char *list_object_filter_config_name(enum list_objects_filter_choice c) BUG("list_object_filter_config_name: invalid argument '%d'", c); }-/*- * Parse value of the argument to the "filter" keyword.- * On the command line this looks like:- * --filter=<arg>- * and in the pack protocol as:- * "filter" SP <arg>- *- * The filter keyword will be used by many commands.- * See Documentation/rev-list-options.txt for allowed values for <arg>.- *- * Capture the given arg as the "filter_spec". This can be forwarded to- * subordinate commands when necessary (although it's better to pass it through- * expand_list_objects_filter_spec() first). We also "intern" the arg for the- * convenience of the current command.- */-static int gently_parse_list_objects_filter(+int gently_parse_list_objects_filter( struct list_objects_filter_options *filter_options, const char *arg, struct strbuf *errbuf)
list-objects-filter-options.h
+20
index 425c38cae9..2eb6c98394 100644--- a/list-objects-filter-options.h+++ b/list-objects-filter-options.h@@ -72,6 +72,26 @@ struct list_objects_filter_options { /* Normalized command line arguments */ #define CL_ARG__FILTER "filter"+/*+ * Parse value of the argument to the "filter" keyword.+ * On the command line this looks like:+ * --filter=<arg>+ * and in the pack protocol as:+ * "filter" SP <arg>+ *+ * The filter keyword will be used by many commands.+ * See Documentation/rev-list-options.txt for allowed values for <arg>.+ *+ * Capture the given arg as the "filter_spec". This can be forwarded to+ * subordinate commands when necessary (although it's better to pass it through+ * expand_list_objects_filter_spec() first). We also "intern" the arg for the+ * convenience of the current command.+ */+int gently_parse_list_objects_filter(+ struct list_objects_filter_options *filter_options,+ const char *arg,+ struct strbuf *errbuf);+ void list_objects_filter_die_if_populated( struct list_objects_filter_options *filter_options);