MCPcopy
hub / github.com/git-lfs/git-lfs / refreshLockablePatterns

Method refreshLockablePatterns

locking/lockable.go:41–51  ·  view source on GitHub ↗

Internal function to repopulate lockable patterns You must have locked the c.lockableMutex in the caller

()

Source from the content-addressed store, hash-verified

39// Internal function to repopulate lockable patterns
40// You must have locked the c.lockableMutex in the caller
41func (c *Client) refreshLockablePatterns() {
42 paths := git.GetAttributePaths(gitattr.NewMacroProcessor(), c.LocalWorkingDir, c.LocalGitDir)
43 // Always make non-nil even if empty
44 c.lockablePatterns = make([]string, 0, len(paths))
45 for _, p := range paths {
46 if p.Lockable {
47 c.lockablePatterns = append(c.lockablePatterns, filepath.ToSlash(p.Path))
48 }
49 }
50 c.lockableFilter = filepathfilter.New(c.lockablePatterns, nil, filepathfilter.GitAttributes, filepathfilter.DefaultValue(false))
51}
52
53// IsFileLockable returns whether a specific file path is marked as Lockable,
54// ie has the 'lockable' attribute in .gitattributes

Callers 1

ensureLockablesLoadedMethod · 0.95

Calls 4

GetAttributePathsFunction · 0.92
NewMacroProcessorFunction · 0.92
NewFunction · 0.92
DefaultValueFunction · 0.92

Tested by

no test coverage detected