diff --git a/commands/command_fsck.go b/commands/command_fsck.go index a6dc281a..0721257e 100644 --- a/commands/command_fsck.go +++ b/commands/command_fsck.go @@ -7,6 +7,7 @@ import ( "os" "path/filepath" + "github.com/git-lfs/git-lfs/filepathfilter" "github.com/git-lfs/git-lfs/git" "github.com/git-lfs/git-lfs/lfs" "github.com/spf13/cobra" @@ -46,6 +47,13 @@ func fsckCommand(cmd *cobra.Command, args []string) { } }) + // If 'lfs.fetchexclude' is set and 'git lfs fsck' is run after the + // initial fetch (i.e., has elected to fetch a subset of Git LFS + // objects), the "missing" ones will fail the fsck. + // + // Attach a filepathfilter to avoid _only_ the excluded paths. + gitscanner.Filter = filepathfilter.New(nil, cfg.FetchExcludePaths()) + if err := gitscanner.ScanRef(ref.Sha, nil); err != nil { ExitWithError(err) }