Documentation
¶
Index ¶
- func IsPathGitManagementRoot(path string) (bool, error)
- func IsPathUnderGitManagement(path string) bool
- func RepositoryConfigPath(path string) (*gitConfig.Config, error)
- func RepositoryHeadByPath(path string) (*plumbing.Reference, error)
- func RepositoryNowBranchByPath(path string) (string, error)
- type GitRemoteInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsPathGitManagementRoot ¶
func IsPathUnderGitManagement ¶
IsPathUnderGitManagement
@Description: IsPathUnderGitManagement check path is under git management
func RepositoryConfigPath ¶
RepositoryConfigPath
cfg, err := git_tools.RepositoryConfigPath(projectRootPath)
if err != nil {
t.Fatal(err)
}
t.Logf("config: %v", cfg.Remotes["origin"].URLs[0])
more use See https://github.com/go-git/go-git/blob/v5.7.0/config/config_test.go#L18
Types ¶
type GitRemoteInfo ¶
type GitRemoteInfo struct {
UrlStr string
Scheme string
Host string
Hostname string
Port string
UserInfo *url.Userinfo
User string
Repo string
}
func RepositoryFistRemoteInfo ¶
func RepositoryFistRemoteInfo(path string, remote string) (*GitRemoteInfo, error)
RepositoryFistRemoteInfo
url, err := git_tools.RepositoryFistRemoteInfo(projectRootPath, "origin")
if err != nil {
t.Fatal(err)
}
t.Logf("url.Host: %s", url.Host)
t.Logf("url.User: %s", url.User)
t.Logf("url.Repo: %s", url.Repo)
See: https://mirrors.edge.kernel.org/pub/software/scm/git/docs/git-clone.html
Click to show internal directories.
Click to hide internal directories.