code: func (c *Client) fixSingleFileWriteFlags(file string, lockable, unlockable *filepathfilter.Filter) error {
  	// Convert to git-style forward slash separators if necessary
  	// Necessary to match attributes
  	if filepath.Separator == '\\' {
  		file = strings.Replace(file, "\\", "/", -1)
  	}
  	if lockable != nil && lockable.Allows(file) {
  		// Lockable files are writeable only if they're currently locked
  		err := tools.SetFileWriteFlag(file, c.IsFileLockedByCurrentCommitter(file))
  		// Ignore not exist errors
  		if err != nil && !os.IsNotExist(err) {
  			return err
  		}
  	} else if unlockable != nil && unlockable.Allows(file) {
  		// Unlockable files are always writeable
  		// We only check files which match the incoming patterns to avoid
  		// checking every file in the system all the time, and only do it
  		// when a file has had its lockable attribute removed
  		err := tools.SetFileWriteFlag(file, true)
  		if err != nil && !os.IsNotExist(err) {
  			return err
  		}
  	}
  	return nil
  }
docs: // fixSingleFileWriteFlags fixes write flags on a single file
  // If lockablePatterns is non-nil, then any file matching those patterns will be
  // checked to see if it is currently locked by the current committer, and if so
  // it will be writeable, and if not locked it will be read-only.
  // If unlockablePatterns is non-nil, then any file matching those patterns will
  // be made writeable if it is not already. This can be used to reset files to
  // writeable when their 'lockable' attribute is turned off.