From: Duy Nguyen <pclouds@gmail.com>
To: Max Kirillov <max@max630.net>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
Jens.Lehmann@web.de
Subject: Re: [PATCH v3] config.c: split some variables to $GIT_DIR/config.worktree
Date: Sat, 18 Apr 2015 18:10:23 +0700 [thread overview]
Message-ID: <20150418111023.GA1496@lanh> (raw)
In-Reply-To: <20150413233739.GA786@wheezy.local>
On Tue, Apr 14, 2015 at 02:37:39AM +0300, Max Kirillov wrote:
> On Tue, Mar 31, 2015 at 07:14:39PM +0700, Nguyễn Thái Ngọc Duy wrote:
> > core.worktree and core.bare, which are treated specially in 31e26eb [1],
> > are now moved to info/core.worktree and the special treatment reverted.
> <...>
> > - if (get_common_dir(&sb, gitdir))
> > - fn = check_repo_format;
> > - else
> > - fn = check_repository_format_version;
>
> By the way, after this '$GIT_DIR/common overrides core.worktree'
> from t1501 started failing. I don't know what would be
> better to do with the case, just remove maybe?
I think that test spots a real problem. In this function, I ignore the
config split when I pass NULL as worktree_config to git_config_early().
Something like this should fix it.
-- 8< --
diff --git a/setup.c b/setup.c
index 61e0403..4799e7d 100644
--- a/setup.c
+++ b/setup.c
@@ -355,10 +355,15 @@ static int check_repo_format(const char *var, const char *value, void *cb)
static int check_repository_format_gently(const char *gitdir, int *nongit_ok)
{
struct strbuf sb = STRBUF_INIT;
+ struct strbuf sb_wt = STRBUF_INIT;
const char *repo_config;
+ const char *worktree_config = NULL;
int ret = 0;
- get_common_dir(&sb, gitdir);
+ if (get_common_dir(&sb, gitdir)) {
+ strbuf_addf(&sb_wt, "%s/config.worktree", get_git_dir());
+ worktree_config = sb_wt.buf;
+ }
strbuf_addstr(&sb, "/config");
repo_config = sb.buf;
@@ -371,7 +376,8 @@ static int check_repository_format_gently(const char *gitdir, int *nongit_ok)
* Use a gentler version of git_config() to check if this repo
* is a good one.
*/
- git_config_early(check_repository_format_version, NULL, repo_config, NULL);
+ git_config_early(check_repository_format_version, NULL,
+ repo_config, worktree_config);
if (GIT_REPO_VERSION < repository_format_version) {
if (!nongit_ok)
die ("Expected git repo version <= %d, found %d",
@@ -383,6 +389,7 @@ static int check_repository_format_gently(const char *gitdir, int *nongit_ok)
ret = -1;
}
strbuf_release(&sb);
+ strbuf_release(&sb_wt);
return ret;
}
-- 8< --
next prev parent reply other threads:[~2015-04-18 11:10 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-08 13:16 [PATCH/RFD 0/3] worktree.* config keys and submodule and multiple worktrees Nguyễn Thái Ngọc Duy
2015-02-08 13:16 ` [PATCH 1/3] config.c: new config namespace worktree.* stored in $GIT_DIR/config.worktree Nguyễn Thái Ngọc Duy
2015-02-08 13:16 ` [PATCH 2/3] setup: add worktree.path to shadow core.worktree Nguyễn Thái Ngọc Duy
2015-02-08 13:16 ` [PATCH 3/3] submodule: use worktree.path instead of core.worktree Nguyễn Thái Ngọc Duy
2015-02-08 17:36 ` [PATCH/RFD 0/3] worktree.* config keys and submodule and multiple worktrees Jens Lehmann
2015-02-08 17:41 ` Jens Lehmann
2015-02-09 9:35 ` Duy Nguyen
2015-03-18 21:33 ` per-repository and per-worktree config variables Max Kirillov
2015-03-24 13:48 ` Duy Nguyen
2015-03-26 12:04 ` [PATCH v2] config.c: split some variables to $GIT_DIR/config.worktree Nguyễn Thái Ngọc Duy
2015-03-26 22:19 ` Max Kirillov
2015-03-29 1:25 ` Duy Nguyen
2015-03-30 21:26 ` Max Kirillov
2015-03-31 12:14 ` [PATCH v3] " Nguyễn Thái Ngọc Duy
2015-03-31 12:17 ` Duy Nguyen
2015-04-01 20:56 ` Max Kirillov
2015-04-03 10:30 ` Duy Nguyen
2015-04-13 23:37 ` Max Kirillov
2015-04-18 11:10 ` Duy Nguyen [this message]
2015-04-20 2:51 ` Max Kirillov
2015-04-20 3:22 ` Duy Nguyen
2015-03-25 21:33 ` per-repository and per-worktree config variables Jens Lehmann
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=20150418111023.GA1496@lanh \
--to=pclouds@gmail.com \
--cc=Jens.Lehmann@web.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=max@max630.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).