commands/fsck: attach a filter to exclude unfetched items from fsck

This commit is contained in:
Taylor Blau 2018-01-31 18:16:43 -08:00
parent ca2c3d9ac7
commit e60afaf309

@ -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)
}