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>

Michael Haggerty committed Feb 18, 2014 at 12:24 UTC afc711b8e1ee89626f0dddf0ef01fb73168d47ca
12 files changed +24 -14
builtin/fsck.c
+1 -1
@@ -630,7 +630,7 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
630 struct alternate_object_database *alt;
631
632 errors_found = 0;
633 - read_replace_refs = 0;
633 + check_replace_refs = 0;
634
635 argc = parse_options(argc, argv, prefix, fsck_opts, fsck_usage, 0);
636
builtin/index-pack.c
+1 -1
@@ -1502,7 +1502,7 @@ int cmd_index_pack(int argc, const char **argv, const char *prefix)
1502 if (argc == 2 && !strcmp(argv[1], "-h"))
1503 usage(index_pack_usage);
1504
1505 - read_replace_refs = 0;
1505 + check_replace_refs = 0;
1506
1507 reset_pack_idx_option(&opts);
1508 git_config(git_index_pack_config, &opts);
builtin/pack-objects.c
+1 -1
@@ -2507,7 +2507,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
2507 OPT_END(),
2508 };
2509
2510 - read_replace_refs = 0;
2510 + check_replace_refs = 0;
2511
2512 reset_pack_idx_option(&pack_idx_opts);
2513 git_config(git_pack_config, NULL);
builtin/prune.c
+1 -1
@@ -150,7 +150,7 @@ int cmd_prune(int argc, const char **argv, const char *prefix)
150
151 expire = ULONG_MAX;
152 save_commit_buffer = 0;
153 - read_replace_refs = 0;
153 + check_replace_refs = 0;
154 init_revisions(&revs, prefix);
155
156 argc = parse_options(argc, argv, prefix, options, prune_usage, 0);
builtin/replace.c
+1 -1
@@ -178,7 +178,7 @@ int cmd_replace(int argc, const char **argv, const char *prefix)
178 OPT_END()
179 };
180
181 - read_replace_refs = 0;
181 + check_replace_refs = 0;
182
183 argc = parse_options(argc, argv, prefix, options, git_replace_usage, 0);
184
builtin/unpack-objects.c
+1 -1
@@ -497,7 +497,7 @@ int cmd_unpack_objects(int argc, const char **argv, const char *prefix)
497 int i;
498 unsigned char sha1[20];
499
500 - read_replace_refs = 0;
500 + check_replace_refs = 0;
501
502 git_config(git_default_config, NULL);
503
cache.h
+12 -2
@@ -580,7 +580,17 @@ extern size_t packed_git_limit;
580 extern size_t delta_base_cache_limit;
581 extern unsigned long big_file_threshold;
582 extern unsigned long pack_size_limit_cfg;
583 -extern int read_replace_refs;
583 +
584 +/*
585 + * Do replace refs need to be checked this run? This variable is
586 + * initialized to true unless --no-replace-object is used or
587 + * $GIT_NO_REPLACE_OBJECTS is set, but is set to false by some
588 + * commands that do not want replace references to be active. As an
589 + * optimization it is also set to false if replace references have
590 + * been sought but there were none.
591 + */
592 +extern int check_replace_refs;
593 +
594 extern int fsync_object_files;
595 extern int core_preload_index;
596 extern int core_apply_sparse_checkout;
@@ -791,7 +801,7 @@ static inline void *read_sha1_file(const unsigned char *sha1, enum object_type *
801 extern const unsigned char *do_lookup_replace_object(const unsigned char *sha1);
802 static inline const unsigned char *lookup_replace_object(const unsigned char *sha1)
803 {
794 - if (!read_replace_refs)
804 + if (!check_replace_refs)
805 return sha1;
806 return do_lookup_replace_object(sha1);
807 }
environment.c
+2 -2
@@ -45,7 +45,7 @@ const char *editor_program;
45 const char *askpass_program;
46 const char *excludes_file;
47 enum auto_crlf auto_crlf = AUTO_CRLF_FALSE;
48 -int read_replace_refs = 1; /* NEEDSWORK: rename to use_replace_refs */
48 +int check_replace_refs = 1;
49 enum eol core_eol = EOL_UNSET;
50 enum safe_crlf safe_crlf = SAFE_CRLF_WARN;
51 unsigned whitespace_rule_cfg = WS_DEFAULT_RULE;
@@ -147,7 +147,7 @@ static void setup_git_env(void)
147 if (!git_graft_file)
148 git_graft_file = git_pathdup("info/grafts");
149 if (getenv(NO_REPLACE_OBJECTS_ENVIRONMENT))
150 - read_replace_refs = 0;
150 + check_replace_refs = 0;
151 namespace = expand_namespace(getenv(GIT_NAMESPACE_ENVIRONMENT));
152 namespace_len = strlen(namespace);
153 shallow_file = getenv(GIT_SHALLOW_FILE_ENVIRONMENT);
git.c
+1 -1
@@ -78,7 +78,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
78 if (envchanged)
79 *envchanged = 1;
80 } else if (!strcmp(cmd, "--no-replace-objects")) {
81 - read_replace_refs = 0;
81 + check_replace_refs = 0;
82 setenv(NO_REPLACE_OBJECTS_ENVIRONMENT, "1", 1);
83 if (envchanged)
84 *envchanged = 1;
log-tree.c
+1 -1
@@ -100,7 +100,7 @@ static int add_ref_decoration(const char *refname, const unsigned char *sha1, in
100
101 if (starts_with(refname, "refs/replace/")) {
102 unsigned char original_sha1[20];
103 - if (!read_replace_refs)
103 + if (!check_replace_refs)
104 return 0;
105 if (get_sha1_hex(refname + 13, original_sha1)) {
106 warning("invalid replace ref %s", refname);
replace_object.c
+1 -1
@@ -86,7 +86,7 @@ static void prepare_replace_object(void)
86 for_each_replace_ref(register_replace_ref, NULL);
87 replace_object_prepared = 1;
88 if (!replace_object_nr)
89 - read_replace_refs = 0;
89 + check_replace_refs = 0;
90 }
91
92 /* We allow "recursive" replacement. Only within reason, though */
upload-pack.c
+1 -1
@@ -796,7 +796,7 @@ int main(int argc, char **argv)
796
797 packet_trace_identity("upload-pack");
798 git_extract_argv0_path(argv[0]);
799 - read_replace_refs = 0;
799 + check_replace_refs = 0;
800
801 for (i = 1; i < argc; i++) {
802 char *arg = argv[i];