Categorygithub.com/vektra/gitreader
modulepackage
0.0.0-20150106002542-abd11557f68c
Repository: https://github.com/vektra/gitreader.git
Documentation: pkg.go.dev

# README

gitreader

There are times, in a developers life, when they need to read data out of a git repository.

In those times, there are 3 paths to take:

  1. Shell out to the git subcommands to pull the data out
  2. Use an API that just shells out to git subcommands
  3. Use an API that implements parts of git itself

For various reasons, there are times where #1 and #2 are clunky and unacceptable. For those times, we have APIs that implement parts of git. This is one of those APIs.

This specific API implements a golang library that contains only the functionality to read a git repository on disk. No remote protocols, no ability to write new data, only reading.

So when you're in golang and need to read some data out a git repository, reach for gitreader, you'll be happy with yourself.

  • Vektra Devs

Usage

import "fmt"
import "gitreader"

repo, err := gitreader.OpenRepo("/path/to/repo")
if err != nil {
  panic(err)
}

blob, err := repo.CatFile("HEAD", "path/to/file")
if err != nil {
  panic(err)
}

// WARNING: use Blob as an io.Reader instead if you can!
bytes, err := blob.Bytes()
if err != nil {
  panic(err)
}

fmt.Printf("%s", bytes)

repo.Close()

# Functions

Load the pack data from the given path.
Open up a repository.
Read the data and construct a new Object.

# Variables

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
Entry
No description provided by the author
Implements reading objects out of the .git/objects directory.
No description provided by the author
Implements LoadObject for a pack file.
No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author