From: Johannes Sixt <j6t@kdbg.org>
To: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Cc: git@vger.kernel.org,
"João Carlos Mendes Luís" <jonny@jonny.eng.br>,
"Junio C Hamano" <gitster@pobox.com>
Subject: Re: [PATCH] Support working directory located at root
Date: Mon, 8 Feb 2010 22:29:41 +0100 [thread overview]
Message-ID: <201002082229.43024.j6t@kdbg.org> (raw)
In-Reply-To: <1265640810-6361-1-git-send-email-pclouds@gmail.com>
On Montag, 8. Februar 2010, Nguyễn Thái Ngọc Duy wrote:
> @@ -25,7 +25,7 @@ const char *prefix_path(const char *prefix, int len,
> const char *path) len = strlen(work_tree);
> total = strlen(sanitized) + 1;
> if (strncmp(sanitized, work_tree, len) ||
> - (sanitized[len] != '\0' && sanitized[len] != '/')) {
> + (len > 1 && sanitized[len] != '\0' && sanitized[len] != '/')) {
> error_out:
> die("'%s' is outside repository", orig);
> }
> @@ -403,7 +403,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
> if (!work_tree_env)
> inside_work_tree = 0;
> if (offset != len) {
> - cwd[offset] = '\0';
> + cwd[offset ? offset : 1] = '\0';
> set_git_dir(cwd);
> } else
> set_git_dir(".");
> @@ -427,6 +427,8 @@ const char *setup_git_directory_gently(int *nongit_ok)
> inside_git_dir = 0;
> if (!work_tree_env)
> inside_work_tree = 1;
> + if (offset == 0) /* reached root, set worktree to '/' */
> + offset = 1;
> git_work_tree_cfg = xstrndup(cwd, offset);
> if (check_repository_format_gently(nongit_ok))
> return NULL;
Does not work:
etc@master:1028> ~/Src/git/git/git add resolv.conf
fatal: pathspec 'tc/resolv.conf' did not match any files
I wonder how this works on Windows where we do not want to strip the slash
from C:/ either.
-- Hannes
next prev parent reply other threads:[~2010-02-08 21:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-08 14:53 [PATCH] Support working directory located at root Nguyễn Thái Ngọc Duy
2010-02-08 17:43 ` Junio C Hamano
2010-02-09 2:18 ` Nguyen Thai Ngoc Duy
2010-02-09 2:49 ` Nguyen Thai Ngoc Duy
2010-02-08 21:29 ` Johannes Sixt [this message]
-- strict thread matches above, loose matches on Subject: below --
2010-02-09 7:16 Johannes Sixt
2010-02-09 12:27 ` Nguyen Thai Ngoc 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=201002082229.43024.j6t@kdbg.org \
--to=j6t@kdbg.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jonny@jonny.eng.br \
--cc=pclouds@gmail.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).