gitutil

package
v0.0.0-...-c44c8e0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: BSD-3-Clause Imports: 9 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AllOpt

type AllOpt bool

AllOpt is the 'all' git flag

type AuthorDateOpt

type AuthorDateOpt string

AuthorDateOpt is the git author date.

type BareOpt

type BareOpt bool

BareOpt is the 'bare' git flag

type Branch

type Branch struct {
	*Reference
	Tracking *Reference
}

Branch structure tracks the state of a branch.

type BranchName

type BranchName string

BranchName is a git branch name.

type CachedOpt

type CachedOpt bool

CachedOpt is the 'cached' git flag

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 CommitterDateOpt

type CommitterDateOpt string

CommitterDateOpt is the git committer date.

type DeleteBranchOpt

type DeleteBranchOpt interface {
	// contains filtered or unexported methods
}

DeleteBranchOpt is an interface for git branch deletion flags

type DepthOpt

type DepthOpt int

DepthOpt is the numeric argument for the 'depth' flag used by git

type DetachOpt

type DetachOpt bool

DetachOpt is the 'detach' git flag

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 FfOnlyOpt

type FfOnlyOpt bool

FfOnlyOpt is the 'ff-only' git flag

type FollowTagsOpt

type FollowTagsOpt bool

FollowTagsOpt is the 'follow-tags' git flag

type ForceOpt

type ForceOpt bool

ForceOpt is the 'force' git flag

type Git

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

Git structure for environmental options passed to git tool.

func New

func New(opts ...gitOpt) *Git

New is the Git factory.

func (*Git) AddAllFiles

func (g *Git) AddAllFiles() error

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

func (g *Git) Clone(repo, path string, opts ...CloneOpt) error

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

func (g *Git) CommitWithMessage(message string) error

CommitWithMessage commits all files in staging with the given message.

func (*Git) ConfigAddKeyToFile

func (g *Git) ConfigAddKeyToFile(key string, file string, value string) error

ConfigAddKeyToFile adds additional git configuration value to file.

func (*Git) ConfigGetKey

func (g *Git) ConfigGetKey(key string) (string, error)

ConfigGetKey gets current git configuration value for the given key.

func (*Git) ConfigGetKeyFromFile

func (g *Git) ConfigGetKeyFromFile(key string, file string) (string, error)

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) Fetch

func (g *Git) Fetch(remote string, opts ...FetchOpt) error

Fetch fetches refs and tags from the given remote.

func (*Git) FetchRefspec

func (g *Git) FetchRefspec(remote, refspec string, opts ...FetchOpt) error

FetchRefspec fetches refs and tags from the given remote for a particular refspec.

func (*Git) FilesWithUncommittedChanges

func (g *Git) FilesWithUncommittedChanges() ([]string, error)

FilesWithUncommittedChanges returns the list of files that have uncommitted changes.

func (*Git) GetSymbolicRef

func (g *Git) GetSymbolicRef() (string, error)

GetSymbolicRef returns which branch working tree (HEAD) is on.

func (*Git) Remove

func (g *Git) Remove(fileNames ...string) error

Remove removes the given files.

func (*Git) RootDir

func (g *Git) RootDir() string

RootDir returns the root directory of the Git object.

func (*Git) SubmoduleAdd

func (g *Git) SubmoduleAdd(remote string, path string) error

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.

func (*Git) Update

func (g *Git) Update(opts ...gitOpt)

Update allows updating of an existing Git object.

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.

func (GitError) Error

func (ge GitError) Error() string

Error outputs GitError struct as a string.

type InitOpt

type InitOpt bool

InitOpt is the 'init' git flag

type JobsOpt

type JobsOpt uint

JobsOpt is the numeric argument for the 'jobs' flag used by git

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 NoCheckoutOpt

type NoCheckoutOpt bool

NoCheckoutOpt is the 'no-checkout' git flag

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 PruneOpt

type PruneOpt bool

PruneOpt is the 'prune' git flag

type PushOpt

type PushOpt interface {
	// contains filtered or unexported methods
}

PushOpt is an interface for git push flags

type RebaseMerges

type RebaseMerges bool

RebaseMerges is the 'rebase-merges' git flag

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 Reference

type Reference struct {
	Name     string
	Revision string
	IsHead   bool
}

Reference structure is a branch reference information.

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 Revision

type Revision string

Revision is a git revision.

type RootDirOpt

type RootDirOpt string

RootDirOpt is the git root directory.

type SharedOpt

type SharedOpt bool

SharedOpt is the 'shared' git flag

type SquashOpt

type SquashOpt bool

SquashOpt is the 'squash' git flag

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 TagsOpt

type TagsOpt bool

TagsOpt is the 'tags' git flag

type UpdateHeadOkOpt

type UpdateHeadOkOpt bool

UpdateHeadOkOpt is the 'update-head-ok' git flag

type UpdateShallowOpt

type UpdateShallowOpt bool

UpdateShallowOpt is the 'update-shallow' git flag

type UserEmailOpt

type UserEmailOpt string

UserEmailOpt is the git user email.

type UserNameOpt

type UserNameOpt string

UserNameOpt is the git username.

type VerifyOpt

type VerifyOpt bool

VerifyOpt is the 'verify' git flag

Jump to

Keyboard shortcuts

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