{"thread":{"id":"53100","subject":"Git doesn't support symlinks","startedAt":"2020-03-25T23:38:49Z","lastAt":"2020-03-26T00:50:44Z","messageCount":4,"participants":["Daniel Malendez","Bryan Turner","Danh Doan"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"394031","messageId":"CA8EDABA-A41C-4177-A149-51DCD07C319C@googlemail.com","threadId":"53100","inReplyTo":null,"subject":"Git doesn't support symlinks","fromName":"Daniel Malendez","fromEmail":"dmalendez@googlemail.com","sentAt":"2020-03-25T23:38:37Z","receivedAt":"2020-03-25T23:38:49Z","isPatch":false,"sender":{"key":"dmalendez@googlemail.com","avatar":null},"body":"Hi everyone,\n\nI use `Ubuntu 18.04` with filesystem `ext` and `git 2.26.0`. I want to add a macOS Framework to my git repo, which fails with the following error message:\n\n    $ git add -f /var/opt/project1/Foo.framework/Headers/Interior.h\n    fatal: pathspec '/var/opt/project1/Foo.framework/Headers/Interior.h' is beyond a symbolic link\n\nIf I use `$ git add .` it works fine. Is this a bug? This is what `ls` returns\n\n    Foo.framework $ ls -l\n    lrwxr-xr-x  Headers -> Versions/Current/Headers\n    lrwxr-xr-x  Resources -> Versions/Current/Resources\n    drwxr-xr-x  Versions\n\nThis sounds like a bug, correct? If not, I am thankful for any advice! Thanks!\n\n\n\n\nBest Regards,\nDaniel"},{"id":"394033","messageId":"CAGyf7-FF0aEEiRGjZ_+RuyYnSV5cYn+-Hp5q7dZRADj_VL034g@mail.gmail.com","threadId":"53100","inReplyTo":"CA8EDABA-A41C-4177-A149-51DCD07C319C@googlemail.com","subject":"Re: Git doesn't support symlinks","fromName":"Bryan Turner","fromEmail":"bturner@atlassian.com","sentAt":"2020-03-26T00:23:01Z","receivedAt":"2020-03-26T00:23:15Z","isPatch":false,"sender":{"key":"bturner@atlassian.com","avatar":"https://gravatar.com/avatar/16bcf3167981c1ef7c804e502642366d888a35b0d0b0a4ca01fdc442aa1acb1e?d=mp&s=160"},"body":"On Wed, Mar 25, 2020 at 4:38 PM Daniel Malendez\n<dmalendez@googlemail.com> wrote:\n>\n> Hi everyone,\n>\n> I use `Ubuntu 18.04` with filesystem `ext` and `git 2.26.0`. I want to add a macOS Framework to my git repo, which fails with the following error message:\n>\n>     $ git add -f /var/opt/project1/Foo.framework/Headers/Interior.h\n>     fatal: pathspec '/var/opt/project1/Foo.framework/Headers/Interior.h' is beyond a symbolic link\n>\n> If I use `$ git add .` it works fine. Is this a bug? This is what `ls` returns\n>\n>     Foo.framework $ ls -l\n>     lrwxr-xr-x  Headers -> Versions/Current/Headers\n>     lrwxr-xr-x  Resources -> Versions/Current/Resources\n>     drwxr-xr-x  Versions\n\nThis didn't add the same thing. What does a \"git status\" show at this\npoint? I'd expect it would show \"Versions/Current/Headers/interior.h\"\nas added to the index, not \"Headers/interior.h\".\n\n>\n> This sounds like a bug, correct? If not, I am thankful for any advice! Thanks!\n>\n\nIt doesn't necessarily seem like a bug, to me; more like a case where\nGit could potentially be \"smarter\" to try and determine that, while\n\"Headers/interior.h\" is beyond a symlink, the target of that symlink\nis still in the repository. (Versions/Current _is_ in the same\nrepository, right?)\n\n>\n>\n>\n> Best Regards,\n> Daniel\n"},{"id":"394034","messageId":"F9453040-2E7D-4CAB-AA7F-0C6C04E2FC99@googlemail.com","threadId":"53100","inReplyTo":"D3B355BB-BB09-4AA7-8D8A-58B61529D617@googlemail.com","subject":"Re: Git doesn't support symlinks","fromName":"Daniel Malendez","fromEmail":"dmalendez@googlemail.com","sentAt":"2020-03-26T00:37:30Z","receivedAt":"2020-03-26T00:37:34Z","isPatch":false,"sender":{"key":"dmalendez@googlemail.com","avatar":null},"body":"Thanks for your feedback!\n\n> On Mar 25, 2020, at 8:23 PM, Bryan Turner <bturner@atlassian.com> wrote:\n> \n> This didn't add the same thing. What does a \"git status\" show at this\n> point? I'd expect it would show \"Versions/Current/Headers/interior.h\"\n> as added to the index, not \"Headers/interior.h\".\n\n$ git add .\n$ git status\nChanges to be committed:\n  (use \"git rm --cached <file>...\" to unstage)\n\tnew file:   Foo.framework/Headers\n\tnew file:   Foo.framework/Versions/A/Headers/Interior.h\n\n> It doesn't necessarily seem like a bug, to me; more like a case where\n> Git could potentially be \"smarter\" to try and determine that, while\n> \"Headers/interior.h\" is beyond a symlink, the target of that symlink\n> is still in the repository. (Versions/Current _is_ in the same\n> repository, right?)\n\nAgree, makes sense!\n\nI think what happens here is that `git add .` adds the Foo.framework/Headers directory first, to circumvent this check failing here?\nhttps://github.com/git/git/blob/master/pathspec.c#L596\nWhereas a single “git add path/to/file” would fail here"},{"id":"394035","messageId":"20200326005037.GA5398@danh.dev","threadId":"53100","inReplyTo":"F9453040-2E7D-4CAB-AA7F-0C6C04E2FC99@googlemail.com","subject":"Re: Git doesn't support symlinks","fromName":"Danh Doan","fromEmail":"congdanhqx@gmail.com","sentAt":"2020-03-26T00:50:37Z","receivedAt":"2020-03-26T00:50:44Z","isPatch":false,"sender":{"key":"congdanhqx@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42673067?v=4"},"body":"On 2020-03-25 20:37:30-0400, Daniel Malendez <dmalendez@googlemail.com> wrote:\n> Thanks for your feedback!\n> \n> > On Mar 25, 2020, at 8:23 PM, Bryan Turner <bturner@atlassian.com> wrote:\n> > \n> > This didn't add the same thing. What does a \"git status\" show at this\n> > point? I'd expect it would show \"Versions/Current/Headers/interior.h\"\n> > as added to the index, not \"Headers/interior.h\".\n> \n> $ git add .\n> $ git status\n> Changes to be committed:\n>   (use \"git rm --cached <file>...\" to unstage)\n> \tnew file:   Foo.framework/Headers\n> \tnew file:   Foo.framework/Versions/A/Headers/Interior.h\n> \n> > It doesn't necessarily seem like a bug, to me; more like a case where\n> > Git could potentially be \"smarter\" to try and determine that, while\n> > \"Headers/interior.h\" is beyond a symlink, the target of that symlink\n> > is still in the repository. (Versions/Current _is_ in the same\n> > repository, right?)\n> \n> Agree, makes sense!\n> \n> I think what happens here is that `git add .` adds the\n> Foo.framework/Headers directory first, to circumvent this check\n> failing here?\n\n\"Foo.framework/Headers\" is a symlinks,\nand git simply adds that, without caring where it's linked to.\n\nTo git, there's nothing inside \"Foo.framework/Headers\",\nit's a blob, which happends to be type: symlink.\n\nIOW, you can:\n\n\t$ git add Foo.framework/Headers # without add the target\n\t$ ln -s /usr/bin bin\n\t$ git add bin # git won't write to index anything from /usr/bin\n\n> https://github.com/git/git/blob/master/pathspec.c#L596\n> Whereas a single “git add path/to/file” would fail here\n\n-- \nDanh\n"}]}