gitcli

package module
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 13, 2022 License: MIT Imports: 8 Imported by: 2

README

godoc

go-gitcli

Lightweight wrapper around git cli. This is simpler alternative to libgit2 bindings, it also (will) have builtin GPG signing support (which is main reason for that lib as libgit2 doesnt have it yet).

Requirements: git in the path.

Lib will sanitize git env, removing things like language variables so output of git commands are consistent

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repo

type Repo struct {
	// contains filtered or unexported fields
}

func New

func New(repoDir string, args ...string) Repo

func (*Repo) Checkout

func (r *Repo) Checkout(extraArgs ...string) error

func (*Repo) Clean

func (r *Repo) Clean(extraArgs ...string) error

func (*Repo) Fetch

func (r *Repo) Fetch(extraArgs ...string) error

func (*Repo) GetCommitSignature

func (r *Repo) GetCommitSignature(commit string) (key string, signed bool, err error)

verify a given commit's GPG sig anything that refers to commit will work (like HEAD~3)

func (*Repo) HardReset added in v0.0.3

func (r *Repo) HardReset() error

reset and remove index also gets rid of "index smaller than expected" problem

func (*Repo) Init

func (r *Repo) Init() error

func (*Repo) Log

func (r *Repo) Log(extraArgs ...string) error

func (*Repo) Pull

func (r *Repo) Pull(extraArgs ...string) error

func (*Repo) Push

func (r *Repo) Push(extraArgs ...string) error

func (*Repo) SetDebug

func (r *Repo) SetDebug(d bool)

func (*Repo) SetRemote

func (r *Repo) SetRemote(remoteName string, remoteUrl string) error

Add or set a given remote

func (*Repo) SetTrustedSignatures

func (r *Repo) SetTrustedSignatures(sigs []string)

SetTrustedSignatures sets a list of signatures considered valid for VerifyCommit() USE LONG FORMAT (full fingerprint), for now git log only passes 16 characters of fingerprint but if that ever changes any sig that will be shorter than that won't be matched

func (*Repo) SubmoduleInit

func (r *Repo) SubmoduleInit(extraArgs ...string) error

func (*Repo) SubmoduleSync

func (r *Repo) SubmoduleSync(extraArgs ...string) error

func (*Repo) SubmoduleUpdate

func (r *Repo) SubmoduleUpdate(extraArgs ...string) error

func (*Repo) VerifyCommit

func (r *Repo) VerifyCommit(commit string) (bool, error)

VerifyCommit checks if given commit is signed by one of sigs set in SetTrustedSignatures git log only passes 16 characters of fingerprint so it only checks for substring of that signature

func (*Repo) Version

func (r *Repo) Version() (string, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL