Skip to content

Commit 3f00f87

Browse files
committed
Introduce the switch to enable file path pattern match caching during LFS migration
1 parent 14baa61 commit 3f00f87

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

commands/command_migrate.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ var (
6363
// migrateFixup is the flag indicating whether or not to infer the
6464
// included and excluded filepath patterns.
6565
migrateFixup bool
66+
67+
// migrateCacheFilePathFilterResult is the flag indicating that a file path
68+
// filter result may be cached
69+
migrateCacheFilePathFilterResults bool
6670
)
6771

6872
// migrate takes the given command and arguments, *gitobj.ObjectDatabase, as well
@@ -401,6 +405,7 @@ func init() {
401405
importCmd.Flags().BoolVar(&migrateNoRewrite, "no-rewrite", false, "Add new history without rewriting previous")
402406
importCmd.Flags().StringVarP(&migrateCommitMessage, "message", "m", "", "With --no-rewrite, an optional commit message")
403407
importCmd.Flags().BoolVar(&migrateFixup, "fixup", false, "Infer filepaths based on .gitattributes")
408+
importCmd.Flags().BoolVar(&migrateCacheFilePathFilterResults, "cache-file-path-filter-results", false, "Cache file path filter results")
404409

405410
exportCmd := NewCommand("export", migrateExportCommand)
406411
exportCmd.Flags().BoolVar(&migrateVerbose, "verbose", false, "Verbose logging")

commands/commands.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ func buildFilepathFilter(config *config.Configuration, includeArg, excludeArg *s
134134

135135
func buildFilepathFilterWithPatternType(config *config.Configuration, includeArg, excludeArg *string, useFetchOptions bool, patternType filepathfilter.PatternType) *filepathfilter.Filter {
136136
inc, exc := determineIncludeExcludePaths(config, includeArg, excludeArg, useFetchOptions)
137-
return filepathfilter.New(inc, exc, patternType)
137+
return filepathfilter.New(inc, exc, patternType, filepathfilter.UseCache(migrateCacheFilePathFilterResults))
138138
}
139139

140140
func downloadTransfer(p *lfs.WrappedPointer) (name, path, oid string, size int64, missing bool, err error) {

docs/man/git-lfs-migrate.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,10 @@ export::
149149
`--include-ref` or `--exclude-ref`.
150150
`--everything`::
151151
See <<_include_and_exclude_references>>.
152+
`--cache-file-path-filter-results`::
153+
Makes Git LFS cache the result of include or exclude file path pattern matching
154+
while importing Git objects to LFS. This may speed up migration of a large
155+
repository.
152156
+
153157
Note: Git refs are "case-sensitive" on all platforms in "packed from"
154158
(see `git-pack-refs(1)`). On "case-insensitive" file systems, e.g. NTFS

0 commit comments

Comments
 (0)