Package git provides an incomplete pure Go implementation of Git core methods.

Related tags

git go
Overview

git GoDoc

Package git provides an incomplete pure Go implementation of Git core methods.

Example

Code:

store := git.TempStore()
defer os.RemoveAll(string(store))

buf := new(bytes.Buffer)

// blob
bdata := []byte("hello, world")

bw := store.Writer()
bw.WriteHeader(git.Blob, len(bdata))
bw.Write(bdata)
bw.Close()

br, _ := store.Reader(bw.Hash())
io.Copy(buf, br)
br.Close()

buf.WriteRune('\n')

// tree
tdata := []byte(fmt.Sprintf("100644 blob %s\t%s\n", bw.Hash(), "hello.txt"))

tw := store.Writer()
tw.WriteHeader(git.Tree, -1)
tw.Write(tdata)
tw.Close()

tr, _ := store.Reader(tw.Hash(), git.PrettyReader)
io.Copy(buf, tr)
tr.Close()

fmt.Println(strings.Replace(buf.String(), "\t", " ", -1))

Output:

hello, world
100644 blob 8c01d89ae06311834ee4b1fab2f0414d35f01102 hello.txt

Caveats

  • Currently limited to loose objects
  • Reader and Writer for tree objects will likely fail on short reads and large content. Straight-forward to fix.
Owner
Daniel Skinner
despiteallobjections return
Daniel Skinner
Tool to manage multiple git repositories

go-many-git Tool to manage multiple git repositories Requirements Proper go installation with GOPATH set git >= 1.8.5 Installation go get -u github.co

Adrien Brochard 27 Aug 22, 2020
Installs git repos onto your system and keeps them up-to-date

Gitfile Installs git repos onto your system and keeps them up-to-date. It's a lightweight package manager for things that haven't been published to a

Brad Urani 18 Jan 16, 2021
Lenient VCS repository URL parsing library for Go

============================================= go-vcsurl - Lenient VCS repository URL parser go-vcsurl parses VCS repository URLs in many common format

Sourcegraph 14 Dec 23, 2019
Git with a cup of tea, painless self-hosted git service

Gitea - Git with a cup of tea View the chinese version of this document Purpose The goal of this project is to make the easiest, fastest, and most pai

Gitea 26.3k Sep 19, 2021
Semantic Versioning (semver) library written in golang

semver for golang semver is a Semantic Versioning library written in golang. It fully covers spec version 2.0.0. Versioning Old v1-v3 versions exist i

Benedikt Lang 833 Sep 1, 2021
A diff tool especially for Go language.

go-diff A diff tool for Go languange. It shows the semantic differences between two Go source files. Ignored Difference Order of import statements Ord

Yi Deng 67 Feb 11, 2021
Inter Blockchain Bank @cosmos

Interstellar Interstellar is a blockchain built using Cosmos SDK and Tendermint and created with Starport. Interstellar provides borrowing services fo

Sapeins-cosmos 4 Jul 11, 2021
Git folder digger, I'm sure it's worthwhile stuff.

Gigger Git folder digger, I'm sure it's worthwhile stuff. Installation Download a prebuilt binary from releases page. or If you have recent go compile

Rıza Sabuncu 38 Aug 28, 2021