From: Johannes Thyssen Tishman Subject: Out-of-tree symlinks To: gameoftrees@openbsd.org Date: Sat, 26 Apr 2025 15:29:53 +0000 As discussed earlier on irc, I noticed that symlinks that point outside of the work tree are lost at least during update or histedit operations even after using the -S flag to stage and commit the symlink. Below are a few short scripts to reproduce what I tested (mostly the same commands but I included all commands every time so that they are easy to copy paste, hope that's okay). # test update -c and update -b after stage and commit *with* -S # expected: symlink survives operation mkdir foo echo "blah" > foo/bar echo "blah" > file_out_of_tree got init test.git got import -r test.git/ -m'initial commit' foo/ got checkout test.git/ cd test ln -sf ../file_out_of_tree . got add file_out_of_tree got sg -S file_out_of_tree got commit -m 'symlink test' -S file_out_of_tree got up -c :head:-1 got up -b main cat file_out_of_tree # output is target path (no EOL) # test update -c and histedit -m after stage and commit *with* -S # expected: symlink survives operation mkdir foo echo "blah" > foo/bar echo "blah" > file_out_of_tree got init test.git got import -r test.git/ -m'initial commit' foo/ got checkout test.git/ cd test ln -sf ../file_out_of_tree . got add file_out_of_tree got sg -S file_out_of_tree got commit -m 'symlink test' -S file_out_of_tree got up -c :head:-1 got histedit -m # edit commit message # got: /path/to/file_out_of_tree: symbolic link points outside of paths under version control got histedit -a # <-- file is lost cat file_out_of_tree # cat: file_out_of_tree: No such file or directory # test update -c and update -b after stage and commit *without* -S # expected: symlink is lost and file contains target path mkdir foo echo "blah" > foo/bar echo "blah" > file_out_of_tree got init test.git got import -r test.git/ -m'initial commit' foo/ got checkout test.git/ cd test ln -sf ../file_out_of_tree . got add file_out_of_tree got sg file_out_of_tree got commit -m 'symlink test' file_out_of_tree got up -c :head:-1 # <-- merge conflict here got up -b main cat file_out_of_tree # merge conflict (symlink was deleted) Not sure my expectations are correct, but overall the results seem inconsistent to me. Please let me know if there's anything else you'd like me to test. Johannes