blob: c922d35b07864c9d65ea5ea75b74b3b3026a456c (
plain) (
blame)
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
|
package main
import (
"fmt"
"io"
"os"
"gopkg.in/src-d/go-git.v2"
)
func main() {
fmt.Printf("Retrieving %q ...\n", os.Args[2])
r, err := git.NewRepository(os.Args[2], nil)
if err != nil {
panic(err)
}
if err := r.Pull("origin", "refs/heads/master"); err != nil {
panic(err)
}
dumpCommits(r)
}
func dumpCommits(r *git.Repository) {
iter := r.Commits()
defer iter.Close()
for {
commit, err := iter.Next()
if err != nil {
if err == io.EOF {
break
}
panic(err)
}
fmt.Println(commit)
}
}
|