| 1 | package lockingscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/ |
| 2 | |
| 3 | import ( |
| 4 | "osscip-go gomod github.com/golang/go/src go1.25.0 os/" |
| 5 | "path/filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/" |
| 6 | "stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/" |
| 7 | |
| 8 | "github.com/git-lfs/git-lfs/v3/errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/" |
| 9 | "github.com/git-lfs/git-lfs/v3/filepathfilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/" |
| 10 | "github.com/git-lfs/git-lfs/v3/gitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/" |
| 11 | "github.com/git-lfs/git-lfs/v3/git/gitattrscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/" |
| 12 | "github.com/git-lfs/git-lfs/v3/toolsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/" |
| 13 | "github.com/git-lfs/git-lfs/v3/trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/" |
| 14 | ) |
| 15 | |
| 16 | // GetLockablePatterns returns a list of patterns in .gitattributes which are |
| 17 | // marked as lockable |
| 18 | func (c *Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#) GetLockablePatternsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#GetLockablePatterns().() []string { |
| 19 | c.ensureLockablesLoadedscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#ensureLockablesLoaded().() |
| 20 | return c.lockablePatternsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#lockablePatterns. |
| 21 | } |
| 22 | |
| 23 | // getLockableFilter returns the internal filter used to check if a file is lockable |
| 24 | func (c *Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#) getLockableFilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#getLockableFilter().() *filepathfilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/.Filterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/Filter# { |
| 25 | c.ensureLockablesLoadedscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#ensureLockablesLoaded().() |
| 26 | return c.lockableFilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#lockableFilter. |
| 27 | } |
| 28 | |
| 29 | func (c *Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#) ensureLockablesLoadedscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#ensureLockablesLoaded().() { |
| 30 | c.lockableMutexscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#lockableMutex..Lockscip-go gomod github.com/golang/go/src go1.25.0 sync/Mutex#Lock().() |
| 31 | defer c.lockableMutexscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#lockableMutex..Unlockscip-go gomod github.com/golang/go/src go1.25.0 sync/Mutex#Unlock().() |
| 32 | |
| 33 | // Only load once |
| 34 | if c.lockablePatternsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#lockablePatterns. == nil { |
| 35 | c.refreshLockablePatternsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#refreshLockablePatterns().() |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | // Internal function to repopulate lockable patterns |
| 40 | // You must have locked the c.lockableMutex in the caller |
| 41 | func (c *Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#) refreshLockablePatternsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#refreshLockablePatterns().() { |
| 42 | paths := gitattrscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/.GetAttributePathsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/GetAttributePaths().(gitattrscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/.NewMacroProcessorscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/NewMacroProcessor().(), c.LocalWorkingDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#LocalWorkingDir., c.LocalGitDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#LocalGitDir.) |
| 43 | // Always make non-nil even if empty |
| 44 | c.lockablePatternsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#lockablePatterns. = make([]string, 0, len(paths)) |
| 45 | for _, p := range paths { |
| 46 | if p.Lockablescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/AttributePath#Lockable. { |
| 47 | c.lockablePatternsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#lockablePatterns. = append(c.lockablePatternsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#lockablePatterns., filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.ToSlashscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/ToSlash().(p.Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/gitattr`/AttributePath#Path.)) |
| 48 | } |
| 49 | } |
| 50 | c.lockableFilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#lockableFilter. = filepathfilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/New().(c.lockablePatternsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#lockablePatterns., nil, filepathfilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/.GitAttributesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/GitAttributes., c.cfgscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#cfg..Gitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Configuration#Git., filepathfilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/.DefaultValuescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/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 |
| 55 | // Lockable patterns are cached once for performance, unless you call RefreshLockablePatterns |
| 56 | // path should be relative to repository root |
| 57 | func (c *Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#) IsFileLockablescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#IsFileLockable().(path string) bool { |
| 58 | return c.getLockableFilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#getLockableFilter().().Allowsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/Filter#Allows().(path) |
| 59 | } |
| 60 | |
| 61 | // FixAllLockableFileWriteFlags recursively scans the repo looking for files which |
| 62 | // are lockable, and makes sure their write flags are set correctly based on |
| 63 | // whether they are currently locked or unlocked. |
| 64 | // Files which are unlocked are made read-only, files which are locked are made |
| 65 | // writeable. |
| 66 | // This function can be used after a clone or checkout to ensure that file |
| 67 | // state correctly reflects the locking state |
| 68 | func (c *Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#) FixAllLockableFileWriteFlagsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#FixAllLockableFileWriteFlags().() error { |
| 69 | return c.fixFileWriteFlagsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#fixFileWriteFlags().(c.LocalWorkingDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#LocalWorkingDir., c.LocalWorkingDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#LocalWorkingDir., c.getLockableFilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#getLockableFilter().(), nil) |
| 70 | } |
| 71 | |
| 72 | // FixFileWriteFlagsInDir scans dir (which can either be a relative dir |
| 73 | // from the root of the repo, or an absolute dir within the repo) looking for |
| 74 | // files to change permissions for. |
| 75 | // If lockablePatterns is non-nil, then any file matching those patterns will be |
| 76 | // checked to see if it is currently locked by the current committer, and if so |
| 77 | // it will be writeable, and if not locked it will be read-only. |
| 78 | // If unlockablePatterns is non-nil, then any file matching those patterns will |
| 79 | // be made writeable if it is not already. This can be used to reset files to |
| 80 | // writeable when their 'lockable' attribute is turned off. |
| 81 | func (c *Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#) FixFileWriteFlagsInDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#FixFileWriteFlagsInDir().(dir string, lockablePatterns, unlockablePatterns []string) error { |
| 82 | |
| 83 | // early-out if no patterns |
| 84 | if len(lockablePatterns) == 0 && len(unlockablePatterns) == 0 { |
| 85 | return nil |
| 86 | } |
| 87 | |
| 88 | absPath := dir |
| 89 | if !filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.IsAbsscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/IsAbs().(dir) { |
| 90 | absPath = filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(c.LocalWorkingDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#LocalWorkingDir., dir) |
| 91 | } |
| 92 | stat, err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.Statscip-go gomod github.com/golang/go/src go1.25.0 os/Stat().(absPath) |
| 93 | if err != nil { |
| 94 | return err |
| 95 | } |
| 96 | if !stat.IsDirscip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/FileInfo#IsDir().() { |
| 97 | return errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("%q is not a valid directory", dir)) |
| 98 | } |
| 99 | |
| 100 | var lockableFilter *filepathfilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/.Filterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/Filter# |
| 101 | var unlockableFilter *filepathfilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/.Filterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/Filter# |
| 102 | if lockablePatterns != nil { |
| 103 | lockableFilter = filepathfilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/New().(lockablePatterns, nil, filepathfilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/.GitAttributesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/GitAttributes., c.cfgscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#cfg..Gitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Configuration#Git.) |
| 104 | } |
| 105 | if unlockablePatterns != nil { |
| 106 | unlockableFilter = filepathfilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/New().(unlockablePatterns, nil, filepathfilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/.GitAttributesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/GitAttributes., c.cfgscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#cfg..Gitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Configuration#Git.) |
| 107 | } |
| 108 | |
| 109 | return c.fixFileWriteFlagsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#fixFileWriteFlags().(absPath, c.LocalWorkingDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#LocalWorkingDir., lockableFilter, unlockableFilter) |
| 110 | } |
| 111 | |
| 112 | // Internal implementation of fixing file write flags with precompiled filters |
| 113 | func (c *Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#) fixFileWriteFlagsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#fixFileWriteFlags().(absPath, workingDir string, lockable, unlockable *filepathfilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/.Filterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/Filter#) error { |
| 114 | |
| 115 | // Build a list of files |
| 116 | lsFiles, err := gitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/.NewLsFilesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/NewLsFiles().(workingDir, !c.ModifyIgnoredFilesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#ModifyIgnoredFiles., false) |
| 117 | if err != nil { |
| 118 | return err |
| 119 | } |
| 120 | |
| 121 | for f := range lsFiles.Filesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/LsFiles#Files. { |
| 122 | err = c.fixSingleFileWriteFlagsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#fixSingleFileWriteFlags().(f, lockable, unlockable) |
| 123 | if err != nil { |
| 124 | return err |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | return nil |
| 129 | } |
| 130 | |
| 131 | // FixLockableFileWriteFlags checks each file in the provided list, and for |
| 132 | // those which are lockable, makes sure their write flags are set correctly |
| 133 | // based on whether they are currently locked or unlocked. Files which are |
| 134 | // unlocked are made read-only, files which are locked are made writeable. |
| 135 | // Files which are not lockable are ignored. |
| 136 | // This function can be used after a clone or checkout to ensure that file |
| 137 | // state correctly reflects the locking state, and is more efficient than |
| 138 | // FixAllLockableFileWriteFlags when you know which files changed |
| 139 | func (c *Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#) FixLockableFileWriteFlagsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#FixLockableFileWriteFlags().(files []string) error { |
| 140 | // early-out if no lockable patterns |
| 141 | if len(c.GetLockablePatternsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#GetLockablePatterns().()) == 0 { |
| 142 | return nil |
| 143 | } |
| 144 | |
| 145 | var multiErr error |
| 146 | for _, f := range files { |
| 147 | err := c.fixSingleFileWriteFlagsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#fixSingleFileWriteFlags().(f, c.getLockableFilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#getLockableFilter().(), nil) |
| 148 | if err != nil { |
| 149 | multiErr = errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Joinscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/Join().(multiErr, err) |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | return multiErr |
| 154 | } |
| 155 | |
| 156 | // fixSingleFileWriteFlags fixes write flags on a single file |
| 157 | // If lockablePatterns is non-nil, then any file matching those patterns will be |
| 158 | // checked to see if it is currently locked by the current committer, and if so |
| 159 | // it will be writeable, and if not locked it will be read-only. |
| 160 | // If unlockablePatterns is non-nil, then any file matching those patterns will |
| 161 | // be made writeable if it is not already. This can be used to reset files to |
| 162 | // writeable when their 'lockable' attribute is turned off. |
| 163 | func (c *Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#) fixSingleFileWriteFlagsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#fixSingleFileWriteFlags().(file string, lockable, unlockable *filepathfilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/.Filterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/Filter#) error { |
| 164 | // Convert to git-style forward slash separators if necessary |
| 165 | // Necessary to match attributes |
| 166 | if filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Separatorscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Separator. == '\\' { |
| 167 | file = stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Replacescip-go gomod github.com/golang/go/src go1.25.0 strings/Replace().(file, "\\", "/", -1) |
| 168 | } |
| 169 | if lockable != nil && lockable.Allowsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/Filter#Allows().(file) { |
| 170 | // Lockable files are writeable only if they're currently locked |
| 171 | err := toolsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/.SetFileWriteFlagscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/SetFileWriteFlag().(file, c.IsFileLockedByCurrentCommitterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Client#IsFileLockedByCurrentCommitter().(file)) |
| 172 | // Ignore not exist errors |
| 173 | if err != nil && !osscip-go gomod github.com/golang/go/src go1.25.0 os/.IsNotExistscip-go gomod github.com/golang/go/src go1.25.0 os/IsNotExist().(err) { |
| 174 | return err |
| 175 | } |
| 176 | } else if unlockable != nil && unlockable.Allowsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/Filter#Allows().(file) { |
| 177 | // Unlockable files are always writeable |
| 178 | // We only check files which match the incoming patterns to avoid |
| 179 | // checking every file in the system all the time, and only do it |
| 180 | // when a file has had its lockable attribute removed |
| 181 | err := toolsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/.SetFileWriteFlagscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/SetFileWriteFlag().(file, true) |
| 182 | if err != nil && !osscip-go gomod github.com/golang/go/src go1.25.0 os/.IsNotExistscip-go gomod github.com/golang/go/src go1.25.0 os/IsNotExist().(err) { |
| 183 | return err |
| 184 | } |
| 185 | } |
| 186 | return nil |
| 187 | } |