Re: .git ignored regardless of --git-dir value

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: .git ignored regardless of --git-dir value

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:52:30

Junio C Hamano [off-list ref] writes:
Shawn Ferris [off-list ref] writes:
quoted
Is it expected behavior to have the .git directory ignored, even after
specifying an alternate location with --git-dir? For example:

$ git --git-dir=.foo init
Initialized empty Git repository in /home/sferris/work/t/.foo/
GIT_DIR and --git-dir are meant to refer to a different .git dir (or a
bare-looking repository) located elsewhere, and not for a random pathname
like ".foo". No matter what, ".git/" anywhere is ignored from very early
days of Git, as Linus himself writes in the source, e.g. 8695c8b (Add
"show-files" command to show the list of managed (or non-managed) files.,
2005-04-11):

 ...
 * Also, we currently ignore all names starting with a dot.
 * That likely will not change. 
 ...
Sorry, but the above quote is wrong.  The correct one is from 453ec4b
(libify git-ls-files directory traversal, 2006-05-16), and survives to
this day in dir.c:

 ...
 * Read a directory tree. We currently ignore anything but
 * directories, regular files and symlinks. That's because git
 * doesn't handle them at all yet. Maybe that will change some
 * day.
 *
 * Also, we ignore the name ".git" (even if it is not a directory).
 * That likely will not change.
 ...

In other words, originally we ignored all names starting with a dot and
declared that likely will not change, but then loosened the rule to let
people manage their .bashrc and friends. But ".git" is still special, and
that likely will not change.

Re: .git ignored regardless of --git-dir value

From: Shawn Ferris <hidden>
Date: 2016-06-15 22:52:30

On Fri, Nov 18, 2011 at 3:47 PM, Junio C Hamano [off-list ref] wrote:
Junio C Hamano [off-list ref] writes:
quoted
GIT_DIR and --git-dir are meant to refer to a different .git dir (or a
bare-looking repository) located elsewhere, and not for a random pathname
like ".foo". No matter what, ".git/" anywhere is ignored from very early
I'm extremely green to git, so please forgive if this is obvious, but,
could I indulge and ask what a sample use case of that would be?
(since it's not intended for what I assumed it was) And, if the
behavior I expected was possible, simply, with perhaps a separate
option, what is the likelihood a patch would be accepted? (Or am I
just talking nonsense and should just go away) ;D

Thanks Again!

Shawn
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help