aboutsummaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-03-14 14:27:06 -0700
committerJunio C Hamano <gitster@pobox.com>2014-03-14 14:27:06 -0700
commit3e30cb0fbf83fd35c70e9697ba8871420d9fed0a (patch)
tree340fcafc69da5a6d361f18c31ac0454595da1015 /cache.h
parentd552f8df1b2749b58e386dff98027c64f35cdbd1 (diff)
parent33bef7ea256e620c579aeff0e672b0becc79c75c (diff)
downloadgit-3e30cb0fbf83fd35c70e9697ba8871420d9fed0a.tar.gz
git-3e30cb0fbf83fd35c70e9697ba8871420d9fed0a.tar.xz
Merge branch 'mh/replace-refs-variable-rename'
* mh/replace-refs-variable-rename: Document some functions defined in object.c Add docstrings for lookup_replace_object() and do_lookup_replace_object() rename read_replace_refs to check_replace_refs
Diffstat (limited to 'cache.h')
-rw-r--r--cache.h27
1 files changed, 25 insertions, 2 deletions
diff --git a/cache.h b/cache.h
index 00ba6bf08..b66cb49b7 100644
--- a/cache.h
+++ b/cache.h
@@ -581,7 +581,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;
@@ -808,13 +818,26 @@ static inline void *read_sha1_file(const unsigned char *sha1, enum object_type *
{
return read_sha1_file_extended(sha1, type, size, LOOKUP_REPLACE_OBJECT);
}
+
+/*
+ * This internal function is only declared here for the benefit of
+ * lookup_replace_object(). Please do not call it directly.
+ */
extern const unsigned char *do_lookup_replace_object(const unsigned char *sha1);
+
+/*
+ * If object sha1 should be replaced, return the replacement object's
+ * name (replaced recursively, if necessary). The return value is
+ * either sha1 or a pointer to a permanently-allocated value. When
+ * object replacement is suppressed, always return 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);
}
+
static inline const unsigned char *lookup_replace_object_extended(const unsigned char *sha1, unsigned flag)
{
if (!(flag & LOOKUP_REPLACE_OBJECT))