aboutsummaryrefslogtreecommitdiffstats
path: root/examples/progress/main.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-01-30 16:13:56 +0100
committerMáximo Cuadros <mcuadros@gmail.com>2017-01-30 16:13:56 +0100
commit35378e7db9288e8244f2634a1b47981606731cef (patch)
tree65936a6a365263c93e4b57c3b67aad6a13489e68 /examples/progress/main.go
parent45669655f026a31577f938ee70ae613c2e4af184 (diff)
parenta48bc6e17ef6298f93ec21cdf1a5e387640673b6 (diff)
downloadgo-git-35378e7db9288e8244f2634a1b47981606731cef.tar.gz
example: using new constructors
Diffstat (limited to 'examples/progress/main.go')
-rw-r--r--examples/progress/main.go15
1 files changed, 6 insertions, 9 deletions
diff --git a/examples/progress/main.go b/examples/progress/main.go
index e0e4c1d..46ff57a 100644
--- a/examples/progress/main.go
+++ b/examples/progress/main.go
@@ -12,20 +12,17 @@ func main() {
url := os.Args[1]
directory := os.Args[2]
- r, err := git.NewFilesystemRepository(directory)
- CheckIfError(err)
-
- // as git does, when you make a clone, pull or some other operations, the
- // server sends information via the sideband, this information can being
- // collected provinding a io.Writer to the repository
- r.Progress = os.Stdout
-
// Clone the given repository to the given directory
Info("git clone %s %s", url, directory)
- err = r.Clone(&git.CloneOptions{
+ _, err := git.PlainClone(directory, false, &git.CloneOptions{
URL: url,
Depth: 1,
+
+ // as git does, when you make a clone, pull or some other operations the
+ // server sends information via the sideband, this information can being
+ // collected provinding a io.Writer to the CloneOptions options
+ Progress: os.Stdout,
})
CheckIfError(err)