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/main.go | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 go-git/main.go (limited to 'go-git/main.go') 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) + */ +} -- cgit v1.2.3