1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-18 05:26:29 +02:00

rename read_replace_refs to check_replace_refs

The semantics of this flag was changed in commit

    e1111cef23 inline lookup_replace_object() calls

but wasn't renamed at the time to minimize code churn.  Rename it now,
and add a comment explaining its use.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Michael Haggerty 2014-02-18 12:24:55 +01:00 committed by Junio C Hamano
parent 5f95c9f850
commit afc711b8e1
12 changed files with 24 additions and 14 deletions

View File

@ -630,7 +630,7 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
struct alternate_object_database *alt;
errors_found = 0;
read_replace_refs = 0;
check_replace_refs = 0;
argc = parse_options(argc, argv, prefix, fsck_opts, fsck_usage, 0);

View File

@ -1502,7 +1502,7 @@ int cmd_index_pack(int argc, const char **argv, const char *prefix)
if (argc == 2 && !strcmp(argv[1], "-h"))
usage(index_pack_usage);
read_replace_refs = 0;
check_replace_refs = 0;
reset_pack_idx_option(&opts);
git_config(git_index_pack_config, &opts);

View File

@ -2507,7 +2507,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
OPT_END(),
};
read_replace_refs = 0;
check_replace_refs = 0;
reset_pack_idx_option(&pack_idx_opts);
git_config(git_pack_config, NULL);

View File

@ -150,7 +150,7 @@ int cmd_prune(int argc, const char **argv, const char *prefix)
expire = ULONG_MAX;
save_commit_buffer = 0;
read_replace_refs = 0;
check_replace_refs = 0;
init_revisions(&revs, prefix);
argc = parse_options(argc, argv, prefix, options, prune_usage, 0);

View File

@ -178,7 +178,7 @@ int cmd_replace(int argc, const char **argv, const char *prefix)
OPT_END()
};
read_replace_refs = 0;
check_replace_refs = 0;
argc = parse_options(argc, argv, prefix, options, git_replace_usage, 0);

View File

@ -497,7 +497,7 @@ int cmd_unpack_objects(int argc, const char **argv, const char *prefix)
int i;
unsigned char sha1[20];
read_replace_refs = 0;
check_replace_refs = 0;
git_config(git_default_config, NULL);

14
cache.h
View File

@ -580,7 +580,17 @@ extern size_t packed_git_limit;
extern size_t delta_base_cache_limit;
extern unsigned long big_file_threshold;
extern unsigned long pack_size_limit_cfg;
extern int read_replace_refs;
/*
* Do replace refs need to be checked this run? This variable is
* initialized to true unless --no-replace-object is used or
* $GIT_NO_REPLACE_OBJECTS is set, but is set to false by some
* commands that do not want replace references to be active. As an
* optimization it is also set to false if replace references have
* been sought but there were none.
*/
extern int check_replace_refs;
extern int fsync_object_files;
extern int core_preload_index;
extern int core_apply_sparse_checkout;
@ -791,7 +801,7 @@ static inline void *read_sha1_file(const unsigned char *sha1, enum object_type *
extern const unsigned char *do_lookup_replace_object(const unsigned char *sha1);
static inline const unsigned char *lookup_replace_object(const unsigned char *sha1)
{
if (!read_replace_refs)
if (!check_replace_refs)
return sha1;
return do_lookup_replace_object(sha1);
}

View File

@ -45,7 +45,7 @@ const char *editor_program;
const char *askpass_program;
const char *excludes_file;
enum auto_crlf auto_crlf = AUTO_CRLF_FALSE;
int read_replace_refs = 1; /* NEEDSWORK: rename to use_replace_refs */
int check_replace_refs = 1;
enum eol core_eol = EOL_UNSET;
enum safe_crlf safe_crlf = SAFE_CRLF_WARN;
unsigned whitespace_rule_cfg = WS_DEFAULT_RULE;
@ -147,7 +147,7 @@ static void setup_git_env(void)
if (!git_graft_file)
git_graft_file = git_pathdup("info/grafts");
if (getenv(NO_REPLACE_OBJECTS_ENVIRONMENT))
read_replace_refs = 0;
check_replace_refs = 0;
namespace = expand_namespace(getenv(GIT_NAMESPACE_ENVIRONMENT));
namespace_len = strlen(namespace);
shallow_file = getenv(GIT_SHALLOW_FILE_ENVIRONMENT);

2
git.c
View File

@ -78,7 +78,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
if (envchanged)
*envchanged = 1;
} else if (!strcmp(cmd, "--no-replace-objects")) {
read_replace_refs = 0;
check_replace_refs = 0;
setenv(NO_REPLACE_OBJECTS_ENVIRONMENT, "1", 1);
if (envchanged)
*envchanged = 1;

View File

@ -100,7 +100,7 @@ static int add_ref_decoration(const char *refname, const unsigned char *sha1, in
if (starts_with(refname, "refs/replace/")) {
unsigned char original_sha1[20];
if (!read_replace_refs)
if (!check_replace_refs)
return 0;
if (get_sha1_hex(refname + 13, original_sha1)) {
warning("invalid replace ref %s", refname);

View File

@ -86,7 +86,7 @@ static void prepare_replace_object(void)
for_each_replace_ref(register_replace_ref, NULL);
replace_object_prepared = 1;
if (!replace_object_nr)
read_replace_refs = 0;
check_replace_refs = 0;
}
/* We allow "recursive" replacement. Only within reason, though */

View File

@ -796,7 +796,7 @@ int main(int argc, char **argv)
packet_trace_identity("upload-pack");
git_extract_argv0_path(argv[0]);
read_replace_refs = 0;
check_replace_refs = 0;
for (i = 1; i < argc; i++) {
char *arg = argv[i];