Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'replace-object.c')
-rw-r--r--replace-object.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/replace-object.c b/replace-object.c
index 07cfedd6df..ae2d55b014 100644
--- a/replace-object.c
+++ b/replace-object.c
@@ -64,7 +64,7 @@ void prepare_replace_object(struct repository *r)
* replacement object's name (replaced recursively, if necessary).
* The return value is either oid or a pointer to a
* permanently-allocated value. This function always respects replace
- * references, regardless of the value of read_replace_refs.
+ * references, regardless of the value of r->settings.read_replace_refs.
*/
const struct object_id *do_lookup_replace_object(struct repository *r,
const struct object_id *oid)
@@ -85,6 +85,13 @@ const struct object_id *do_lookup_replace_object(struct repository *r,
die(_("replace depth too high for object %s"), oid_to_hex(oid));
}
+/*
+ * This indicator determines whether replace references should be
+ * respected process-wide, regardless of which repository is being
+ * using at the time.
+ */
+static int read_replace_refs = 1;
+
void disable_replace_refs(void)
{
read_replace_refs = 0;
@@ -92,5 +99,14 @@ void disable_replace_refs(void)
int replace_refs_enabled(struct repository *r)
{
- return read_replace_refs;
+ if (!read_replace_refs)
+ return 0;
+
+ if (r->gitdir) {
+ prepare_repo_settings(r);
+ return r->settings.read_replace_refs;
+ }
+
+ /* repository has no objects or refs. */
+ return 0;
}