Skip to content

Install command always replaces the filter.lfs.smudge and filter.lfs.process config values #2993

Closed

Description

@niik

Hey git-lfs friends,

We got an issue over in GitHub Desktop (desktop/desktop#4602) from a user who unfortunately had their global .gitconfig file wiped due to (I imagine) fs-corruption following a very unfortunately timed system crash.

This user spotted that every time GitHub Desktop is launched the global .gitconfig file is written to. This surprised me but I think I've been able to track it down to Desktop running git lfs install --skip-repo on launch in order to make sure that the filter config is up to date with the version of lfs we're shipping (currently 2.4.0).

Running git lfs install --skip-repo with the GIT_TRACE=1 environment variable yields the following

git-core markus$ GIT_TRACE=1 ./git-lfs install --skip-repo
16:38:58.656296 trace git-lfs: exec: git 'version'
16:38:58.669961 trace git-lfs: exec: git 'config' '--global' 'filter.lfs.process'
16:38:58.686455 trace git-lfs: exec: git 'config' '--global' '--replace-all' 'filter.lfs.process' 'git-lfs filter-process'
16:38:58.714318 trace git-lfs: exec: git 'config' '--global' 'filter.lfs.required'
16:38:58.735164 trace git-lfs: exec: git 'config' '--global' 'filter.lfs.clean'
16:38:58.755172 trace git-lfs: exec: git 'config' '--global' 'filter.lfs.smudge'
16:38:58.772220 trace git-lfs: exec: git 'config' '--global' '--replace-all' 'filter.lfs.smudge' 'git-lfs smudge -- %f'
Git LFS initialized.

Note that while it doesn't attempt to replace filter.lfs.required or filter.lfs.clean it does try to replace the filter.lfs.smudge and filter.lfs.process.

I think this (though I'm certainly not well-versed in the git-lfs code base) that this is because the default value of, filter.lfs.process (git-lfs filter-process) and filter.lfs.clean is listed as an 'upgradeable' value in

"git-lfs filter-process",
which ought to mean that shouldReset in
if opt.Force || shouldReset(currentValue, upgradeables) {
will return true and force the replace.

From my cursory reading of the code it's not obvious to me if there's a good reason for the default configuration value of a config key should also be listed as an upgradeable.

Activity

  1. ttaylorr commented on May 4, 2018

    @ttaylorr
    Contributor

    Hey, @niik! Thanks for opening this up, and doing some digging to figure out what was going on. I think that I fixed this bug in #2994. Can you give a build on master a shot and make sure that everything works as expected?

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

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions