[PATCH] Rename read_replace_refs to check_replace_refs

2014-02-18 Thread Michael Haggerty
The semantics of this flag was changed in commit

ecef23 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 mhag...@alum.mit.edu
---
This change doesn't conflict with anything in pu; perhaps we can
squeeze it in now?

 builtin/fsck.c   |  2 +-
 builtin/index-pack.c |  2 +-
 builtin/pack-objects.c   |  2 +-
 builtin/prune.c  |  2 +-
 builtin/replace.c|  2 +-
 builtin/unpack-objects.c |  2 +-
 cache.h  | 14 --
 environment.c|  4 ++--
 git.c|  2 +-
 log-tree.c   |  2 +-
 replace_object.c |  2 +-
 upload-pack.c|  2 +-
 12 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/builtin/fsck.c b/builtin/fsck.c
index 1affdd5..3d42978 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -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);
 
diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index 2f37a38..a6b1c17 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -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);
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 541667f..124015d 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -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);
diff --git a/builtin/prune.c b/builtin/prune.c
index de43b26..68adc1c 100644
--- a/builtin/prune.c
+++ b/builtin/prune.c
@@ -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);
diff --git a/builtin/replace.c b/builtin/replace.c
index 2336325..8b59775 100644
--- a/builtin/replace.c
+++ b/builtin/replace.c
@@ -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);
 
diff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c
index 62ff673..df2d3e3 100644
--- a/builtin/unpack-objects.c
+++ b/builtin/unpack-objects.c
@@ -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 dc040fb..b039abc 100644
--- 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);
 }
diff --git a/environment.c b/environment.c
index 4a3437d..c3c8606 100644
--- a/environment.c
+++ b/environment.c
@@ -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 

Re: [PATCH] Rename read_replace_refs to check_replace_refs

2014-02-18 Thread Junio C Hamano
Michael Haggerty mhag...@alum.mit.edu writes:

 The semantics of this flag was changed in commit

 ecef23 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 mhag...@alum.mit.edu
 ---
 This change doesn't conflict with anything in pu; perhaps we can
 squeeze it in now?

I think it is a good time to do this kind of clean-up once the
post-release dusts settle.

Thanks.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html