-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmain.go
More file actions
41 lines (39 loc) · 765 Bytes
/
main.go
File metadata and controls
41 lines (39 loc) · 765 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
package main
import (
"fmt"
"github.com/VictorLowther/go-git/git"
)
func main() {
r,err := git.Init(".")
if err != nil {
panic(err)
}
fmt.Printf("Initialized ourself!\n")
for k,v := range r.Find("user.") {
fmt.Printf("%s: %v\n",k,v)
}
r.Set("foo.bar","bar")
v,ok := r.Get("foo.bar")
fmt.Printf("%v: %v\n",v,ok)
if clean,statLines := r.IsClean(); clean {
fmt.Println("Repo is clean")
} else {
for _,l := range statLines {
fmt.Printf("%s\n",l.Print())
}
}
fmt.Printf("Creating throwaway branch\n")
br,err := r.Branch("throwaway","HEAD")
if err != nil {
panic(err)
}
tag, err := r.Tag("faketag",br)
if err != nil {
panic(err)
}
for name,r := range r.Refs() {
fmt.Printf("%s: %s\n",name,r.SHA)
}
tag.Delete()
br.Delete()
}