Display a warning message when asked to operate on a file inside a directory that's a symbolic link to elsewhere

This relicates git's behavior. It adds a few stat calls for the command
line parameters, so there is some minor slowdown, but even with thousands
of parameters it will not be very noticable, and git does the same statting
in similar circumstances.

Note that this does not prevent eg "git annex add symlink"; the symlink
will be added to git as usual. And "git annex find symlink" will silently
list nothing as well. It's only "symlink/foo" or "subdir/symlink/foo" that
triggers the warning.
This commit is contained in:
Joey Hess 2020-05-11 15:03:35 -04:00
parent 39d7e6dd2a
commit 2a8fdfc7d8
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 33 additions and 10 deletions

View file

@ -8,3 +8,5 @@ This happens because git ls-files doesn't list the file, but then I think
the code that handles erroring if a file that does not exist is specified
doesn't catch it because the file does exist, it's just behind the symlink.
--[[Joey]]
> [[fixed|done]] --[[Joey]]