code: func lockPath(file string) (string, error) {
  	repo, err := git.RootDir()
  	if err != nil {
  		return "", err
  	}
  
  	wd, err := os.Getwd()
  	if err != nil {
  		return "", err
  	}
  	wd, err = filepath.EvalSymlinks(wd)
  	if err != nil {
  		return "", errors.Wrapf(err,
  			"could not follow symlinks for %s", wd)
  	}
  
  	abs := filepath.Join(wd, file)
  	path, err := filepath.Rel(repo, abs)
  	if err != nil {
  		return "", err
  	}
  
  	path = filepath.ToSlash(path)
  	if strings.HasPrefix(path, "../") {
  		return "", fmt.Errorf("lfs: unable to canonicalize path %q", path)
  	}
  
  	if stat, err := os.Stat(abs); err != nil {
  		return "", err
  	} else {
  		if stat.IsDir() {
  			return path, fmt.Errorf("lfs: cannot lock directory: %s", file)
  		}
  
  		return filepath.ToSlash(path), nil
  	}
  }
docs: // lockPaths relativizes the given filepath such that it is relative to the root
  // path of the repository it is contained within, taking into account the
  // working directory of the caller.
  //
  // lockPaths also respects different filesystem directory separators, so that a
  // Windows path of "\foo\bar" will be normalized to "foo/bar".
  //
  // If the root directory, working directory, or file cannot be
  // determined/opened, an error will be returned. If the file in question is
  // actually a directory, an error will be returned. Otherwise, the cleaned path
  // will be returned.
  //
  // For example:
  //     - Working directory: /code/foo/bar/
  //     - Repository root: /code/foo/
  //     - File to lock: ./baz
  //     - Resolved path bar/baz