aboutsummaryrefslogtreecommitdiffstats
path: root/examples/log/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'examples/log/main.go')
-rw-r--r--examples/log/main.go37
1 files changed, 0 insertions, 37 deletions
diff --git a/examples/log/main.go b/examples/log/main.go
deleted file mode 100644
index 5eb4763..0000000
--- a/examples/log/main.go
+++ /dev/null
@@ -1,37 +0,0 @@
-package main
-
-import (
- "fmt"
-
- "srcd.works/go-git.v4"
- . "srcd.works/go-git.v4/examples"
- "srcd.works/go-git.v4/storage/memory"
-)
-
-func main() {
- // Clones the given repository, creating the remote, the local branches
- // and fetching the objects, everything in memory:
- Info("git clone https://github.com/src-d/go-siva")
- r, err := git.Clone(memory.NewStorage(), nil, &git.CloneOptions{URL: "https://github.com/src-d/go-siva"})
- CheckIfError(err)
-
- // Gets the HEAD history from HEAD, just like does:
- Info("git log")
-
- // ... retrieves the branch pointed by HEAD
- ref, err := r.Head()
- CheckIfError(err)
-
- // ... retrieves the commit object
- commit, err := r.Commit(ref.Hash())
- CheckIfError(err)
-
- // ... retrieves the commit history
- history, err := commit.History()
- CheckIfError(err)
-
- // ... just iterates over the commits, printing it
- for _, c := range history {
- fmt.Println(c)
- }
-}