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/7] setup: skip core.worktree if GIT_DIR is not set
Date: Wed, 27 Oct 2010 21:58:13 +0700 [thread overview]
Message-ID: <1288191496-31176-4-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <1288190977-30875-1-git-send-email-pclouds@gmail.com>
---
setup.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/setup.c b/setup.c
index bbb430a..e8273c3 100644
--- a/setup.c
+++ b/setup.c
@@ -4,7 +4,7 @@
static int inside_git_dir = -1;
static int inside_work_tree = -1;
-static int has_core_worktree, has_core_bare;
+static int has_core_worktree, has_core_bare, has_git_dir_env;
const char *prefix_path(const char *prefix, int len, const char *path)
{
@@ -460,8 +460,10 @@ static const char *setup_git_directory_gently_1(int *nongit_ok)
* validation.
*/
gitdirenv = getenv(GIT_DIR_ENVIRONMENT);
- if (gitdirenv)
- return setup_explicit_git_dir(gitdirenv, work_tree_env, nongit_ok);
+ if (gitdirenv) {
+ has_git_dir_env = 1;
+ return setup_explicit_git_dir(gitdirenv, work_tree_env, nongit_o, nongit_ok);
+ }
else {
/* prevent get_git_work_tree() from using it because GIT_DIR is not set */
if (work_tree_env)
@@ -593,6 +595,8 @@ int check_repository_format_version(const char *var, const char *value, void *cb
has_core_bare = 1;
}
} else if (strcmp(var, "core.worktree") == 0) {
+ if (!has_git_dir_env) /* only valid when GIT_DIR is set */
+ return 0;
if (!value)
return config_error_nonbool(var);
free(git_work_tree_cfg);
--
1.7.0.2.445.gcbdb3
next prev parent reply other threads:[~2010-10-27 14:59 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-27 14:49 [PATCH 00/34] repo setup test cases Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 01/34] builtins: print setup info if repo is found Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 02/34] Add t1510 and basic rules that run repo setup Nguyễn Thái Ngọc Duy
2010-10-27 15:37 ` Nguyen Thai Ngoc Duy
2010-10-27 16:30 ` Jonathan Nieder
2010-10-28 0:16 ` Nguyen Thai Ngoc Duy
2010-10-27 14:49 ` [PATCH 03/34] t1510: setup case #0 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 04/34] t1510: setup case #1 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 05/34] t1510: setup case #2 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 06/34] t1510: setup case #3 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 07/34] t1510: setup case #4 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 08/34] t1510: setup case #5 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 09/34] t1510: setup case #6 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 10/34] t1510: setup case #7 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 11/34] t1510: setup case #8 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 12/34] t1510: setup case #9 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 13/34] t1510: setup case #10 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 14/34] t1510: setup case #11 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 15/34] t1510: setup case #12 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 16/34] t1510: setup case #13 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 17/34] t1510: setup case #14 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 18/34] t1510: setup case #15 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 19/34] t1510: setup case #16 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 20/34] t1510: setup case #17 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 21/34] t1510: setup case #18 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 22/34] t1510: setup case #19 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 23/34] t1510: setup case #20 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 24/34] t1510: setup case #21 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 25/34] t1510: setup case #22 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 26/34] t1510: setup case #23 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 27/34] t1510: setup case #24 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 28/34] t1510: setup case #25 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 29/34] t1510: setup case #26 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 30/34] t1510: setup case #27 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 31/34] t1510: setup case #28 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 32/34] t1510: setup case #29 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 33/34] t1510: setup case #30 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 34/34] t1510: setup case #31 Nguyễn Thái Ngọc Duy
2010-10-27 14:58 ` [PATCH 1/7] setup: support setting GIT_DIR=.git file Nguyễn Thái Ngọc Duy
2010-10-27 14:58 ` [PATCH 2/7] unset: discard GIT_WORK_TREE if GIT_DIR is not set Nguyễn Thái Ngọc Duy
2010-10-27 14:58 ` [PATCH 3/7] setup: do not allow core.{bare,worktree} set at the same time Nguyễn Thái Ngọc Duy
2010-10-27 14:58 ` Nguyễn Thái Ngọc Duy [this message]
2010-10-27 14:58 ` [PATCH 5/7] setup: rework core.worktree Nguyễn Thái Ngọc Duy
2010-10-27 14:58 ` [PATCH 6/7] get_git_work_tree: core.worktree relative to git_dir Nguyễn Thái Ngọc Duy
2010-10-27 14:58 ` [PATCH 7/7] new failures 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=1288191496-31176-4-git-send-email-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 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).