modulepackage
0.0.0-20220328024126-2ee2aa9d18c6
Repository: https://github.com/nivl/git-go.git
Documentation: pkg.go.dev
# README
git-go
Basic git implementation in pure Go
Current features
CLI
Porcelain
- init
Plumbing
- hash-object
- cat-file
Library
- Retrieve objects
- Write loose objects
- Read/Write References
Roadmap
CLI
See the CLI project
Library
See the Library project
Dev
We use task as task runner / build tool. The main commands are:
task test
to run the teststask install
to install thegit-go
to the GOPATHtask build
to create agit
binary in the./bin
directorytask dev -w
to have the binary at./bin/git
automatically rebuilt with every change in the code
Getting Started with the lib
The git package should contain everything you need to do most of the common operations. For more advanced operations, you should use the ginternals package.
You can take a look at our smoke tests for examples of usage.
# Packages
Package backend contains structs and methods to store and retrieve data from the .git directory.
No description provided by the author
Package env contains a wrapper around the environment, making it easier to write code and tests that use environment variables.
Package ginternals contains objects and methods to work on git internals.
Package smoke contains a bunch of smoke tests.
# Functions
InitRepository initialize a new git repository by creating the .git directory in the given path, which is where almost everything that Git stores and manipulates is located.
InitRepositoryWithOptions initialize a new git repository by creating the .git directory in the given path, which is where almost everything that Git stores and manipulates is located.
InitRepositoryWithParams initialize a new git repository by creating the .git directory in the given path, which is where almost everything that Git stores and manipulates is located.
OpenRepository loads an existing git repository by reading its config file, and returns a Repository instance
This assumes: - The repo is not bare (see WithOptions) - We're not interested in env vars (see WithParams) - The git dir is in the working tree under .git.
OpenRepositoryWithOptions loads an existing git repository by reading its config file, and returns a Repository instance
This assumes: - We're not interested in env vars (see WithParams) - The git dir is in the working tree under .git.
OpenRepositoryWithParams loads an existing git repository by reading its config file, and returns a Repository instance
This method makes no assumptions.
# Variables
List of errors returned by the Repository struct.
List of errors returned by the Repository struct.
List of errors returned by the Repository struct.
List of errors returned by the Repository struct.
List of errors returned by the Repository struct.
List of errors returned by the Repository struct.
# Structs
InitOptions contains all the optional data used to initialized a repository.
OpenOptions contains all the optional data used to open a repository.
Repository represent a git repository A Git repository is the .git/ folder inside a project.
TreeBuilder is used to build trees.