commands,locking: remove lfs message prefixes

Several error messages output by the "git lfs lock" command
currently begin with an "lfs:" prefix, which is unlike any
other error messages from that command (or from other commands,
for that matter).

We can therefore simplify our message strings slightly by
simply removing this prefix from them.

Note that two of these messages are not yet passed as translation
strings, but we will address that issue in a subsequent commit.
This commit is contained in:
Chris Darroch 2022-01-25 23:47:36 -08:00
parent 2eb80e53c8
commit f506d7535f
2 changed files with 5 additions and 5 deletions

@ -103,7 +103,7 @@ func lockPath(file string) (string, error) {
if filepath.IsAbs(file) {
abs, err = tools.CanonicalizeSystemPath(file)
if err != nil {
return "", errors.New(tr.Tr.Get("lfs: unable to canonicalize path %q: %v", file, err))
return "", errors.New(tr.Tr.Get("unable to canonicalize path %q: %v", file, err))
}
} else {
abs = filepath.Join(wd, file)
@ -115,11 +115,11 @@ func lockPath(file string) (string, error) {
path = filepath.ToSlash(path)
if strings.HasPrefix(path, "../") {
return "", errors.New(tr.Tr.Get("lfs: unable to canonicalize path %q", path))
return "", errors.New(tr.Tr.Get("unable to canonicalize path %q", path))
}
if stat, err := os.Stat(abs); err == nil && stat.IsDir() {
return path, errors.New(tr.Tr.Get("lfs: cannot lock directory: %s", file))
return path, errors.New(tr.Tr.Get("cannot lock directory: %s", file))
}
return filepath.ToSlash(path), nil

@ -23,10 +23,10 @@ import (
var (
// ErrNoMatchingLocks is an error returned when no matching locks were
// able to be resolved
ErrNoMatchingLocks = errors.New("lfs: no matching locks found")
ErrNoMatchingLocks = errors.New("no matching locks found")
// ErrLockAmbiguous is an error returned when multiple matching locks
// were found
ErrLockAmbiguous = errors.New("lfs: multiple locks found; ambiguous")
ErrLockAmbiguous = errors.New("multiple locks found; ambiguous")
)
type LockCacher interface {