safe.directory: use git_protected_config()
commit6061601d9f1f1c95da5f9304c319218f7cc3ec75
authorGlen Choo <chooglen@google.com>
Thu, 14 Jul 2022 21:28:00 +0000 (14 21:28 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 14 Jul 2022 22:08:29 +0000 (14 15:08 -0700)
tree34511fef78126c405e81fbc6d170f672ae4505ab
parent5b3c650777547f2274540a036da641651fb866b0
safe.directory: use git_protected_config()

Use git_protected_config() to read `safe.directory` instead of
read_very_early_config(), making it 'protected configuration only'.

As a result, `safe.directory` now respects "-c", so update the tests and
docs accordingly. It used to ignore "-c" due to how it was implemented,
not because of security or correctness concerns [1].

[1] https://lore.kernel.org/git/xmqqlevabcsu.fsf@gitster.g/

Signed-off-by: Glen Choo <chooglen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/config/safe.txt
setup.c
t/t0033-safe-directory.sh