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

Re: Bug Report: git add

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 7, 2011, 01:09 UTC
Message-ID
<7vbp0ihnou.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20110407005750.GC28813@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 14 quoted lines
>>   mkdir settings
>>   cd settings
>>   git init
>>   touch x
>> ...
>>   cd ..
>>   git init
>>   git add settings/
>>    (should complain)
>
> If you do "git add settings" (without the slash) it will add the
> repository as a submodule.  Which is not the behavior you asked for, but
> is at least reasonable. So the real bug seems to me the fact that "git
> add settings/" and "git add settings" behave differently.

Also if "git add settings/x" does not complain, that would be a bigger issue, whose solution would probably be in the same area.

It may finally be the time to rename has_symlink_leading_path() function and enhance its feature. It happens to check leading symlinks, but its real purpose is to check if the given path is outside the working tree, and a path that is in a subdirectory with its own .git repository certainly is outside the working tree. The callers should be able to say what check is being asked for by naming the _purpose_ of the test ("is this path outside the working tree?"), not the mechanics ("does the path have a symlink that points outside?").

Previous: Jeff KingNext: Jeff King
Message 8 of 13 in “Bug Report: git add”
  1. Darren CookApr 5, 2011
  2. Ramkumar RamachandraApr 6, 2011
  3. Jakub NarebskiApr 10, 2011
  4. Ramkumar RamachandraApr 10, 2011
  5. Junio C HamanoApr 11, 2011
  6. Jeff KingApr 11, 2011
  7. Jeff KingApr 7, 2011
  8. Junio C HamanoApr 7, 2011
  9. Jeff KingApr 7, 2011
  10. Jeff KingApr 7, 2011
  11. Junio C HamanoApr 7, 2011
  12. Jeff KingApr 8, 2011
  13. Jeff KingApr 8, 2011

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.