Skip to content

git lfs track fails when git dirpath contains symlinks #811

Closed

Description

@difro

git lfs track fails with a.gif is outside repository if current working dir(=gitdir) contains symlinks.

Steps to reproduce.

$ mkdir /tmp/real
$ cd /tmp/
$ ln -sf real sym
$ cd sym
$ git init . ; git lfs init
# copy any binary file to this dir
$ git lfs track a.gif
a.gif is outside repositor

git lfs env output

git-lfs/1.0.2 (GitHub; linux amd64; go 1.5.1; git 9a9ab0386672)
git version 2.6.1

LocalWorkingDir=/tmp/real
LocalGitDir=/tmp/sym/.git
LocalGitStorageDir=/tmp/sym/.git
LocalMediaDir=/tmp/sym/.git/lfs/objects
TempDir=/tmp/sym/.git/lfs/tmp
ConcurrentTransfers=3
BatchTransfer=true
git config filter.lfs.smudge = "git-lfs smudge %f"
git config filter.lfs.clean = "git-lfs clean %f"

Activity

  1. technoweenie commented on Nov 3, 2015

    @technoweenie
    Contributor

    Ah, this is because the init() function uses git rev-parse to get the working directory. We may need to use that as the base for all of the other directories too. I'll add this to the list for v1.1.0, but I personally won't be able to work on that too much for a little while.

  2. difro commented on Nov 3, 2015

    @difro
    Author

    Well, simplest solution would be cleaning paths with filepath.EvalSymlinks() for all the directories before we use/compare them.
    Maybe I can have a go at it. Would this approach be ok?

  3. technoweenie commented on Nov 4, 2015

    @technoweenie
    Contributor

    @difro: Yeah, that'd be great. Ideally, there's a shell integration test using symlinks too in test-env.sh. I can help out there if you don't feel like writing some shell code too though :)

  4. difro commented on Nov 5, 2015

    @difro
    Author

    yeah, skimmed over test-env.sh and I feel it's better that you take a look at it :)

    git lfs env after applying #816

    $ git lfs env
    git-lfs/1.0.2 (GitHub; linux amd64; go 1.5.1; git 386c03db5009)
    git version 2.6.1
    
    Endpoint=https://github.com/difro/test.git/info/lfs (auth=basic)
    LocalWorkingDir=/tmp/real
    LocalGitDir=/tmp/real/.git
    LocalGitStorageDir=/tmp/real/.git
    LocalMediaDir=/tmp/real/.git/lfs/objects
    TempDir=/tmp/real/.git/lfs/tmp
    ConcurrentTransfers=3
    BatchTransfer=true
    git config filter.lfs.smudge = "git-lfs smudge %f"
    git config filter.lfs.clean = "git-lfs clean %f"
    
  5. ttaylorr commented on Apr 5, 2018

    @ttaylorr
    Contributor

    Hi @difro, just a quick ping to let you know that this issue is fixed in #818.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions