git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [bug] git-add won't add foo/.git/bar

From
Julian Phillips <julian@quantumfyre.co.uk>
Date
Mar 25, 2008, 00:55 UTC
Message-ID
<Pine.LNX.4.64.0803250045120.30488@kaos.quantumfyre.co.uk>
In-Reply-To
<7vve3br6ct.fsf@gitster.siamese.dyndns.org>
On Mon, 24 Mar 2008, Junio C Hamano wrote:
Show 10 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
>
>>> Well, git won't allow .git as a element anywhere in the path, when we
>>> should only care about the _first_ one - and also, if you use
>>> --git-dir=banana then we still check for '.git' ... oops.
>>
>> That's not how git-dir is supposed to used, so there is no oops.
>
> The only purpose of git-dir is to have $GIT_DIR elsewhere _outside_ the
> work tree.

That's fair enough. It's not enforced, or discourgaed in the documentation though. Would a patch to mention that using --git-dir/GIT_DIR to change the name _inside_ the work tree is not supported be accepted?

> A few weeks ago somebody wanted to rename .git and I thought I responded
> well enough.  You certainly did not ask CVS or SVN folks to rename the
> control directories they sprinkle in your work trees to .cvs or .svn, did
> you?
Well, no - but then I hold git to a higher standard. ;)
> Leave .git alone so that people don't get confused.

Agreed, it is a) a lot simpler to explain, b) less likely to break things. Sorry for wasting your time :$, an interesting poke around the code though. :)

Something I noticed that seemed a bit odd when playing with this, should I expect git to stop me from trying to add files inside subprojects to the main project? It seems to just discard the submodule and turn it into a normal directory when I do. Is that intended behaviour?

-- 
Julian

  ---
Excess on occasion is exhilarating.  It prevents moderation from
acquiring the deadening effect of a habit.
 		-- W. Somerset Maugham
Previous: Junio C HamanoNext: Julian Phillips
Message 6 of 10 in “[bug] git-add won't add foo/.git/bar”
  1. Michael GebetsroitherMar 24, 2008
  2. Julian PhillipsMar 25, 2008
  3. Junio C HamanoMar 25, 2008
  4. Julian PhillipsMar 25, 2008
  5. Junio C HamanoMar 25, 2008
  6. Julian PhillipsMar 25, 2008
  7. Documentation/git.txt: Mention unsupported use of --git-dir/GIT_DIRJulian Phillips, Mar 25, 2008
  8. Michael GebetsroitherMar 25, 2008
  9. Julian PhillipsMar 25, 2008
  10. Michael GebetsroitherMar 26, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.