From: Jeff King <peff@peff.net>
To: Cedric Gava <gava.c@free.fr>
Cc: git@vger.kernel.org
Subject: Re: Forcing git top-level
Date: Tue, 31 Mar 2015 14:15:52 -0400 [thread overview]
Message-ID: <20150331181552.GC19206@peff.net> (raw)
In-Reply-To: <0FD999DB-3DBF-40D4-8128-715BDC49EAAB@free.fr>
On Tue, Mar 31, 2015 at 11:25:58AM +0200, Cedric Gava wrote:
> I’ve copied a .git folder located at the root (/) of a filesystem,
> into another directory (/home/mydir). If I issue a git rev-parse
> —show-toplevel I got "/"...
> I would like to change the top-level to point to /home/mydir.
Try running "git config --unset core.worktree" in the .git dir.
It looks like "git init" will write a core.worktree entry in this case,
even though it isn't technically needed. I think it is due to these
lines in builtin/init-db.c:
if (!starts_with(git_dir, work_tree) ||
strcmp(git_dir + strlen(work_tree), "/.git")) {
git_config_set("core.worktree", work_tree);
}
The check returns a false positive for the root directory because we
only have one slash (i.e., appending "/.git" to our worktree would be
"//.git" in this case).
-Peff
next prev parent reply other threads:[~2015-03-31 18:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-31 9:25 Forcing git top-level Cedric Gava
2015-03-31 18:15 ` Jeff King [this message]
2015-03-31 18:34 ` [PATCH] init: don't set core.worktree when initializing /.git Jeff King
2015-03-31 19:14 ` Jonathan Nieder
2015-04-02 18:37 ` [PATCH v2] " Jeff King
2015-04-02 18:49 ` Jonathan Nieder
2015-04-03 10:08 ` [PATCH] t1509: update prepare script to be able to run t1509 in chroot again Nguyễn Thái Ngọc Duy
2015-04-03 12:01 ` Jeff King
2015-04-03 12:14 ` Duy Nguyen
2015-04-11 19:58 ` Junio C Hamano
2015-04-18 11:22 ` [PATCH v2] " 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=20150331181552.GC19206@peff.net \
--to=peff@peff.net \
--cc=gava.c@free.fr \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.