mirror of
https://github.com/git-for-windows/git.git
synced 2026-03-25 19:43:19 -05:00
setup: fix safe.directory key not being checked
It seems that nothing is ever checking to make sure the safe directories in the configs actually have the key safe.directory, so some unrelated config that has a value with a certain directory would also make it a safe directory. Signed-off-by: Matheus Valadares <me@m28.io> Signed-off-by: Derrick Stolee <derrickstolee@github.com>
This commit is contained in:
committed by
Derrick Stolee
parent
1bdb9e35c0
commit
5d60f3c4e1
3
setup.c
3
setup.c
@@ -1100,6 +1100,9 @@ static int safe_directory_cb(const char *key, const char *value, void *d)
|
||||
{
|
||||
struct safe_directory_data *data = d;
|
||||
|
||||
if (strcmp(key, "safe.directory"))
|
||||
return 0;
|
||||
|
||||
if (!value || !*value)
|
||||
data->is_safe = 0;
|
||||
else {
|
||||
|
||||
@@ -21,6 +21,11 @@ test_expect_success 'safe.directory does not match' '
|
||||
expect_rejected_dir
|
||||
'
|
||||
|
||||
test_expect_success 'path exist as different key' '
|
||||
git config --global foo.bar "$(pwd)" &&
|
||||
expect_rejected_dir
|
||||
'
|
||||
|
||||
test_expect_success 'safe.directory matches' '
|
||||
git config --global --add safe.directory "$(pwd)" &&
|
||||
git status
|
||||
|
||||
Reference in New Issue
Block a user