From: Nguyen Thai Ngoc Duy <pclouds@gmail.com>
To: "Lars R. Damerow" <lars@pixar.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/2] Add support for GIT_ONE_FILESYSTEM
Date: Wed, 17 Mar 2010 07:45:50 +0700 [thread overview]
Message-ID: <fcaeb9bf1003161745j17d13a8dv248d169276777c8a@mail.gmail.com> (raw)
In-Reply-To: <1268777101-22122-3-git-send-email-lars@pixar.com>
On 3/17/10, Lars R. Damerow <lars@pixar.com> wrote:
> @@ -422,6 +429,14 @@ const char *setup_git_directory_gently(int *nongit_ok)
> }
> die("Not a git repository (or any of the parent directories): %s", DEFAULT_GIT_DIR_ENVIRONMENT);
> }
> + if (one_filesystem) {
> + if (stat("..", &buf))
> + die_errno("failed to stat '%s/..'", getcwd(err_cwd, sizeof(err_cwd)-1));
> + if (buf.st_dev != current_device)
> + die("Not a git repository (or any parent up to %s/..)\n"
> + "Stopping at filesystem boundary since GIT_ONE_FILESYSTEM is set.",
> + getcwd(err_cwd, sizeof(err_cwd)-1));
> + }
> if (chdir(".."))
> die_errno("Cannot change to '%s/..'", cwd);
> }
It should not die() if nongit_ok != NULL (gentle mode). Maybe
something like this on top:
diff --git a/setup.c b/setup.c
index 500c03e..625fb35 100644
--- a/setup.c
+++ b/setup.c
@@ -499,10 +499,17 @@ static const char
*setup_git_directory_gently_1(int *nongit_ok)
if (one_filesystem) {
if (stat("..", &buf))
die_errno("failed to stat '%s/..'", getcwd(err_cwd, sizeof(err_cwd)-1));
- if (buf.st_dev != current_device)
+ if (buf.st_dev != current_device) {
+ if (nongit_ok) {
+ if (chdir(cwd))
+ die_errno("Cannot come back to cwd");
+ *nongit_ok = 1;
+ return NULL;
+ }
die("Not a git repository (or any parent up to %s/..)\n"
"Stopping at filesystem boundary since GIT_ONE_FILESYSTEM is set.",
getcwd(err_cwd, sizeof(err_cwd)-1));
+ }
}
if (chdir(".."))
die_errno("Cannot change to '%s/..'", cwd);
Another thing. Is err_cwd needed? I think "cwd" can be used, like
die_errno("Cannot change to %s/..", cwd) above. Hmm.. that die_errno
needs "cwd[offset] = '\0';" first. Maybe you can fix it too ;-)
--
Duy
next prev parent reply other threads:[~2010-03-17 0:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-16 22:04 [PATCH 0/2] Add support for GIT_ONE_FILESYSTEM (resubmission) Lars R. Damerow
2010-03-16 22:05 ` [PATCH 1/2] config.c: remove static keyword from git_env_bool() Lars R. Damerow
2010-03-16 22:05 ` [PATCH 2/2] Add support for GIT_ONE_FILESYSTEM Lars R. Damerow
2010-03-17 0:45 ` Nguyen Thai Ngoc Duy [this message]
2010-03-17 7:09 ` Johannes Sixt
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=fcaeb9bf1003161745j17d13a8dv248d169276777c8a@mail.gmail.com \
--to=pclouds@gmail.com \
--cc=git@vger.kernel.org \
--cc=lars@pixar.com \
/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).