Skip to content

Commit

Permalink
Merge branch 'jh/maint-config-file-prefix' into maint
Browse files Browse the repository at this point in the history
* jh/maint-config-file-prefix:
  builtin-config: Fix crash when using "-f <relative path>" from non-root dir
  • Loading branch information
Junio C Hamano committed Feb 10, 2010
2 parents 2e9d733 + 65807ee commit b0e67ff
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion builtin-config.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ int cmd_config(int argc, const char **argv, const char *unused_prefix)
if (!is_absolute_path(given_config_file) && prefix)
config_exclusive_filename = prefix_filename(prefix,
strlen(prefix),
argv[2]);
given_config_file);
else
config_exclusive_filename = given_config_file;
}
Expand Down
11 changes: 11 additions & 0 deletions t/t1300-repo-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,17 @@ test_expect_success 'alternative GIT_CONFIG' 'cmp output expect'
test_expect_success 'alternative GIT_CONFIG (--file)' \
'git config --file other-config -l > output && cmp output expect'

test_expect_success 'refer config from subdirectory' '
mkdir x &&
(
cd x &&
echo strasse >expect
git config --get --file ../other-config ein.bahn >actual &&
test_cmp expect actual
)
'

GIT_CONFIG=other-config git config anwohner.park ausweis

cat > expect << EOF
Expand Down

0 comments on commit b0e67ff

Please sign in to comment.