diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2016-09-15 21:20:58 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2016-09-15 21:20:58 +0200 |
commit | 7e8d7125446bb6e12a056a5a6ca979727790d0df (patch) | |
tree | df07bada01b332d00131c33034d88935357ba0d1 /examples/clone/main.go | |
parent | d57f90b78eeb6b09b15e3fe57609ede66df4edac (diff) | |
download | go-git-7e8d7125446bb6e12a056a5a6ca979727790d0df.tar.gz |
dotgit: synced write packfile and index generation
Diffstat (limited to 'examples/clone/main.go')
-rw-r--r-- | examples/clone/main.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/examples/clone/main.go b/examples/clone/main.go index f95dc8f..0fa5fe6 100644 --- a/examples/clone/main.go +++ b/examples/clone/main.go @@ -1,6 +1,7 @@ package main import ( + "fmt" "io" "os" "path/filepath" @@ -15,15 +16,15 @@ func main() { url := os.Args[1] directory := os.Args[2] - r := git.NewMemoryRepository() + r, err := git.NewFilesystemRepository(directory) + checkIfError(err) // Clone the given repository, using depth we create a shallow clone : // > git clone <url> --depth 1 color.Blue("git clone %s --depth 1 %s", url, directory) - err := r.Clone(&git.CloneOptions{ - URL: url, - Depth: 1, + err = r.Clone(&git.CloneOptions{ + URL: url, }) checkIfError(err) @@ -34,6 +35,9 @@ func main() { commit, err := r.Commit(ref.Hash()) checkIfError(err) + fmt.Println(commit) + os.Exit(0) + // ... we get all the files from the commit files, err := commit.Files() checkIfError(err) |