fork of go-git with some jj specific features

error strings: Don't capitalize, use periods, or newlines

Per [Go Code Review Comments][1],

> Error strings should not be capitalized (unless beginning with proper
> nouns or acronyms) or end with punctuation

staticcheck's [ST1005][2] also complains about these. For example,

```
object_walker.go:63:10: error strings should not be capitalized (ST1005)
object_walker.go:101:10: error strings should not be capitalized (ST1005)
object_walker.go:101:10: error strings should not end with punctuation or a newline (ST1005)
plumbing/format/commitgraph/file.go:17:26: error strings should not be capitalized (ST1005)
```

This fixes all instances of this issue reported by staticcheck.

[1]: https://github.com/golang/go/wiki/CodeReviewComments#error-strings
[2]: https://staticcheck.io/docs/checks/#ST1005

Changed files
+18 -18
config
plumbing
format
commitgraph
gitattributes
idxfile
object
storage
filesystem
dotgit
memory
+1 -1
config/config.go
··· 150 150 // config file to the given scope, a empty one is returned. 151 151 func LoadConfig(scope Scope) (*Config, error) { 152 152 if scope == LocalScope { 153 - return nil, fmt.Errorf("LocalScope should be read from the a ConfigStorer.") 153 + return nil, fmt.Errorf("LocalScope should be read from the a ConfigStorer") 154 154 } 155 155 156 156 files, err := Paths(scope)
+2 -2
object_walker.go
··· 60 60 // Fetch the object. 61 61 obj, err := object.GetObject(p.Storer, hash) 62 62 if err != nil { 63 - return fmt.Errorf("Getting object %s failed: %v", hash, err) 63 + return fmt.Errorf("getting object %s failed: %v", hash, err) 64 64 } 65 65 // Walk all children depending on object type. 66 66 switch obj := obj.(type) { ··· 98 98 return p.walkObjectTree(obj.Target) 99 99 default: 100 100 // Error out on unhandled object types. 101 - return fmt.Errorf("Unknown object %X %s %T\n", obj.ID(), obj.Type(), obj) 101 + return fmt.Errorf("unknown object %X %s %T", obj.ID(), obj.Type(), obj) 102 102 } 103 103 return nil 104 104 }
+3 -3
plumbing/format/commitgraph/file.go
··· 14 14 var ( 15 15 // ErrUnsupportedVersion is returned by OpenFileIndex when the commit graph 16 16 // file version is not supported. 17 - ErrUnsupportedVersion = errors.New("Unsupported version") 17 + ErrUnsupportedVersion = errors.New("unsupported version") 18 18 // ErrUnsupportedHash is returned by OpenFileIndex when the commit graph 19 19 // hash function is not supported. Currently only SHA-1 is defined and 20 20 // supported 21 - ErrUnsupportedHash = errors.New("Unsupported hash algorithm") 21 + ErrUnsupportedHash = errors.New("unsupported hash algorithm") 22 22 // ErrMalformedCommitGraphFile is returned by OpenFileIndex when the commit 23 23 // graph file is corrupted. 24 - ErrMalformedCommitGraphFile = errors.New("Malformed commit graph file") 24 + ErrMalformedCommitGraphFile = errors.New("malformed commit graph file") 25 25 26 26 commitFileSignature = []byte{'C', 'G', 'P', 'H'} 27 27 oidFanoutSignature = []byte{'O', 'I', 'D', 'F'}
+1 -1
plumbing/format/gitattributes/attributes.go
··· 15 15 16 16 var ( 17 17 ErrMacroNotAllowed = errors.New("macro not allowed") 18 - ErrInvalidAttributeName = errors.New("Invalid attribute name") 18 + ErrInvalidAttributeName = errors.New("invalid attribute name") 19 19 ) 20 20 21 21 type MatchAttribute struct {
+2 -2
plumbing/format/idxfile/decoder.go
··· 12 12 var ( 13 13 // ErrUnsupportedVersion is returned by Decode when the idx file version 14 14 // is not supported. 15 - ErrUnsupportedVersion = errors.New("Unsupported version") 15 + ErrUnsupportedVersion = errors.New("unsupported version") 16 16 // ErrMalformedIdxFile is returned by Decode when the idx file is corrupted. 17 - ErrMalformedIdxFile = errors.New("Malformed IDX file") 17 + ErrMalformedIdxFile = errors.New("malformed IDX file") 18 18 ) 19 19 20 20 const (
+2 -2
plumbing/object/change_adaptor.go
··· 16 16 17 17 var err error 18 18 if ret.From, err = newChangeEntry(c.From); err != nil { 19 - return nil, fmt.Errorf("From field: %s", err) 19 + return nil, fmt.Errorf("from field: %s", err) 20 20 } 21 21 22 22 if ret.To, err = newChangeEntry(c.To); err != nil { 23 - return nil, fmt.Errorf("To field: %s", err) 23 + return nil, fmt.Errorf("to field: %s", err) 24 24 } 25 25 26 26 return ret, nil
+1 -1
prune.go
··· 17 17 Handler PruneHandler 18 18 } 19 19 20 - var ErrLooseObjectsNotSupported = errors.New("Loose objects not supported") 20 + var ErrLooseObjectsNotSupported = errors.New("loose objects not supported") 21 21 22 22 // DeleteObject deletes an object from a repository. 23 23 // The type conveniently matches PruneHandler.
+2 -2
remote.go
··· 260 260 tagObject, err := object.GetObject(r.s, tag.Hash()) 261 261 var tagCommit *object.Commit 262 262 if err != nil { 263 - return fmt.Errorf("get tag object: %w\n", err) 263 + return fmt.Errorf("get tag object: %w", err) 264 264 } 265 265 266 266 if tagObject.Type() != plumbing.TagObject { ··· 274 274 275 275 tagCommit, err = object.GetCommit(r.s, annotatedTag.Target) 276 276 if err != nil { 277 - return fmt.Errorf("get annotated tag commit: %w\n", err) 277 + return fmt.Errorf("get annotated tag commit: %w", err) 278 278 } 279 279 280 280 // only include tags that are reachable from one of the refs
+2 -2
repository.go
··· 56 56 ErrWorktreeNotProvided = errors.New("worktree should be provided") 57 57 ErrIsBareRepository = errors.New("worktree not available in a bare repository") 58 58 ErrUnableToResolveCommit = errors.New("unable to resolve commit") 59 - ErrPackedObjectsNotSupported = errors.New("Packed objects not supported") 59 + ErrPackedObjectsNotSupported = errors.New("packed objects not supported") 60 60 ) 61 61 62 62 // Repository represents a git repository ··· 1547 1547 } 1548 1548 1549 1549 if c == nil { 1550 - return &plumbing.ZeroHash, fmt.Errorf(`No commit message match regexp : "%s"`, re.String()) 1550 + return &plumbing.ZeroHash, fmt.Errorf("no commit message match regexp: %q", re.String()) 1551 1551 } 1552 1552 1553 1553 commit = c
+1 -1
storage/filesystem/dotgit/reader.go
··· 66 66 func (e *EncodedObject) SetSize(int64) {} 67 67 68 68 func (e *EncodedObject) Writer() (io.WriteCloser, error) { 69 - return nil, fmt.Errorf("Not supported") 69 + return nil, fmt.Errorf("not supported") 70 70 } 71 71 72 72 func NewEncodedObject(dir *DotGit, h plumbing.Hash, t plumbing.ObjectType, size int64) *EncodedObject {
+1 -1
storage/memory/storage.go
··· 193 193 return nil 194 194 } 195 195 196 - var errNotSupported = fmt.Errorf("Not supported") 196 + var errNotSupported = fmt.Errorf("not supported") 197 197 198 198 func (o *ObjectStorage) LooseObjectTime(hash plumbing.Hash) (time.Time, error) { 199 199 return time.Time{}, errNotSupported