Fix breakage when git is configured with safe.bareRepository = explicit

Running git config --list inside .git then fails, so better to only
do that when --git-dir was specified explicitly. Otherwise, when the
repository is not bare, run the command inside the working tree.

Also make init detect when the uuid it just set cannot be read and fail
with an error, in case git changes something that breaks this later.

I still don't actually understand why git-annex add/assist -J2 was
affected but -J1 was not. But I did show that it was skipping writing to
the location log, because the uuid was NoUUID.

Sponsored-by: Graham Spencer on Patreon
This commit is contained in:
Joey Hess 2023-07-05 14:43:02 -04:00
parent 321681cd1b
commit a05bc6a314
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 22 additions and 15 deletions

View file

@ -13,8 +13,9 @@ The breakage starts with git-annex init:
+ joey@darkstar:~/tmp/g timestamp=1688579729.946567508s
uuid.log has a NoUUID item logged to it. This is despite annex.uuid being set.
10.20230407 --[[Joey]]
And it seems this is because git-annex runs `git config --list`
This is because git-annex runs `git config --list`
inside `.git`.. Which with that config set, omits looking at
`config`.
`config` because it thinks it's in a bare repository.
> [[fixed|done]] --[[Joey]]