Skip to content

Commit 56fe0cf

Browse files
chriscoolgitster
authored andcommitted
Move repository_format_partial_clone to promisor-remote.c
Now that we have has_promisor_remote() and can use many promisor remotes, let's hide repository_format_partial_clone as a static in promisor-remote.c to avoid it being use for anything other than managing backward compatibility. Signed-off-by: Christian Couder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0ba08c0 commit 56fe0cf

File tree

5 files changed

+15
-3
lines changed

5 files changed

+15
-3
lines changed

cache.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,6 @@ extern int grafts_replace_parents;
958958
#define GIT_REPO_VERSION 0
959959
#define GIT_REPO_VERSION_READ 1
960960
extern int repository_format_precious_objects;
961-
extern char *repository_format_partial_clone;
962961
extern const char *core_partial_clone_filter_default;
963962
extern int repository_format_worktree_config;
964963

environment.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ int warn_ambiguous_refs = 1;
3131
int warn_on_object_refname_ambiguity = 1;
3232
int ref_paranoia = -1;
3333
int repository_format_precious_objects;
34-
char *repository_format_partial_clone;
3534
const char *core_partial_clone_filter_default;
3635
int repository_format_worktree_config;
3736
const char *git_commit_encoding;

promisor-remote.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
#include "config.h"
55
#include "transport.h"
66

7+
static char *repository_format_partial_clone;
8+
9+
void set_repository_format_partial_clone(char *partial_clone)
10+
{
11+
repository_format_partial_clone = xstrdup_or_null(partial_clone);
12+
}
13+
714
static int fetch_refs(const char *remote_name, struct ref *ref)
815
{
916
struct remote *remote;

promisor-remote.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,10 @@ extern struct promisor_remote *promisor_remote_find(const char *remote_name);
2020
extern int has_promisor_remote(void);
2121
extern int promisor_remote_get_direct(const struct object_id *oids, int oid_nr);
2222

23+
/*
24+
* This should be used only once from setup.c to set the value we got
25+
* from the extensions.partialclone config option.
26+
*/
27+
extern void set_repository_format_partial_clone(char *partial_clone);
28+
2329
#endif /* PROMISOR_REMOTE_H */

setup.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "dir.h"
55
#include "string-list.h"
66
#include "chdir-notify.h"
7+
#include "promisor-remote.h"
78

89
static int inside_git_dir = -1;
910
static int inside_work_tree = -1;
@@ -477,7 +478,7 @@ static int check_repository_format_gently(const char *gitdir, struct repository_
477478
}
478479

479480
repository_format_precious_objects = candidate->precious_objects;
480-
repository_format_partial_clone = xstrdup_or_null(candidate->partial_clone);
481+
set_repository_format_partial_clone(candidate->partial_clone);
481482
repository_format_worktree_config = candidate->worktree_config;
482483
string_list_clear(&candidate->unknown_extensions, 0);
483484

0 commit comments

Comments
 (0)