diff options
author | Javi Fontan <jfontan@gmail.com> | 2018-08-27 14:45:24 +0200 |
---|---|---|
committer | Javi Fontan <jfontan@gmail.com> | 2018-08-27 14:45:24 +0200 |
commit | b1da90b0dde34b521cb252bc28c59e4ffd840d1d (patch) | |
tree | 46dbccafbd2b6e7bae4d13aa3b2adafc009d0322 /storage | |
parent | c7a4011d78a00bd93a2f82a39bb67c2dda5453f5 (diff) | |
download | go-git-b1da90b0dde34b521cb252bc28c59e4ffd840d1d.tar.gz |
storage/dotgit: use HasPrefix instead of Split
Also reformatted function comment and fixed some typos.
Signed-off-by: Javi Fontan <jfontan@gmail.com>
Diffstat (limited to 'storage')
-rw-r--r-- | storage/filesystem/dotgit/dotgit.go | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/storage/filesystem/dotgit/dotgit.go b/storage/filesystem/dotgit/dotgit.go index addb64c..df4f756 100644 --- a/storage/filesystem/dotgit/dotgit.go +++ b/storage/filesystem/dotgit/dotgit.go @@ -283,11 +283,14 @@ func (d *DotGit) objectPath(h plumbing.Hash) string { return d.fs.Join(objectsPath, hash[0:2], hash[2:40]) } -//incomingObjectPath is intended to add support for a git pre-recieve hook to be written -//it adds support for go-git to find objects in an "incoming" directory, so that the library -//can be used to write a pre-recieve hook that deals with the incoming objects. -//More on git hooks found here : https://git-scm.com/docs/githooks -//More on 'quarantine'/incoming directory here : https://git-scm.com/docs/git-receive-pack +// incomingObjectPath is intended to add support for a git pre-receive hook +// to be written it adds support for go-git to find objects in an "incoming" +// directory, so that the library can be used to write a pre-receive hook +// that deals with the incoming objects. +// +// More on git hooks found here : https://git-scm.com/docs/githooks +// More on 'quarantine'/incoming directory here: +// https://git-scm.com/docs/git-receive-pack func (d *DotGit) incomingObjectPath(h plumbing.Hash) string { hString := h.String() @@ -305,7 +308,7 @@ func (d *DotGit) hasIncomingObjects() bool { directoryContents, err := d.fs.ReadDir(objectsPath) if err == nil { for _, file := range directoryContents { - if strings.Split(file.Name(), "-")[0] == "incoming" && file.IsDir() { + if strings.HasPrefix(file.Name(), "incoming-") && file.IsDir() { d.incomingDirName = file.Name() } } |