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?").