Download raw body.
install symbolic links in the work tree
On Sun, May 31, 2020 at 02:46:59PM +0200, Stefan Sperling wrote: > > > > First, a general remark about "if a symbolic link cannot be installed we instead > > create a regular file". > > > > I am a bit unsure about this semantic. Does this particular file is managed in a > > special way ? or does the next got command will just assume a symlink was > > deleted and replaced by a plain file ? > > We can never trust the on-disk state anyway. Even if we installed a symlink > the user can replace that link with a regular file, a directory, a fifo, etc. > > [...] > > Then we can look at what's on disk. It might be a real symlink, or something > else. Each operation can now do something that fits the semantics we want. > > Is it enough if we simply render symlinks harmless upon checkout? My point was I find odd that after a "got checkout" a "got diff" would already points that things changed. I agree that such harmfull symlink shouldn't be created. I am just uncertain if the behaviour should be: 1- create a regular file (instead of a symlink) 2- doesn't create anything and skip the entry (with a warning) 3- doesn't create anything and error out as pointed previously, 1 and 2 are similar in effect: after a clean checkout the workdir isn't clean (status would report file type changed or file deleted), and for 3, it could be annoying (and adding a force option isn't a good solution). maybe 2 is less suprising that 1, but it is just a matter of taste I think. > I was considering whether 'got commit' should reject symlinks that point > outside of the work tree, as a precaution. What do think about that? > There is no way to prevent anyone from creating repositories with bad symlinks. > But I'm thinking maybe we should prevent accidental commit of such symlinks. at least it deserves that 'got commit' emits a warning (because it will not properly checkout/update with 'got'). for rejecting it, I am unsure. as you noted, anybody could create such repository. I fear that it could add complexity and finally block a user if he had to deal with such repository. -- Sebastien Marie
install symbolic links in the work tree