Re: [PATCH v3 17/25] setup.c: detect $GIT_COMMON_DIR check_repository_format_gently()
Duy Nguyen pclo...@gmail.com writes: On Thu, Feb 27, 2014 at 7:22 AM, Junio C Hamano gits...@pobox.com wrote: Nguyễn Thái Ngọc Duy pclo...@gmail.com writes: Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- It is a good thing to do to read config from the real repository we are borrowing from when we have .git/commondir, but it makes me wonder if we should signal some kind of error if we find .git/config in such a borrowing repository---which will be silently ignored. My gut feeling is that such a check may be necessary, but may not belong to this function. Just checking. Once we do this, what about .git/refs/.. that is also ignored in such a repo? It was just that I became aware of the issue while reading this patch to check-repository-format which is only about config, but anything inside .git/ of the borrowing repository that are ignored because it has .git/common-dir (including .git/refs) should be a cause of the same error, I would say. That would be the same set as symlinks created by contrib/workdir/git-new-workdir script. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 17/25] setup.c: detect $GIT_COMMON_DIR check_repository_format_gently()
Nguyễn Thái Ngọc Duy pclo...@gmail.com writes: Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- It is a good thing to do to read config from the real repository we are borrowing from when we have .git/commondir, but it makes me wonder if we should signal some kind of error if we find .git/config in such a borrowing repository---which will be silently ignored. My gut feeling is that such a check may be necessary, but may not belong to this function. setup.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/setup.c b/setup.c index 282fdc9..e56ec11 100644 --- a/setup.c +++ b/setup.c @@ -285,6 +285,10 @@ static int check_repository_format_gently(const char *gitdir, int *nongit_ok) const char *repo_config; int ret = 0; + get_common_dir(sb, gitdir); + strbuf_addstr(sb, /config); + repo_config = sb.buf; + /* * git_config() can't be used here because it calls git_pathdup() * to get $GIT_CONFIG/config. That call will make setup_git_env() @@ -294,8 +298,6 @@ 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. */ - strbuf_addf(sb, %s/config, gitdir); - repo_config = sb.buf; git_config_early(check_repository_format_version, NULL, repo_config); if (GIT_REPO_VERSION repository_format_version) { if (!nongit_ok) -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 17/25] setup.c: detect $GIT_COMMON_DIR check_repository_format_gently()
On Thu, Feb 27, 2014 at 7:22 AM, Junio C Hamano gits...@pobox.com wrote: Nguyễn Thái Ngọc Duy pclo...@gmail.com writes: Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- It is a good thing to do to read config from the real repository we are borrowing from when we have .git/commondir, but it makes me wonder if we should signal some kind of error if we find .git/config in such a borrowing repository---which will be silently ignored. My gut feeling is that such a check may be necessary, but may not belong to this function. Just checking. Once we do this, what about .git/refs/.. that is also ignored in such a repo? I can see the point that config could be manually edited so the user may edit the file at the wrong place, so it's good the we catch this exception. -- Duy -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 17/25] setup.c: detect $GIT_COMMON_DIR check_repository_format_gently()
Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- setup.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/setup.c b/setup.c index 282fdc9..e56ec11 100644 --- a/setup.c +++ b/setup.c @@ -285,6 +285,10 @@ static int check_repository_format_gently(const char *gitdir, int *nongit_ok) const char *repo_config; int ret = 0; + get_common_dir(sb, gitdir); + strbuf_addstr(sb, /config); + repo_config = sb.buf; + /* * git_config() can't be used here because it calls git_pathdup() * to get $GIT_CONFIG/config. That call will make setup_git_env() @@ -294,8 +298,6 @@ 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. */ - strbuf_addf(sb, %s/config, gitdir); - repo_config = sb.buf; git_config_early(check_repository_format_version, NULL, repo_config); if (GIT_REPO_VERSION repository_format_version) { if (!nongit_ok) -- 1.8.5.2.240.g8478abd -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html