git

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package git provides helper functions to work with Git repository - and mainly its configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigValue

func ConfigValue(key string) string

ConfigValue returns the "best" value for the given configuration key. It respects the "git config" algorithm to search for a value: - first, the local git repository based on the working directory - then the global git config, either in $HOME/.gitconfig or $XDG_CONFIG_HOME/git/config or $HOME/.config/git/config - and finally the system git config, from /etc/gitconfig If not found, it will return an empty string. The key syntax is the same as used in the "git config" cmdline: a dot-separated path of elements. For example: `user.name` or `remote.origin.url`.

func CurrentRepositoryURL

func CurrentRepositoryURL() string

CurrentRepositoryURL returns the URL of the current git repository, based on the "origin" remote URL. If no repository could be found (from the current working directory), or if there is no "origin" remote configured, it will return an empty string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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