Files
Patrick Steinhardt 35b22101a8 refs: create leading directories
Both the "files" and "reftable" backends accept a payload that allows
the user to use a non-default location for their files. So e.g. if the
user specifies "files://refdir" as the ref storage format, then we would
put files into ".git/refdir/refs" instead of ".git/refs".

Using this is somewhat unwieldy though, as the directory must exist
before we create the ref storage as we'd otherwise die. This isn't that
bad in the case where the user specifies an absolute path that is
outside of the repository. But it becomes quite weird when asked to
create the directory relative to commondir, as the user would first have
to "mkdir -p repo/.git/refdir".

Adapt the reference backends to create leading directories. Note that we
use the `noshare()` variant for this because it's very much possible
that it will exist outside of the repository, and if so we shouldn't
adapt permissions on such leading directories.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-11-06 10:54:34 -08:00
..
2026-02-23 13:21:18 -08:00