forked from smarty/gitreview
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathworker.go
More file actions
42 lines (37 loc) · 709 Bytes
/
worker.go
File metadata and controls
42 lines (37 loc) · 709 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package main
import (
"log"
"path/filepath"
)
type Worker struct {
id int
branch string
in chan string
out chan *GitReport
}
func NewWorker(id int, branch string, in chan string, out chan *GitReport) *Worker {
return &Worker{
id: id,
branch: branch,
in: in,
out: out,
}
}
func (this *Worker) Start() {
for path := range this.in {
this.out <- this.git(path)
}
close(this.out)
}
func (this *Worker) git(path string) *GitReport {
path, _ = filepath.Abs(path)
report := &GitReport{RepoPath: path}
if !report.GitSkipStatus() {
report.GitRemote()
report.GitStatus()
report.GitFetch()
report.GitRevList()
}
log.Println(report.Progress())
return report
}