My ASAP is not so ASAP. Sorry about that but I think I have fixed it.
Side note about 2/3. I've known this problem (in general) for years
(accidentally reading .git config file before .git is searched) and
could not do anything about it. And because test_expect_failure should
only be there if someone will eventually fix it, and I don't see
myself doing it, and I don't see it super important that other people
would bother, so I decided to simply sweep it under the rug. I could
make a test_expect_failure if people think otherwise.
Side note about 3/3. Yes there's a FIXME in there. It will take a lot
more time to remove that FIXME (because setup_git_directory is not as
simple). For now it should be ok to leave it there. When we find a use
for get_first_git_dir outside git-init, we can fix it then.
Nguyễn Thái Ngọc Duy (3):
init: correct re-initialization from a linked worktree
t0001: work around the bug that reads config file before repo setup
init: do not set core.worktree more often than necessary
builtin/init-db.c | 4 ++--
cache.h | 1 +
environment.c | 16 +++++++++++++++-
t/t0001-init.sh | 19 +++++++++++++++++++
4 files changed, 37 insertions(+), 3 deletions(-)