Documentation ¶
Index ¶
- Constants
- Variables
- func CurrentCommit(path string) (string, error)
- func GetRepositoryPath(dir string) (string, error)
- func Ignore(dir string, ignorePaths, excludePaths []string, marker string) (string, error)
- func IsRepository(dir string) bool
- func MetadataFor(path, ref string) (map[string]string, error)
- func Origin(path string) (string, error)
- type URL
Constants ¶
View Source
const ( IgnoreFile = ".gitignore" IgnoreDefaultMode = 0o644 NoRemoteRC = 2 )
Variables ¶
View Source
var ( ErrRemoteNotFound = errors.New("remote not found") ErrNotARepository = errors.New("not a git repository") ErrNoGit = errors.New("no git support") )
View Source
var ( RemoteRegex = regexp.MustCompile(`(?P<server>[\w.:]+)[/:](?P<owner>[\w.-]+)/(?P<project>[\w.-]+)\.git$`) CommitTemplates = map[string]string{ "github.com": "https://github.com/{{ .Owner }}/{{ .Project }}/commit/{{ .Ref }}", "gitlab.com": "https://gitlab.com/{{ .Owner }}/{{ .Project }}/-/commit/{{ .Ref }}", "bitbucket.org": "https://bitbucket.org/{{ .Owner }}/{{ .Project }}/commits/{{ .Ref }}", } )
Functions ¶
func CurrentCommit ¶ added in v0.106.0
func GetRepositoryPath ¶
GetRepositoryPath Returns the git repository root path if dir is a directory inside a git repository, otherwise returns error
func Ignore ¶
Ignore modify/create .ignore file to include a section headed by the marker string and contains the provided ignore and exclude paths. If the section exists, it will append paths to the given section, otherwise writes the section at the end of the file. All file paths must be absolute. dir is a path in the git repository, if a .gitignore file is not found, a new file will be created in the repository root
func IsRepository ¶
IsRepository Return true if dir is a path to a directory in a git repository, false otherwise
Types ¶
Click to show internal directories.
Click to hide internal directories.