summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 60fcc2e)
raw | patch | inline | side by side (parent: 60fcc2e)
author | Gerrit Pape <pape@smarden.org> | |
Fri, 12 Oct 2007 11:32:51 +0000 (11:32 +0000) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Tue, 16 Oct 2007 01:07:38 +0000 (21:07 -0400) |
When calling git-config not from the top level directory of a repository,
it changes directory before trying to open the config file specified
through the --file option, which then fails if the config file was
specified by a relative pathname. This patch adjusts the pathname to
the config file if applicable.
The problem was noticed by Joey Hess, reported through
http://bugs.debian.org/445208
Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
it changes directory before trying to open the config file specified
through the --file option, which then fails if the config file was
specified by a relative pathname. This patch adjusts the pathname to
the config file if applicable.
The problem was noticed by Joey Hess, reported through
http://bugs.debian.org/445208
Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
builtin-config.c | patch | blob | history |
diff --git a/builtin-config.c b/builtin-config.c
index cb7e9e9391e33073efcf39f432acb760994244e8..d98b6c2c4cbbec367e498d33c5f670709dcac893 100644 (file)
--- a/builtin-config.c
+++ b/builtin-config.c
{
int nongit = 0;
char* value;
- setup_git_directory_gently(&nongit);
+ const char *file = setup_git_directory_gently(&nongit);
while (1 < argc) {
if (!strcmp(argv[1], "--int"))
else if (!strcmp(argv[1], "--file") || !strcmp(argv[1], "-f")) {
if (argc < 3)
usage(git_config_set_usage);
- setenv(CONFIG_ENVIRONMENT, argv[2], 1);
+ if (!is_absolute_path(argv[2]) && file)
+ file = prefix_filename(file, strlen(file),
+ argv[2]);
+ else
+ file = argv[2];
+ setenv(CONFIG_ENVIRONMENT, file, 1);
argc--;
argv++;
}