Skip to content

git lfs migrate import include filter issue starting with version 3.0.1 #4751

@rolandas-rimkus

Description

@rolandas-rimkus

Describe the bug
Starting with version 3.0.1 of Git LFS running git lfs migrate import with a include pattern like *.extension started affecting directory names that also end with the same pattern. For example if *.model is used all files under a directory VS.Project.Parse.Model would be added under Git LFS. This was not the case in version 2.13.3.

The documentation for gitattributes seems to indicate that using *.extension should not affect directories so it seems like a bug was introduced in the version 3.0.1 of Git LFS.

To Reproduce
Steps to reproduce the behavior:

  1. Install Git version 2.33.1 or newer from: https://github.com/git-for-windows/git/releases
  2. Run the following commands under a Windows Command Prompt
git init D:\GitLfsBug
mkdir D:\GitLfsBug\Data
mkdir D:\GitLfsBug\VS.Project.Parse.Model
echo Test > D:\GitLfsBug\Data\aaa.model
echo Test > D:\GitLfsBug\Data\aaa.txt
echo Test > D:\GitLfsBug\VS.Project.Parse.Model\bbb.txt
echo Test > D:\GitLfsBug\VS.Project.Parse.Model\ccc.txt
git -C D:\GitLfsBug add --all .
git -C D:\GitLfsBug commit -m "Test" --all
git -C D:\GitLfsBug lfs install
git -C D:\GitLfsBug lfs migrate import --yes --include="*.model"
git -C D:\GitLfsBug lfs ls-files --size --long
  1. Note down that the files tracked under LFS are: Data\aaa.model, VS.Project.Parse.Model\bbb.txt and VS.Project.Parse.Model\ccc.txt
  2. Download Git LFS version 2.13.3 from https://github.com/git-lfs/git-lfs/releases/download/v2.13.3/git-lfs-windows-amd64-v2.13.3.zip
  3. Apply the git-lfs.exe file on top of mingw64\bin\git-lfs.exe in the install location of Git
  4. Repeat step 2
  5. Note down that the only file tracked under LFS is: Data\aaa.model

Expected behavior
Directories that match the file filter passed into git lfs migrate import should not be tracked under Git LFS as was the case in versions up to 3.0.1.

System environment
Windows 10 v1909

Output of git lfs env
git-lfs/3.0.1 (GitHub; windows amd64; go 1.17.1)
git version 2.33.1.windows.1

LocalWorkingDir=D:\Work\GitLfsBug
LocalGitDir=D:\Work\GitLfsBug.git
LocalGitStorageDir=D:\Work\GitLfsBug.git
LocalMediaDir=D:\Work\GitLfsBug.git\lfs\objects
LocalReferenceDirs=
TempDir=D:\Work\GitLfsBug.git\lfs\tmp
ConcurrentTransfers=8
TusTransfers=false
BasicTransfersOnly=false
SkipDownloadErrors=false
FetchRecentAlways=false
FetchRecentRefsDays=7
FetchRecentCommitsDays=0
FetchRecentRefsIncludeRemotes=true
PruneOffsetDays=3
PruneVerifyRemoteAlways=false
PruneRemoteName=origin
LfsStorageDir=D:\Work\GitLfsBug.git\lfs
AccessDownload=none
AccessUpload=none
DownloadTransfers=basic,lfs-standalone-file,ssh
UploadTransfers=basic,lfs-standalone-file,ssh
GIT_EXE="C:\Git\Git-2.33.1\cmd\git.exe"
GIT_EXEC_PATH=C:/Git/Git-2.33.1/mingw64/libexec/git-core
git config filter.lfs.process = "git-lfs filter-process"
git config filter.lfs.smudge = "git-lfs smudge -- %f"
git config filter.lfs.clean = "git-lfs clean -- %f"

Additional context
This issue seems to be independent from Git version itself as I managed to reproduce the same issue with replacing the Git LFS delivered in Git versions 2.33.0, 2.33.1, 2.34.0 and 2.34.1. So currently both 3.0.1 and 3.0.2 is affected no matter with which Git version it is being used.

This is a breaking change that might cause files to be tracked under Git LFS when they were not suppose to and requiring a full remigration of a Git repository using an older version.

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