git

package
v0.105.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2023 License: Apache-2.0 Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	IgnoreFile        = ".gitignore"
	IgnoreDefaultMode = 0644
)

Variables

View Source
var (
	ErrNotARepository = errors.New("not a git repository")
	ErrNoGit          = errors.New("no git support")
)

Functions

func GetRepositoryPath

func GetRepositoryPath(dir string) (string, error)

GetRepositoryPath Returns the git repository root path if dir is a directory inside a git repository, otherwise returns error

func Ignore

func Ignore(dir string, ignorePaths, excludePaths []string, marker string) (string, error)

Ignore modify/create .ignore file to include a section headed by the marker string and contains the provided ignore and exclude paths. If 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

func IsRepository(dir string) bool

IsRepository Return true if dir is a path to a directory in a git repository, false otherwise

Types

This section is empty.

Jump to

Keyboard shortcuts

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