clair: Index | Files

package gitutil

import ""

Package gitutil implements an easy way to update a git repository to a local temporary directory.


Package Files



var ErrFailedClone = errors.New("failed to clone git repository")

ErrFailedClone is returned when a git clone is unsuccessful.

var ErrFailedPull = errors.New("failed to pull git repository")

ErrFailedPull is returned when a git pull is unsuccessful.

var ErrFailedRevParse = errors.New("failed to rev-parse git repository")

ErrFailedRevParse is returned when a git rev-parse is unsuccessful.

func CloneOrPull Uses

func CloneOrPull(remote, repoPath, tempDirPrefix string) (path, head string, err error)

CloneOrPull performs a git pull if there is a git repository located at repoPath. Otherwise, it performs a git clone to that path.

If repoPath is left empty, a temporary directory is generated with the provided prefix and returned.

Package gitutil imports 6 packages (graph) and is imported by 2 packages. Updated 2018-11-19. Refresh now. Tools for package owners.