Skip to content

smudge filter assumes the "origin" remote exists and has the missing files #2169

Closed

Description

@srjek

So I was experimenting with git-lfs in an attempt to get it working on my home server, when I stumbled across a cryptic error.

$ git pull
Updating 6c231ca..408714c
Downloading normal.tga (16.00 MB)
Error downloading object: normal.tga (87bcf825161b15108437017834569a6d0614fd99e3cb2269c5d184aee011a116)

Errors logged to D:\msys2\home\Josh\git-lfs-test-repo\local\.git\lfs\objects\logs\20170421T234530.4973295.log
Use `git lfs logs last` to view the log.
error: external filter 'git-lfs filter-process' failed
fatal: normal.tga: smudge filter lfs failed

(log file)
(Disclaimer: above output was reproduced post-fix by a git reset --hard HEAD^ && rm -r .git/lfs)

Ultimately I traced it down to a combination of following:

Some possible fixes:

  • I've noticed the use of git.DefaultRemote() elsewhere. However I'm unfamiliar with the codebase, so I don't know if it's really that simple. It seems to be better than hardcoding origin though, and I may have already patched my system git-lfs to use it.
  • At the very least, a better error message that catches attempts to use non-existent remotes
  • AFAIK there's no way to know the remote in a pull like the pre-push hook does. Not that it matters since the smudge filters run on checkout. Maybe git can be extended to allow git-lfs to track what commits come from what remotes, or maybe a simpler shotgun approach where git-lfs queries all the remotes until it has found all files.

As a workaround you can either do GIT_LFS_SKIP_SMUDGE=1 git pull && git lfs pull, rename your remote to origin, or set lfs.url so there's only one git lfs server

Activity

  1. ttaylorr commented on Apr 24, 2017

    @ttaylorr
    Contributor

    Hi @srjek, thanks for opening this issue and spending the time to look into the inner-workings of what's going on here. My inclination is to:

    1. Keep the behavior where the transfer queue is initialized with "", which is the zero-value for type string and the default value if the transfer queue is instantiated outside of its constructor.
    2. Do the same for the *endpointGitFinder type for the same reasons.
    3. Lazily instantiate defaultRemote to be either:
    • x, where x is the name of a remote in the repository, if there is only one remote
    • origin, if it exists and there is more than one remote
    • nil, if there are more than one remotes, and none of them are named origin

    I think this is the best that we can do without assuming much beyond a naming convention that origin is the pseudo-default remote. I'm curious of your thoughts on this.

    As a workaround you can either do GIT_LFS_SKIP_SMUDGE=1 git pull && git lfs pull, rename your remote to origin, or set lfs.url so there's only one git lfs server

    That being said, I think skipping the smudge on git pull and then following that up with a git lfs pull is the least destructive work-around for now.

  2. srjek commented on Apr 24, 2017

    @srjek
    Author
    1. Lazily instantiate defaultRemote to be either:
    • x, where x is the name of a remote in the repository, if there is only one remote
    • origin, if it exists and there is more than one remote
    • nil, if there are more than one remotes, and none of them are named origin

    The only issue I have is that as described is it ignores the tracked remote for a branch. If the tracked remote is taken into account, then the method could be the same as calling git.DefaultRemote(), which would make it consistent with other commands like git lfs pull.

  3. ttaylorr commented on Apr 24, 2017

    @ttaylorr
    Contributor

    If the tracked remote is taken into account, then the method could be the same as calling git.DefaultRemote(),

    I don't know if I'd roll this into git.DefaultRemote(), but I agree that we should respect the remote tracking branch (if there is one). I think the priority would be the same as above, preferring the remote tracking branch unless a non-empty remote was given, in which case we should use that.

  4. added this to the v2.2.0 milestone on May 30, 2017
  5. modified the milestones: v2.2.0, v2.3.0 on Jul 5, 2017
  6. modified the milestones: v2.3.0, v2.4.0 on Sep 14, 2017
  7. technoweenie commented on Oct 27, 2017

    @technoweenie
    Contributor

    Turns out that git.DefaultRemote() already grabs the tracked remote for the current ref. However, some of the code still relies on the CurrentRemote string property on config.Configuration. I've combined the two in #2700 to roll out with LFS v2.4.0.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions