Re: [PATCH 2/2] add: refuse to add paths beyond repository boundaries
- From
Ramkumar Ramachandra <artagnon@gmail.com>
- Date
- Apr 10, 2013, 13:38 UTC
- Message-ID
- <CALkWK0=_NAfOdVKet9k33ZuwAtcaZ42ok_r+Ln1rswcaJi6eTA@mail.gmail.com>
- In-Reply-To
- <7vehejsfpe.fsf@alter.siamese.dyndns.org>
Junio C Hamano wrote:
> One can have symlinks to anywhere all one wants. We track symlinks. > [...]
Yes, I know. We store symlinks as blobs containing one line, the path to the file, without a trailing newline. And we have a mode for it to distinguish it from regular files.
What I meant is:
echo "baz" >newfile
cd foo/bar/quux
ln -s ../../../newfile
cd ../../.. # Back to toplevel
git add foo/bar/quux/newfileThis is allowed. While:
cd foo/bar/quux
echo "baz" >newfile
cd ../../.. # Back to toplevel
ln -s foo/bar/quux
git add quux/newfileis disallowed. Then again, if we were to replace the last line with:
cd quux
git add newfileand it works.
Notice that both symlinks are pointing to paths inside out repository, and the only difference is that the second example attempts to add a path with a symlink as the non-final component. The path is not pointing "outside" our repository, as the function name would indicate.
Anyway, it's just a minor detail that would be nice to fix in the future. Nothing urgent.