Documentation ¶
Overview ¶
Package git provides handling for the git source control system. Currently it is a thin wrapper over the git command line.
Index ¶
- Constants
- type ChangeList
- type Git
- func (g Git) CanApplyPatch(ctx context.Context, patch string) (bool, error)
- func (g Git) Checkout(ctx context.Context, sha SHA) error
- func (g Git) CheckoutBranch(ctx context.Context, branch string) error
- func (g Git) CurrentBranch(ctx context.Context) (string, error)
- func (g Git) Fetch(ctx context.Context) (localNew, remoteNew int, err error)
- func (g Git) Get(ctx context.Context, path string, at SHA) ([]byte, error)
- func (g Git) GetPatch(ctx context.Context, from, to SHA) (string, error)
- func (g Git) HeadCL(ctx context.Context, at string) (ChangeList, error)
- func (g Git) Log(ctx context.Context, count int) ([]ChangeList, error)
- func (g Git) LogFrom(ctx context.Context, at string, count int) ([]ChangeList, error)
- func (g Git) Parent(ctx context.Context, cl ChangeList) (ChangeList, error)
- func (g Git) Rebase(ctx context.Context, targetBranch string) error
- func (g Git) ResetToHead(ctx context.Context) error
- func (g Git) Status(ctx context.Context) (Status, error)
- type SHA
- type Status
Constants ¶
const ( FetchHead = "FETCH_HEAD" Head = "HEAD" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChangeList ¶
type Git ¶
type Git struct {
// contains filtered or unexported fields
}
Git is a go-wrapper for the git version control system.
func (Git) CanApplyPatch ¶
CanApplyPatch returns true if the specified patch can be applied to HEAD without conficts.
func (Git) CheckoutBranch ¶ added in v1.1.0
CheckoutBranch checks out the given branch by name.
func (Git) CurrentBranch ¶
CurrentBranch returns the current branch name at HEAD.
func (Git) Fetch ¶
Fetch performs a `git fetch` call. The number of new CLs locally and remotely for the current branch is returned.
func (Git) Parent ¶
func (g Git) Parent(ctx context.Context, cl ChangeList) (ChangeList, error)
Parent returns the parent ChangeList for cl.
func (Git) ResetToHead ¶
ResetToHead performs a 'git clean -f -d' followed by 'git checkout .'.
type SHA ¶
type SHA [20]byte
SHA represents a Git changelist SHA.
func (SHA) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
func (*SHA) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
type Status ¶
type Status struct { NotUpdated []string UpdatedInIndex []string AddedToIndex []string DeletedFromIndex []string RenamedInIndex []string CopiedInIndex []string IndexAndWorkTreeMatches []string WorkTreeChangedSinceIndex []string DeletedInWorkTree []string UnmergedBothDeleted []string UnmergedAddedByUs []string UnmergedDeletedByThem []string UnmergedAddedByThem []string UnmergedDeletedByUs []string UnmergedBothAdded []string UnmergedBothModified []string Untracked []string Ignored []string }