]> git.ipfire.org Git - thirdparty/git.git/commitdiff
rename read_replace_refs to check_replace_refs
authorMichael Haggerty <mhagger@alum.mit.edu>
Tue, 18 Feb 2014 11:24:55 +0000 (12:24 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 20 Feb 2014 22:16:55 +0000 (14:16 -0800)
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>
12 files changed:
builtin/fsck.c
builtin/index-pack.c
builtin/pack-objects.c
builtin/prune.c
builtin/replace.c
builtin/unpack-objects.c
cache.h
environment.c
git.c
log-tree.c
replace_object.c
upload-pack.c

index 1affdd5e924c9e71605be603f253e34f6a995f36..3d42978a7ad309e6603eb36e9283be2c109920f5 100644 (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);
 
index 2f37a38fbcdf131ab5897e47728c5773ba36b861..a6b1c17996da28cef97560378e7586bbf1bd8b6b 100644 (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);
index 541667f1026d7ba62be8e029c31138d5661f65c7..124015d95ff3a31e8e03c29f2b60d5e38653710a 100644 (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);
index de43b26cfe9c7610c13e3320bdac9fa2049e4db6..68adc1c78afd291504e1c5044d0ef15057f8aed8 100644 (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);
index 2336325ce330f5268800a7bc949c066ce028852c..8b597756880b2fc65462178adc9069113aeb9820 100644 (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);
 
index 62ff673f68b48cc2147fc7f7b17dc5269da022bf..df2d3e3a7768b06560468be2644a3561506df7f9 100644 (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);
 
diff --git a/cache.h b/cache.h
index dc040fb1aa99b7970e85e5b175e60f862ff6a74a..b039abce0364736650aeec3d764c315aa3224008 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -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);
 }
index 4a3437d8a61256029655f25c76256f27a6189248..c3c860603da817b75d73bc446d03944e1963e874 100644 (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);
diff --git a/git.c b/git.c
index 7cf2953eff47ca91b9a134e2e810fea1fc53e386..9efd1a3ec1f2af63fe575f9c755dff685d9b1e51 100644 (file)
--- a/git.c
+++ b/git.c
@@ -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;
index 08970bf46e49f6447ada24e81e5792ea9f92f419..5ce217d5eba33a54419ac8b29223cc16aa1f905e 100644 (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);
index cdcaf8cbe2f4e6c7a5b334fc2c43da6855df4654..c5cf9f4467c46e841a9fe02a42e7272f77de2556 100644 (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 */
index 0c44f6b292563e7c87bce0b7b5d9b8a4ccd32ec3..9314c250ffd72ef44dd6b675e0f3592e3e283a04 100644 (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];