Re: [PATCH 2/2] add: refuse to add paths beyond repository boundaries
From: Ramkumar Ramachandra <hidden>
Date: 2016-06-15 22:56:45
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/newfile
This is allowed. While:
cd foo/bar/quux
echo "baz" >newfile
cd ../../.. # Back to toplevel
ln -s foo/bar/quux
git add quux/newfile
is disallowed. Then again, if we were to replace the last line with:
cd quux
git add newfile
and 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.