]> Kevux Git Server - rit/commit
refs: add GIT_REFERENCE_BACKEND to specify reference backend
authorKarthik Nayak <karthik.188@gmail.com>
Wed, 25 Feb 2026 09:40:46 +0000 (10:40 +0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 25 Feb 2026 17:40:00 +0000 (09:40 -0800)
commit53592d68e86814fcc4a8df6cc38340597e56fe5a
treeba40af5ae430ea79abd4f1898562c736f4f408b9
parent01dc84594ee365ee7086fccc7f590ab527730531
refs: add GIT_REFERENCE_BACKEND to specify reference backend

Git allows setting a different object directory via
'GIT_OBJECT_DIRECTORY', but provides no equivalent for references. In
the previous commit we extended the 'extensions.refStorage' config to
also support an URI input for reference backend with location.

Let's also add a new environment variable 'GIT_REFERENCE_BACKEND' that
takes in the same input as the config variable. Having an environment
variable allows us to modify the reference backend and location on the
fly for individual Git commands.

The environment variable also allows usage of alternate reference
directories during 'git-clone(1)' and 'git-init(1)'. Add the config to
the repository when created with the environment variable set.

When initializing the repository with an alternate reference folder,
create the required stubs in the repositories $GIT_DIR. The inverse,
i.e. removal of the ref store doesn't clean up the stubs in the $GIT_DIR
since that would render it unusable. Removal of ref store is only used
when migrating between ref formats and cleanup of the $GIT_DIR doesn't
make sense in such a situation.

Helped-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git.adoc
environment.h
refs.c
setup.c
t/t1423-ref-backend.sh