All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 4/6] config: use OPT_FILENAME()
Date: Thu, 27 Dec 2018 16:56:09 +0100	[thread overview]
Message-ID: <20181227155611.10585-5-pclouds@gmail.com> (raw)
In-Reply-To: <20181227155611.10585-1-pclouds@gmail.com>

Do not handle prefix directly. It's simpler to use OPT_FILENAME()
instead. The othe 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 <pclouds@gmail.com>
---
 builtin/config.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/builtin/config.c b/builtin/config.c
index 771cfa54bd..c22d25de12 100644
--- a/builtin/config.c
+++ b/builtin/config.c
@@ -126,7 +126,7 @@ static struct option builtin_config_options[] = {
 	OPT_BOOL(0, "system", &use_system_config, N_("use system config file")),
 	OPT_BOOL(0, "local", &use_local_config, N_("use repository config file")),
 	OPT_BOOL(0, "worktree", &use_worktree_config, N_("use per-worktree config file")),
-	OPT_STRING('f', "file", &given_config_source.file, N_("file"), N_("use given config file")),
+	OPT_FILENAME('f', "file", &given_config_source.file, N_("use given config file")),
 	OPT_STRING(0, "blob", &given_config_source.blob, N_("blob-id"), N_("read config from given blob object")),
 	OPT_GROUP(N_("Action")),
 	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)
 			      "extension worktreeConfig is enabled. "
 			      "Please read \"CONFIGURATION FILE\"\n"
 			      "section in \"git help worktree\" for details"));
-	} else if (given_config_source.file) {
-		if (!is_absolute_path(given_config_source.file) && prefix)
-			given_config_source.file =
-				prefix_filename(prefix, given_config_source.file);
 	}
 
 	if (respect_includes_opt == -1)
-- 
2.20.0.482.g66447595a7


  parent reply	other threads:[~2018-12-27 15:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-27 15:56 [PATCH 0/6] Add "git config --move-to" Nguyễn Thái Ngọc Duy
2018-12-27 15:56 ` [PATCH 1/6] config.c: avoid git_path() in do_git_config_sequence() Nguyễn Thái Ngọc Duy
2019-01-10 21:38   ` Junio C Hamano
2018-12-27 15:56 ` [PATCH 2/6] worktree.c: add get_worktree_config() Nguyễn Thái Ngọc Duy
2018-12-27 20:36   ` Eric Sunshine
2018-12-27 15:56 ` [PATCH 3/6] config.c: add repo_config_set_worktree_gently() Nguyễn Thái Ngọc Duy
2019-04-30 16:40   ` Derrick Stolee
2019-05-01  9:55     ` Duy Nguyen
2018-12-27 15:56 ` Nguyễn Thái Ngọc Duy [this message]
2018-12-27 20:40   ` [PATCH 4/6] config: use OPT_FILENAME() Eric Sunshine
2018-12-27 15:56 ` [PATCH 5/6] config: factor out set_config_source_file() Nguyễn Thái Ngọc Duy
2018-12-27 15:56 ` [PATCH 6/6] config: add --move-to Nguyễn Thái Ngọc Duy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181227155611.10585-5-pclouds@gmail.com \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.