From c72040a9fb2eae45eb2c3230e148afe302f23ba2 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Mon, 16 Dec 2024 23:58:52 -0600 Subject: attempt to build an example --- go-git/more.go | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 go-git/more.go (limited to 'go-git/more.go') diff --git a/go-git/more.go b/go-git/more.go new file mode 100644 index 0000000..b233948 --- /dev/null +++ b/go-git/more.go @@ -0,0 +1,35 @@ +package main + +import ( + "os" + + . "github.com/go-git/go-git/v5/_examples" +) + +// Basic example of how to clone a repository using clone options. +func more() { + CheckArgs("", "") + url := os.Args[1] + directory := os.Args[2] + + // Clone the given repository to the given directory + Info("git clone %s %s --recursive", url, directory) + + /* + r, err := git.PlainClone(directory, false, &git.CloneOptions{ + URL: url, + RecurseSubmodules: git.DefaultSubmoduleRecursionDepth, + }) + + CheckIfError(err) + + // ... retrieving the branch being pointed by HEAD + ref, err := r.Head() + CheckIfError(err) + // ... retrieving the commit object + commit, err := r.CommitObject(ref.Hash()) + CheckIfError(err) + + fmt.Println(commit) + */ +} -- cgit v1.2.3