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

Commit b1da90b

Browse files
committed
storage/dotgit: use HasPrefix instead of Split
Also reformatted function comment and fixed some typos. Signed-off-by: Javi Fontan <jfontan@gmail.com>
1 parent c7a4011 commit b1da90b

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

storage/filesystem/dotgit/dotgit.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -283,11 +283,14 @@ func (d *DotGit) objectPath(h plumbing.Hash) string {
283283
return d.fs.Join(objectsPath, hash[0:2], hash[2:40])
284284
}
285285

286-
//incomingObjectPath is intended to add support for a git pre-recieve hook to be written
287-
//it adds support for go-git to find objects in an "incoming" directory, so that the library
288-
//can be used to write a pre-recieve hook that deals with the incoming objects.
289-
//More on git hooks found here : https://git-scm.com/docs/githooks
290-
//More on 'quarantine'/incoming directory here : https://git-scm.com/docs/git-receive-pack
286+
// incomingObjectPath is intended to add support for a git pre-receive hook
287+
// to be written it adds support for go-git to find objects in an "incoming"
288+
// directory, so that the library can be used to write a pre-receive hook
289+
// that deals with the incoming objects.
290+
//
291+
// More on git hooks found here : https://git-scm.com/docs/githooks
292+
// More on 'quarantine'/incoming directory here:
293+
// https://git-scm.com/docs/git-receive-pack
291294
func (d *DotGit) incomingObjectPath(h plumbing.Hash) string {
292295
hString := h.String()
293296

@@ -305,7 +308,7 @@ func (d *DotGit) hasIncomingObjects() bool {
305308
directoryContents, err := d.fs.ReadDir(objectsPath)
306309
if err == nil {
307310
for _, file := range directoryContents {
308-
if strings.Split(file.Name(), "-")[0] == "incoming" && file.IsDir() {
311+
if strings.HasPrefix(file.Name(), "incoming-") && file.IsDir() {
309312
d.incomingDirName = file.Name()
310313
}
311314
}

0 commit comments

Comments
 (0)