Documentation ¶
Index ¶
- type AuthOpts
- type BareRepo
- func (b BareRepo) CommitsBetween(ctx context.Context, from, to time.Time, branch string) ([]Commit, error)
- func (b BareRepo) DefaultBranch(ctx context.Context) (string, error)
- func (b BareRepo) FetchURL(ctx context.Context) (string, error)
- func (b BareRepo) FileSize(ctx context.Context, filename string) (int64, error)
- func (b BareRepo) ListFiles(ctx context.Context) ([]string, error)
- func (b BareRepo) Name(ctx context.Context) (string, error)
- func (b BareRepo) Path() string
- func (b BareRepo) ReadFile(ctx context.Context, filename string) (io.Reader, error)
- func (b BareRepo) Tags(ctx context.Context) ([]Tag, error)
- type CloneOpts
- type Commit
- type DescribeOpt
- type Description
- type File
- type FileDiffDetail
- type Hunk
- type Option
- type PGPKey
- type Repo
- func (r Repo) Add(ctx context.Context, s ...string) error
- func (r Repo) Checkout(ctx context.Context, branch string) error
- func (r Repo) CheckoutNewBranch(ctx context.Context, branch string) error
- func (r Repo) Commit(ctx context.Context, m string, opts ...Option) error
- func (r Repo) Commits(ctx context.Context, from, to string) ([]Commit, error)
- func (r Repo) CommitsBetween(ctx context.Context, from, to time.Time, branch string) ([]Commit, error)
- func (r Repo) CurrentBranch(ctx context.Context) (string, error)
- func (r Repo) CurrentSnapshot(ctx context.Context) (map[string]File, error)
- func (r Repo) DefaultBranch(ctx context.Context) (string, error)
- func (r Repo) DeleteBranch(ctx context.Context, branch string) error
- func (r Repo) DeleteHook(name string) error
- func (r Repo) Describe(ctx context.Context, opt *DescribeOpt) (*Description, error)
- func (r Repo) Diff(ctx context.Context, hash string, filename string) (string, error)
- func (r Repo) ExistsDiff(ctx context.Context) bool
- func (r Repo) FetchRemoteBranch(ctx context.Context, remote, branch string) error
- func (r Repo) FetchRemoteTag(ctx context.Context, remote, tag string) error
- func (r Repo) FetchRemoteTags(ctx context.Context, remote string) error
- func (r Repo) FetchURL(ctx context.Context) (string, error)
- func (r Repo) GetCommit(ctx context.Context, hash string) (Commit, error)
- func (r Repo) GetCommitWithDiff(ctx context.Context, hash string) (Commit, error)
- func (r Repo) GetTag(ctx context.Context, tagName string) (Tag, error)
- func (r Repo) Glob(s string) ([]string, error)
- func (r Repo) HasDiverged(ctx context.Context) (bool, error)
- func (r Repo) HookList() ([]string, error)
- func (r Repo) LatestCommit(ctx context.Context) (Commit, error)
- func (r Repo) LocalBranchExists(ctx context.Context, branch string) (exists, hasUpstream bool)
- func (r Repo) LocalConfigGet(ctx context.Context, section, key string) (string, error)
- func (r Repo) LocalConfigSet(ctx context.Context, section, key, value string) error
- func (r Repo) Name(ctx context.Context) (string, error)
- func (r Repo) Open(s string) (*os.File, error)
- func (r Repo) Pull(ctx context.Context, remote, branch string) error
- func (r Repo) Push(ctx context.Context, remote, branch string, opts ...Option) error
- func (r Repo) PushTags(ctx context.Context, remote string, opts ...Option) error
- func (r Repo) RemoteAdd(ctx context.Context, remote, branch, url string) error
- func (r Repo) RemoteShow(ctx context.Context, remote string) (string, error)
- func (r Repo) Remove(ctx context.Context, s ...string) error
- func (r Repo) ResetHard(ctx context.Context, hash string) error
- func (r Repo) Status(ctx context.Context) (string, error)
- func (r Repo) SubmoduleUpdate(ctx context.Context, opt SubmoduleOpt) error
- func (r Repo) Tags(ctx context.Context) ([]Tag, error)
- func (r Repo) VerifyCommit(ctx context.Context, commit string) error
- func (r Repo) VerifyTag(ctx context.Context, tag string) (string, error)
- func (r Repo) Write(s string, content io.Reader) error
- func (r Repo) WriteHook(name string, content []byte) error
- type SSHKey
- type SubmoduleOpt
- type Tag
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BareRepo ¶ added in v0.1.7
type BareRepo struct {
// contains filtered or unexported fields
}
func NewBare ¶ added in v0.1.7
NewBare instanciance a bare repo instance from the path assuming the repo has already been cloned in.
func (BareRepo) CommitsBetween ¶ added in v0.1.9
func (BareRepo) DefaultBranch ¶ added in v0.1.9
type Commit ¶
type Commit struct { LongHash string Hash string Author string AuthorEmail string Subject string Body string Date time.Time Files map[string]File GPGKeyID string }
Commit represent a git commit
type DescribeOpt ¶ added in v0.3.0
type Description ¶ added in v0.3.0
type File ¶
type File struct { Filename string Status string Diff string DiffDetail FileDiffDetail }
type FileDiffDetail ¶
type FileDiffDetail struct {
Hunks []Hunk
}
type Option ¶
Option is a function option
func InstallPGPKey ¶
InstallPGPKey install a pgp key in the repo configuration
func WithHTTPAuth ¶
WithHTTPAuth override the repo configuration to use http auth
func WithSSHAuth ¶
WithSSHAuth configure the git command to use a specific private key
func WithSignKey ¶ added in v0.2.0
func WithVerbose ¶
WithVerbose add some logs
type Repo ¶
type Repo struct {
// contains filtered or unexported fields
}
Repo is the main type of this lib
func Clone ¶
Clone a git repository from the specified url to the destination path. Use Options to force the use of SSH Key and or PGP Key on this repo
func CloneBare ¶ added in v0.1.7
CloneBare a git bare repository from the specified url to the destination path. Use Options to force the use of SSH Key and or PGP Key on this repo
func New ¶
New instanciance a repo instance from the path assuming the repo has already been cloned in.
func (Repo) CheckoutNewBranch ¶
CheckoutNewBranch checkouts a new branch on the local repository
func (Repo) CommitsBetween ¶ added in v0.1.9
func (Repo) CurrentBranch ¶
CurrentBranch returns the current branch
func (Repo) CurrentSnapshot ¶
func (Repo) DefaultBranch ¶
DefaultBranch returns the default branch of the remote origin
func (Repo) DeleteBranch ¶
DeleteBranch deletes a branch on the local repository
func (Repo) DeleteHook ¶
func (Repo) Describe ¶ added in v0.3.0
func (r Repo) Describe(ctx context.Context, opt *DescribeOpt) (*Description, error)
func (Repo) ExistsDiff ¶ added in v0.1.6
ExistsDiff returns true if there are no commited diff in the repo.
func (Repo) FetchRemoteBranch ¶
FetchRemoteBranch runs a git fetch then checkout the remote branch
func (Repo) FetchRemoteTag ¶ added in v0.1.3
FetchRemoteTag deletes given tag if exists, then fetch new tags and checkout given tag.
func (Repo) FetchRemoteTags ¶ added in v0.2.0
FetchRemoteTags fetch all tags
func (Repo) GetCommitWithDiff ¶ added in v0.1.4
GetCommitWithDiff return the commit data with the parsed diff
func (Repo) LatestCommit ¶
LatestCommit returns the latest commit of the current branch
func (Repo) LocalBranchExists ¶ added in v0.1.6
LocalBranchExists returns if given branch exists locally and has upstream.
func (Repo) LocalConfigGet ¶
LocalConfigGet returns data from the local git config
func (Repo) LocalConfigSet ¶
LocalConfigSet set data in the local git config
func (Repo) RemoteShow ¶ added in v0.1.7
RemoteShow run git remote show
func (Repo) SubmoduleUpdate ¶ added in v0.2.3
func (r Repo) SubmoduleUpdate(ctx context.Context, opt SubmoduleOpt) error
func (Repo) VerifyCommit ¶ added in v0.2.0
func (Repo) VerifyTag ¶ added in v0.1.4
VerifyTag returns the sha1 of the tag if exists, if it doesn't exist, it returns an error