extension.partialclone: introduce partial clone extension
authorJonathan Tan <jonathantanmy@google.com>
Tue, 5 Dec 2017 16:58:43 +0000 (16:58 +0000)
committerJunio C Hamano <gitster@pobox.com>
Tue, 5 Dec 2017 17:46:05 +0000 (09:46 -0800)
Introduce new repository extension option:
`extensions.partialclone`

See the update to Documentation/technical/repository-version.txt
in this patch for more information.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/technical/repository-version.txt
cache.h
environment.c
setup.c
index 00ad37986efdcebb440c95629acd16213028c239..e03eaccebc9c28acf29408060b2f76d7161db0d6 100644 (file)
@@ -86,3 +86,15 @@ for testing format-1 compatibility.
 When the config key `extensions.preciousObjects` is set to `true`,
 objects in the repository MUST NOT be deleted (e.g., by `git-prune` or
 `git repack -d`).
+
+`partialclone`
+~~~~~~~~~~~~~~
+
+When the config key `extensions.partialclone` is set, it indicates
+that the repo was created with a partial clone (or later performed
+a partial fetch) and that the remote may have omitted sending
+certain unwanted objects.  Such a remote is called a "promisor remote"
+and it promises that all such omitted objects can be fetched from it
+in the future.
+
+The value of this key is the name of the promisor remote.
diff --git a/cache.h b/cache.h
index 6440e2bf21f5800db98f82fcedff46478188674e..35e3f5ed5f87ee7228b334788692f6b8239fc74e 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -860,10 +860,12 @@ extern int grafts_replace_parents;
 #define GIT_REPO_VERSION 0
 #define GIT_REPO_VERSION_READ 1
 extern int repository_format_precious_objects;
+extern char *repository_format_partial_clone;
 
 struct repository_format {
        int version;
        int precious_objects;
+       char *partial_clone; /* value of extensions.partialclone */
        int is_bare;
        char *work_tree;
        struct string_list unknown_extensions;
index 8289c25b44d74a0f054f9fe3eaf44c5fdcf0b3d2..e52aab3ea4c4a90b42e560ba040ab5204b7067e6 100644 (file)
@@ -27,6 +27,7 @@ int warn_ambiguous_refs = 1;
 int warn_on_object_refname_ambiguity = 1;
 int ref_paranoia = -1;
 int repository_format_precious_objects;
+char *repository_format_partial_clone;
 const char *git_commit_encoding;
 const char *git_log_output_encoding;
 const char *apply_default_whitespace;
diff --git a/setup.c b/setup.c
index 03f51e056cd6e672ecd80ba94348173b9d496cc0..58536bd6eeb496d455953634b6b1943f69ed80ef 100644 (file)
--- a/setup.c
+++ b/setup.c
@@ -420,7 +420,11 @@ static int check_repo_format(const char *var, const char *value, void *vdata)
                        ;
                else if (!strcmp(ext, "preciousobjects"))
                        data->precious_objects = git_config_bool(var, value);
-               else
+               else if (!strcmp(ext, "partialclone")) {
+                       if (!value)
+                               return config_error_nonbool(var);
+                       data->partial_clone = xstrdup(value);
+               } else
                        string_list_append(&data->unknown_extensions, ext);
        } else if (strcmp(var, "core.bare") == 0) {
                data->is_bare = git_config_bool(var, value);
@@ -463,6 +467,7 @@ static int check_repository_format_gently(const char *gitdir, int *nongit_ok)
        }
 
        repository_format_precious_objects = candidate.precious_objects;
+       repository_format_partial_clone = candidate.partial_clone;
        string_list_clear(&candidate.unknown_extensions, 0);
        if (!has_common) {
                if (candidate.is_bare != -1) {