Skip to content

Commit 75b97fe

Browse files
jonathantanmygitster
authored andcommitted
extension.partialclone: introduce partial clone extension
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f4371a8 commit 75b97fe

File tree

4 files changed

+21
-1
lines changed

4 files changed

+21
-1
lines changed

Documentation/technical/repository-version.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,15 @@ for testing format-1 compatibility.
8686
When the config key `extensions.preciousObjects` is set to `true`,
8787
objects in the repository MUST NOT be deleted (e.g., by `git-prune` or
8888
`git repack -d`).
89+
90+
`partialclone`
91+
~~~~~~~~~~~~~~
92+
93+
When the config key `extensions.partialclone` is set, it indicates
94+
that the repo was created with a partial clone (or later performed
95+
a partial fetch) and that the remote may have omitted sending
96+
certain unwanted objects. Such a remote is called a "promisor remote"
97+
and it promises that all such omitted objects can be fetched from it
98+
in the future.
99+
100+
The value of this key is the name of the promisor remote.

cache.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -860,10 +860,12 @@ extern int grafts_replace_parents;
860860
#define GIT_REPO_VERSION 0
861861
#define GIT_REPO_VERSION_READ 1
862862
extern int repository_format_precious_objects;
863+
extern char *repository_format_partial_clone;
863864

864865
struct repository_format {
865866
int version;
866867
int precious_objects;
868+
char *partial_clone; /* value of extensions.partialclone */
867869
int is_bare;
868870
char *work_tree;
869871
struct string_list unknown_extensions;

environment.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ int warn_ambiguous_refs = 1;
2727
int warn_on_object_refname_ambiguity = 1;
2828
int ref_paranoia = -1;
2929
int repository_format_precious_objects;
30+
char *repository_format_partial_clone;
3031
const char *git_commit_encoding;
3132
const char *git_log_output_encoding;
3233
const char *apply_default_whitespace;

setup.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,11 @@ static int check_repo_format(const char *var, const char *value, void *vdata)
420420
;
421421
else if (!strcmp(ext, "preciousobjects"))
422422
data->precious_objects = git_config_bool(var, value);
423-
else
423+
else if (!strcmp(ext, "partialclone")) {
424+
if (!value)
425+
return config_error_nonbool(var);
426+
data->partial_clone = xstrdup(value);
427+
} else
424428
string_list_append(&data->unknown_extensions, ext);
425429
} else if (strcmp(var, "core.bare") == 0) {
426430
data->is_bare = git_config_bool(var, value);
@@ -463,6 +467,7 @@ static int check_repository_format_gently(const char *gitdir, int *nongit_ok)
463467
}
464468

465469
repository_format_precious_objects = candidate.precious_objects;
470+
repository_format_partial_clone = candidate.partial_clone;
466471
string_list_clear(&candidate.unknown_extensions, 0);
467472
if (!has_common) {
468473
if (candidate.is_bare != -1) {

0 commit comments

Comments
 (0)