aboutsummaryrefslogtreecommitdiffstats
path: root/examples/open/main.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-01-31 23:09:28 +0100
committerMáximo Cuadros <mcuadros@gmail.com>2017-01-31 23:09:52 +0100
commita6197bd8c459c7d10717bd9486c17f6c8b3f7f88 (patch)
tree63180ec210c66fda317c87197d2f6bab508406b6 /examples/open/main.go
parent2308066c28d3cbbfb472fb634c3e10a1c7786cfc (diff)
downloadgo-git-a6197bd8c459c7d10717bd9486c17f6c8b3f7f88.tar.gz
documentation changes
Diffstat (limited to 'examples/open/main.go')
-rw-r--r--examples/open/main.go35
1 files changed, 0 insertions, 35 deletions
diff --git a/examples/open/main.go b/examples/open/main.go
deleted file mode 100644
index aa51935..0000000
--- a/examples/open/main.go
+++ /dev/null
@@ -1,35 +0,0 @@
-package main
-
-import (
- "fmt"
- "os"
-
- "srcd.works/go-git.v4"
- . "srcd.works/go-git.v4/examples"
-)
-
-func main() {
- CheckArgs("<path>")
- path := os.Args[1]
-
- // We instance a new repository targeting the given path (the .git folder)
- r, err := git.PlainOpen(path)
- CheckIfError(err)
-
- // Length of the HEAD history
- Info("git rev-list HEAD --count")
-
- // ... retrieving the HEAD reference
- ref, err := r.Head()
- CheckIfError(err)
-
- // ... retrieving the commit object
- commit, err := r.Commit(ref.Hash())
- CheckIfError(err)
-
- // ... calculating the commit history
- commits, err := commit.History()
- CheckIfError(err)
-
- fmt.Println(len(commits))
-}