Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Commit 5ec2de7

Browse files
committed
Readability improvements
1 parent 07e4c43 commit 5ec2de7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tree.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ type TreeEntry struct {
3131
// New errors defined by this package.
3232
var ErrFileNotFound = errors.New("file not found")
3333

34+
// File returns the hash of the file identified by the `path` argument.
35+
// The path is interpreted as relative to the tree receiver.
3436
func (t *Tree) File(path string) (*File, error) {
35-
hash, err := t.hashOf(path)
37+
hash, err := t.findHash(path)
3638
if err != nil {
3739
return nil, ErrFileNotFound
3840
}
@@ -52,7 +54,7 @@ func (t *Tree) File(path string) (*File, error) {
5254
return &File{Name: path, Reader: blob.Reader(), Hash: *hash}, nil
5355
}
5456

55-
func (t *Tree) hashOf(path string) (*core.Hash, error) {
57+
func (t *Tree) findHash(path string) (*core.Hash, error) {
5658
pathParts := strings.Split(path, "/")
5759

5860
var tree *Tree

0 commit comments

Comments
 (0)