@@ -581,7 +581,17 @@ extern size_t packed_git_limit;
581
581
extern size_t delta_base_cache_limit ;
582
582
extern unsigned long big_file_threshold ;
583
583
extern unsigned long pack_size_limit_cfg ;
584
- extern int read_replace_refs ;
584
+
585
+ /*
586
+ * Do replace refs need to be checked this run? This variable is
587
+ * initialized to true unless --no-replace-object is used or
588
+ * $GIT_NO_REPLACE_OBJECTS is set, but is set to false by some
589
+ * commands that do not want replace references to be active. As an
590
+ * optimization it is also set to false if replace references have
591
+ * been sought but there were none.
592
+ */
593
+ extern int check_replace_refs ;
594
+
585
595
extern int fsync_object_files ;
586
596
extern int core_preload_index ;
587
597
extern int core_apply_sparse_checkout ;
@@ -808,13 +818,26 @@ static inline void *read_sha1_file(const unsigned char *sha1, enum object_type *
808
818
{
809
819
return read_sha1_file_extended (sha1 , type , size , LOOKUP_REPLACE_OBJECT );
810
820
}
821
+
822
+ /*
823
+ * This internal function is only declared here for the benefit of
824
+ * lookup_replace_object(). Please do not call it directly.
825
+ */
811
826
extern const unsigned char * do_lookup_replace_object (const unsigned char * sha1 );
827
+
828
+ /*
829
+ * If object sha1 should be replaced, return the replacement object's
830
+ * name (replaced recursively, if necessary). The return value is
831
+ * either sha1 or a pointer to a permanently-allocated value. When
832
+ * object replacement is suppressed, always return sha1.
833
+ */
812
834
static inline const unsigned char * lookup_replace_object (const unsigned char * sha1 )
813
835
{
814
- if (!read_replace_refs )
836
+ if (!check_replace_refs )
815
837
return sha1 ;
816
838
return do_lookup_replace_object (sha1 );
817
839
}
840
+
818
841
static inline const unsigned char * lookup_replace_object_extended (const unsigned char * sha1 , unsigned flag )
819
842
{
820
843
if (!(flag & LOOKUP_REPLACE_OBJECT ))
0 commit comments