diff options
| author | Jeff Carr <[email protected]> | 2024-12-16 23:58:52 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-12-16 23:58:52 -0600 |
| commit | c72040a9fb2eae45eb2c3230e148afe302f23ba2 (patch) | |
| tree | 75bf03ebdebaa8202515f81fe980b4e4b224483e /go-git/more.go | |
| parent | fdd6d991070a78fbabcabd29a06ce2ccc4a7dfb9 (diff) | |
attempt to build an example
Diffstat (limited to 'go-git/more.go')
| -rw-r--r-- | go-git/more.go | 35 |
1 files changed, 35 insertions, 0 deletions
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>", "<directory>") + 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) + */ +} |
