go: go.chromium.org/chromiumos/infra/go/internal/git Index | Files

package git

import "go.chromium.org/chromiumos/infra/go/internal/git"

Copyright 2019 The Chromium OS 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

Package Files

git.go

Variables

var (
    CommandRunnerImpl cmd.CommandRunner = cmd.RealCommandRunner{}
)

func CommitAll Uses

func CommitAll(gitRepo, commitMsg string) error

CommitAll adds all local changes and commits them.

func CreateBranch Uses

func CreateBranch(gitRepo, branch string) error

CreateBranch creates a branch.

func GetCurrentBranch Uses

func GetCurrentBranch(cwd string) string

GetCurrentBranch returns current branch of a repo, and an empty string if repo is on detached HEAD.

func GetGitRepoRevision Uses

func GetGitRepoRevision(cwd string) (string, error)

GetGitRepoRevision finds and returns the revision of a branch.

func MatchBranchName Uses

func MatchBranchName(gitRepo string, pattern *regexp.Regexp) ([]string, error)

MatchBranchName returns the names of branches who match the specified regular expression.

func NormalizeRef Uses

func NormalizeRef(ref string) string

NormalizeRef converts git branch refs into fully qualified form.

func PushChanges Uses

func PushChanges(gitRepo, localRef, commitMsg string, dryRun bool, pushTo RemoteRef) error

PushGitChanges stages and commits any local changes before pushing the commit to the specified remote ref.

func StripRefs Uses

func StripRefs(ref string) string

StripRefs removes leading 'refs/heads/', 'refs/remotes/[^/]+/' from a ref name.

func StripRefsHead Uses

func StripRefsHead(ref string) string

StipRefsHead removes leading 'refs/heads/' from a ref name.

type CommandOutput Uses

type CommandOutput struct {
    Stdout string
    Stderr string
}

func RunGit Uses

func RunGit(gitRepo string, cmd []string) (CommandOutput, error)

RunGit the specified git command in the specified repo. It returns stdout and stderr.

type RemoteRef Uses

type RemoteRef struct {
    Remote string
    Ref    string
}

Struct representing a remote ref.

Package git imports 6 packages (graph) and is imported by 3 packages. Updated 2019-07-18. Refresh now. Tools for package owners.