Documentation ¶
Overview ¶
Package gitutil is a wrapper layer for handing calls to the git tool.
Copyright 2023 The Fuchsia Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Index ¶
- type AllOpt
- type AuthorDateOpt
- type BareOpt
- type Branch
- type BranchName
- type CachedOpt
- type CheckoutOpt
- type CloneOpt
- type CommitterDateOpt
- type DeleteBranchOpt
- type DepthOpt
- type DetachOpt
- type FetchOpt
- type FetchTagOpt
- type FfOnlyOpt
- type FollowTagsOpt
- type ForceOpt
- type Git
- func (g *Git) AddAllFiles() error
- func (g *Git) CheckoutBranch(branch string, gitSubmodules bool, opts ...CheckoutOpt) error
- func (g *Git) Clone(repo, path string, opts ...CloneOpt) error
- func (g *Git) CommitWithMessage(message string) error
- func (g *Git) ConfigAddKeyToFile(key string, file string, value string) error
- func (g *Git) ConfigGetKey(key string) (string, error)
- func (g *Git) ConfigGetKeyFromFile(key string, file string) (string, error)
- func (g *Git) Fetch(remote string, opts ...FetchOpt) error
- func (g *Git) FetchRefspec(remote, refspec string, opts ...FetchOpt) error
- func (g *Git) FilesWithUncommittedChanges() ([]string, error)
- func (g *Git) GetSymbolicRef() (string, error)
- func (g *Git) Remove(fileNames ...string) error
- func (g *Git) RootDir() string
- func (g *Git) SubmoduleAdd(remote string, path string) error
- func (g *Git) SubmoduleStatus(opts ...SubmoduleStatusOpt) (string, error)
- func (g *Git) SubmoduleUpdate(paths []string, opts ...SubmoduleUpdateOpt) error
- func (g *Git) Update(opts ...gitOpt)
- type GitError
- type InitOpt
- type JobsOpt
- type MergeOpt
- type ModeOpt
- type NoCheckoutOpt
- type OffloadPackfilesOpt
- type OmitBlobsOpt
- type PruneOpt
- type PushOpt
- type RebaseMerges
- type RebaseOpt
- type RecurseSubmodulesOpt
- type Reference
- type ReferenceOpt
- type ResetOnFailureOpt
- type ResetOpt
- type Revision
- type RootDirOpt
- type SharedOpt
- type SquashOpt
- type StrategyOpt
- type SubmoduleDirOpt
- type SubmoduleStatusOpt
- type SubmoduleUpdateOpt
- type TagsOpt
- type UpdateHeadOkOpt
- type UpdateShallowOpt
- type UserEmailOpt
- type UserNameOpt
- type VerifyOpt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CheckoutOpt ¶
type CheckoutOpt interface {
// contains filtered or unexported methods
}
CheckoutOpt is an interface for git checkout flags
type CloneOpt ¶
type CloneOpt interface {
// contains filtered or unexported methods
}
CloneOpt is an interface for git clone flags
type DeleteBranchOpt ¶
type DeleteBranchOpt interface {
// contains filtered or unexported methods
}
DeleteBranchOpt is an interface for git branch deletion flags
type FetchOpt ¶
type FetchOpt interface {
// contains filtered or unexported methods
}
FetchOpt is an interface for git fetch flags
type FetchTagOpt ¶
type FetchTagOpt string
FetchTagOpt is the tag argument for the 'tag' flag used by git fetch
type Git ¶
type Git struct {
// contains filtered or unexported fields
}
Git structure for environmental options passed to git tool.
func (*Git) AddAllFiles ¶
AddAllFiles adds/updates all file in working tree to staging.
func (*Git) CheckoutBranch ¶
func (g *Git) CheckoutBranch(branch string, gitSubmodules bool, opts ...CheckoutOpt) error
CheckoutBranch checks out the given branch.
func (*Git) Clone ¶
Clone clones the given repository to the given local path. If reference is not empty it uses the given path as a reference/shared repo.
func (*Git) CommitWithMessage ¶
CommitWithMessage commits all files in staging with the given message.
func (*Git) ConfigAddKeyToFile ¶
ConfigAddKeyToFile adds additional git configuration value to file.
func (*Git) ConfigGetKey ¶
ConfigGetKey gets current git configuration value for the given key.
func (*Git) ConfigGetKeyFromFile ¶
ConfigGetKeyFromFile gets current git configuration value for the given key from file.
Returns an empty string if the configuration value is not found.
func (*Git) FetchRefspec ¶
FetchRefspec fetches refs and tags from the given remote for a particular refspec.
func (*Git) FilesWithUncommittedChanges ¶
FilesWithUncommittedChanges returns the list of files that have uncommitted changes.
func (*Git) GetSymbolicRef ¶
GetSymbolicRef returns which branch working tree (HEAD) is on.
func (*Git) SubmoduleAdd ¶
SubmoduleAdd adds submodule to current branch.
func (*Git) SubmoduleStatus ¶
func (g *Git) SubmoduleStatus(opts ...SubmoduleStatusOpt) (string, error)
SubmoduleStatus returns current current status of submodules in a superproject.
func (*Git) SubmoduleUpdate ¶
func (g *Git) SubmoduleUpdate(paths []string, opts ...SubmoduleUpdateOpt) error
SubmoduleUpdate updates submodules for current branch.
type GitError ¶
type GitError struct { Root string Args []string Output string ErrorOutput string // contains filtered or unexported fields }
GitError structure for returning git process state.
type MergeOpt ¶
type MergeOpt interface {
// contains filtered or unexported methods
}
MergeOpt is an interface for git merge flags
type ModeOpt ¶
type ModeOpt string
ModeOpt is the mode argument for the 'mode' flag used by git reset
type OffloadPackfilesOpt ¶
type OffloadPackfilesOpt bool
OffloadPackfilesOpt is a flag used with git clone to fetch using https protocol
type OmitBlobsOpt ¶
type OmitBlobsOpt bool
OmitBlobsOpt is the 'filter=blob:none' (no binary blobs) git flag
type PushOpt ¶
type PushOpt interface {
// contains filtered or unexported methods
}
PushOpt is an interface for git push flags
type RebaseOpt ¶
type RebaseOpt interface {
// contains filtered or unexported methods
}
RebaseOpt is an interface for git rebase flags
type RecurseSubmodulesOpt ¶
type RecurseSubmodulesOpt bool
RecurseSubmodulesOpt is the 'recurse-submodules' git flag
type ReferenceOpt ¶
type ReferenceOpt string
ReferenceOpt is the reference argument for the git 'reference-if-able' flag used by git clone
type ResetOnFailureOpt ¶
type ResetOnFailureOpt bool
ResetOnFailureOpt flag enables a git reset of the merge if git merge errors
type ResetOpt ¶
type ResetOpt interface {
// contains filtered or unexported methods
}
ResetOpt is an interface for git reset flags
type StrategyOpt ¶
type StrategyOpt string
StrategyOpt is the strategy argument for the 'strategy' flag used by git merge
type SubmoduleDirOpt ¶
type SubmoduleDirOpt string
SubmoduleDirOpt is the relative path (from git root) to a submodule.
type SubmoduleStatusOpt ¶
type SubmoduleStatusOpt interface {
// contains filtered or unexported methods
}
SubmoduleStatusOpt is an interface for git submodule status flags
type SubmoduleUpdateOpt ¶
type SubmoduleUpdateOpt interface {
// contains filtered or unexported methods
}
SubmoduleUpdateOpt is an interface for git submodule update flags
type UpdateShallowOpt ¶
type UpdateShallowOpt bool
UpdateShallowOpt is the 'update-shallow' git flag