]> git.ipfire.org Git - thirdparty/git.git/commit
init-db: remove unnecessary global variable
authorElijah Newren <newren@gmail.com>
Tue, 16 May 2023 06:33:42 +0000 (06:33 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 21 Jun 2023 18:14:34 +0000 (11:14 -0700)
commitc2f76965d0202a894c9491e0647b7834b58cd168
tree09c5d3e31213d73b66056857f13b0c49f3c31fec
parent0f7443bdc7284ad36e5d0cd8b2526e2123b8aa4f
init-db: remove unnecessary global variable

This commit was prompted by a desire to move the functions which
builtin/init-db.c and builtin/clone.c share out of the former file and
into setup.c.  One issue that made it difficult was the
init_is_bare_repository global variable.

init_is_bare_repository's sole use in life it to cache a value in
init_db(), and then be used in create_default_files().  This is a bit
odd since init_db() directly calls create_default_files(), and is the
only caller of that function.  Convert the global to a simple function
parameter instead.

(Of course, this doesn't fix the fact that this value is then ignored by
create_default_files(), as noted in a big TODO comment in that function,
but it at least includes no behavioral change other than getting rid of
a very questionable global variable.)

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/init-db.c