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/main.go | |
| parent | fdd6d991070a78fbabcabd29a06ce2ccc4a7dfb9 (diff) | |
attempt to build an example
Diffstat (limited to 'go-git/main.go')
| -rw-r--r-- | go-git/main.go | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/go-git/main.go b/go-git/main.go new file mode 100644 index 0000000..79d1b71 --- /dev/null +++ b/go-git/main.go @@ -0,0 +1,52 @@ +package main + +import ( + "os" + + "github.com/go-git/go-git" +) + +func main() { + /* + // Filesystem abstraction based on memory + fs := memfs.New() + // Git objects storer based on memory + storer := memory.NewStorage() + */ + + _, err := git.PlainClone("/tmp/foo", false, &git.CloneOptions{ + URL: "https://github.com/go-git/go-git", + Progress: os.Stdout, + }) + /* + // Clones the repository into the worktree (fs) and stores all the .git + // content into the storer + _, err := git.Clone(storer, fs, &git.CloneOptions{ + URL: "https://github.com/git-fixtures/basic.git", + }) + if err != nil { + log.Fatal(err) + } + */ + + /* + // Prints the content of the CHANGELOG file from the cloned repository + changelog, err := fs.Open("CHANGELOG") + if err != nil { + log.Fatal(err) + } + + io.Copy(os.Stdout, changelog) + */ + /* + // Clone the given repository to the given directory + Info("git clone https://github.com/go-git/go-git") + + _, err := git.PlainClone("/tmp/foo", false, &git.CloneOptions{ + URL: "https://github.com/go-git/go-git", + Progress: os.Stdout, + }) + + CheckIfError(err) + */ +} |
