git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Git doesn't support symlinks
@ 2020-03-25 23:38 Daniel Malendez
  2020-03-26  0:23 ` Bryan Turner
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Malendez @ 2020-03-25 23:38 UTC (permalink / raw)
  To: git

Hi everyone,

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:

    $ git add -f /var/opt/project1/Foo.framework/Headers/Interior.h
    fatal: pathspec '/var/opt/project1/Foo.framework/Headers/Interior.h' is beyond a symbolic link

If I use `$ git add .` it works fine. Is this a bug? This is what `ls` returns

    Foo.framework $ ls -l
    lrwxr-xr-x  Headers -> Versions/Current/Headers
    lrwxr-xr-x  Resources -> Versions/Current/Resources
    drwxr-xr-x  Versions

This sounds like a bug, correct? If not, I am thankful for any advice! Thanks!




Best Regards,
Daniel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Git doesn't support symlinks
  2020-03-25 23:38 Git doesn't support symlinks Daniel Malendez
@ 2020-03-26  0:23 ` Bryan Turner
       [not found]   ` <D3B355BB-BB09-4AA7-8D8A-58B61529D617@googlemail.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Bryan Turner @ 2020-03-26  0:23 UTC (permalink / raw)
  To: Daniel Malendez; +Cc: Git Users

On Wed, Mar 25, 2020 at 4:38 PM Daniel Malendez
<dmalendez@googlemail.com> wrote:
>
> Hi everyone,
>
> 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:
>
>     $ git add -f /var/opt/project1/Foo.framework/Headers/Interior.h
>     fatal: pathspec '/var/opt/project1/Foo.framework/Headers/Interior.h' is beyond a symbolic link
>
> If I use `$ git add .` it works fine. Is this a bug? This is what `ls` returns
>
>     Foo.framework $ ls -l
>     lrwxr-xr-x  Headers -> Versions/Current/Headers
>     lrwxr-xr-x  Resources -> Versions/Current/Resources
>     drwxr-xr-x  Versions

This didn't add the same thing. What does a "git status" show at this
point? I'd expect it would show "Versions/Current/Headers/interior.h"
as added to the index, not "Headers/interior.h".

>
> This sounds like a bug, correct? If not, I am thankful for any advice! Thanks!
>

It doesn't necessarily seem like a bug, to me; more like a case where
Git could potentially be "smarter" to try and determine that, while
"Headers/interior.h" is beyond a symlink, the target of that symlink
is still in the repository. (Versions/Current _is_ in the same
repository, right?)

>
>
>
> Best Regards,
> Daniel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Git doesn't support symlinks
       [not found]   ` <D3B355BB-BB09-4AA7-8D8A-58B61529D617@googlemail.com>
@ 2020-03-26  0:37     ` Daniel Malendez
  2020-03-26  0:50       ` Danh Doan
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Malendez @ 2020-03-26  0:37 UTC (permalink / raw)
  To: Bryan Turner; +Cc: Git Users

Thanks for your feedback!

> On Mar 25, 2020, at 8:23 PM, Bryan Turner <bturner@atlassian.com> wrote:
> 
> This didn't add the same thing. What does a "git status" show at this
> point? I'd expect it would show "Versions/Current/Headers/interior.h"
> as added to the index, not "Headers/interior.h".

$ git add .
$ git status
Changes to be committed:
  (use "git rm --cached <file>..." to unstage)
	new file:   Foo.framework/Headers
	new file:   Foo.framework/Versions/A/Headers/Interior.h

> It doesn't necessarily seem like a bug, to me; more like a case where
> Git could potentially be "smarter" to try and determine that, while
> "Headers/interior.h" is beyond a symlink, the target of that symlink
> is still in the repository. (Versions/Current _is_ in the same
> repository, right?)

Agree, makes sense!

I think what happens here is that `git add .` adds the Foo.framework/Headers directory first, to circumvent this check failing here?
https://github.com/git/git/blob/master/pathspec.c#L596
Whereas a single “git add path/to/file” would fail here

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Git doesn't support symlinks
  2020-03-26  0:37     ` Daniel Malendez
@ 2020-03-26  0:50       ` Danh Doan
  0 siblings, 0 replies; 4+ messages in thread
From: Danh Doan @ 2020-03-26  0:50 UTC (permalink / raw)
  To: Daniel Malendez; +Cc: Bryan Turner, Git Users

On 2020-03-25 20:37:30-0400, Daniel Malendez <dmalendez@googlemail.com> wrote:
> Thanks for your feedback!
> 
> > On Mar 25, 2020, at 8:23 PM, Bryan Turner <bturner@atlassian.com> wrote:
> > 
> > This didn't add the same thing. What does a "git status" show at this
> > point? I'd expect it would show "Versions/Current/Headers/interior.h"
> > as added to the index, not "Headers/interior.h".
> 
> $ git add .
> $ git status
> Changes to be committed:
>   (use "git rm --cached <file>..." to unstage)
> 	new file:   Foo.framework/Headers
> 	new file:   Foo.framework/Versions/A/Headers/Interior.h
> 
> > It doesn't necessarily seem like a bug, to me; more like a case where
> > Git could potentially be "smarter" to try and determine that, while
> > "Headers/interior.h" is beyond a symlink, the target of that symlink
> > is still in the repository. (Versions/Current _is_ in the same
> > repository, right?)
> 
> Agree, makes sense!
> 
> I think what happens here is that `git add .` adds the
> Foo.framework/Headers directory first, to circumvent this check
> failing here?

"Foo.framework/Headers" is a symlinks,
and git simply adds that, without caring where it's linked to.

To git, there's nothing inside "Foo.framework/Headers",
it's a blob, which happends to be type: symlink.

IOW, you can:

	$ git add Foo.framework/Headers # without add the target
	$ ln -s /usr/bin bin
	$ git add bin # git won't write to index anything from /usr/bin

> https://github.com/git/git/blob/master/pathspec.c#L596
> Whereas a single “git add path/to/file” would fail here

-- 
Danh

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-03-26  0:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-25 23:38 Git doesn't support symlinks Daniel Malendez
2020-03-26  0:23 ` Bryan Turner
     [not found]   ` <D3B355BB-BB09-4AA7-8D8A-58B61529D617@googlemail.com>
2020-03-26  0:37     ` Daniel Malendez
2020-03-26  0:50       ` Danh Doan

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).