Skip to content

Commit 27382d0

Browse files
pcloudsgitster
authored andcommitted
config: use OPT_FILENAME()
Do not handle prefix directly. It's simpler to use OPT_FILENAME() instead. The other reason for doing this is because this code (where the deleted code is) will be factored out and called when "prefix" is not available. Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8f7c7f5 commit 27382d0

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

builtin/config.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ static struct option builtin_config_options[] = {
126126
OPT_BOOL(0, "system", &use_system_config, N_("use system config file")),
127127
OPT_BOOL(0, "local", &use_local_config, N_("use repository config file")),
128128
OPT_BOOL(0, "worktree", &use_worktree_config, N_("use per-worktree config file")),
129-
OPT_STRING('f', "file", &given_config_source.file, N_("file"), N_("use given config file")),
129+
OPT_FILENAME('f', "file", &given_config_source.file, N_("use given config file")),
130130
OPT_STRING(0, "blob", &given_config_source.blob, N_("blob-id"), N_("read config from given blob object")),
131131
OPT_GROUP(N_("Action")),
132132
OPT_BIT(0, "get", &actions, N_("get value: name [value-regex]"), ACTION_GET),
@@ -657,10 +657,6 @@ int cmd_config(int argc, const char **argv, const char *prefix)
657657
"extension worktreeConfig is enabled. "
658658
"Please read \"CONFIGURATION FILE\"\n"
659659
"section in \"git help worktree\" for details"));
660-
} else if (given_config_source.file) {
661-
if (!is_absolute_path(given_config_source.file) && prefix)
662-
given_config_source.file =
663-
prefix_filename(prefix, given_config_source.file);
664660
}
665661

666662
if (respect_includes_opt == -1)

0 commit comments

Comments
 (0)