summaryrefslogtreecommitdiff
path: root/builtin-config.c
diff options
context:
space:
mode:
authorJohan Herland <johan@herland.net>2010-01-26 15:02:16 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-01-26 19:20:06 (GMT)
commit65807ee697a28cb30b8ad38ebb8b84cebd3f255d (patch)
tree72a223d1ca8f37f463c7f21e61b92504c924f151 /builtin-config.c
parente276f018f2c1f0fc962fbe44a36708d1cdebada8 (diff)
downloadgit-65807ee697a28cb30b8ad38ebb8b84cebd3f255d.zip
git-65807ee697a28cb30b8ad38ebb8b84cebd3f255d.tar.gz
git-65807ee697a28cb30b8ad38ebb8b84cebd3f255d.tar.bz2
builtin-config: Fix crash when using "-f <relative path>" from non-root dir
When your current directory is not at the root of the working tree, and you use the "-f" option with a relative path, the current code tries to read from a wrong file, since argv[2] is now beyond the end of the rearranged argument list. This patch replaces the incorrect argv[2] with the variable holding the given config file name. The bug was introduced by d64ec16 (git config: reorganize to use parseopt). [jc: added test] Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-config.c')
-rw-r--r--builtin-config.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin-config.c b/builtin-config.c
index a81bc8b..5a5d214 100644
--- a/builtin-config.c
+++ b/builtin-config.c
@@ -339,7 +339,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;
}