本文整理匯總了Golang中github.com/github/git-lfs/subprocess.SimpleExec函數的典型用法代碼示例。如果您正苦於以下問題:Golang SimpleExec函數的具體用法?Golang SimpleExec怎麽用?Golang SimpleExec使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了SimpleExec函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: LsRemote
func LsRemote(remote, remoteRef string) (string, error) {
if remote == "" {
return "", errors.New("remote required")
}
if remoteRef == "" {
return subprocess.SimpleExec("git", "ls-remote", remote)
}
return subprocess.SimpleExec("git", "ls-remote", remote, remoteRef)
}
示例2: UnsetLocalKey
// UnsetLocalKey removes the git config value for the key from the specified config file
func (c *gitConfig) UnsetLocalKey(file, key string) {
args := make([]string, 1, 5)
args[0] = "config"
if len(file) > 0 {
args = append(args, "--file", file)
}
args = append(args, "--unset", key)
subprocess.SimpleExec("git", args...)
}
示例3: SetLocal
// SetLocal sets the git config value for the key in the specified config file
func (c *gitConfig) SetLocal(file, key, val string) (string, error) {
args := make([]string, 1, 5)
args[0] = "config"
if len(file) > 0 {
args = append(args, "--file", file)
}
args = append(args, key, val)
return subprocess.SimpleExec("git", args...)
}
示例4: Version
// Version returns the git version
func (c *gitConfig) Version() (string, error) {
c.mu.Lock()
defer c.mu.Unlock()
if len(c.gitVersion) == 0 {
v, err := subprocess.SimpleExec("git", "version")
if err != nil {
return v, err
}
c.gitVersion = v
}
return c.gitVersion, nil
}
示例5: ResolveRef
func ResolveRef(ref string) (*Ref, error) {
outp, err := subprocess.SimpleExec("git", "rev-parse", ref, "--symbolic-full-name", ref)
if err != nil {
return nil, err
}
lines := strings.Split(outp, "\n")
if len(lines) <= 1 {
return nil, fmt.Errorf("Git can't resolve ref: %q", ref)
}
fullref := &Ref{Sha: lines[0]}
fullref.Type, fullref.Name = ParseRefToTypeAndName(lines[1])
return fullref, nil
}
示例6: ResolveRef
func ResolveRef(ref string) (*Ref, error) {
outp, err := subprocess.SimpleExec("git", "rev-parse", ref, "--symbolic-full-name", ref)
if err != nil {
return nil, fmt.Errorf("Git can't resolve ref: %q", ref)
}
if outp == "" {
return nil, fmt.Errorf("Git can't resolve ref: %q", ref)
}
lines := strings.Split(outp, "\n")
fullref := &Ref{Sha: lines[0]}
if len(lines) == 1 {
// ref is a sha1 and has no symbolic-full-name
fullref.Name = lines[0] // fullref.Sha
fullref.Type = RefTypeOther
return fullref, nil
}
// parse the symbolic-full-name
fullref.Type, fullref.Name = ParseRefToTypeAndName(lines[1])
return fullref, nil
}
示例7: List
// List lists all of the git config values
func (c *gitConfig) List() (string, error) {
return subprocess.SimpleExec("git", "config", "-l")
}
示例8: UnsetGlobalSection
func (c *gitConfig) UnsetGlobalSection(key string) {
subprocess.SimpleExec("git", "config", "--global", "--remove-section", key)
}
示例9: UnsetGlobal
// UnsetGlobal removes the git config value for the key from the global config
func (c *gitConfig) UnsetGlobal(key string) {
subprocess.SimpleExec("git", "config", "--global", "--unset", key)
}
示例10: SetGlobal
// SetGlobal sets the git config value for the key in the global config
func (c *gitConfig) SetGlobal(key, val string) {
subprocess.SimpleExec("git", "config", "--global", key, val)
}
示例11: SetGlobal
// SetGlobal sets the git config value for the key in the global config
func (c *gitConfig) SetGlobal(key, val string) (string, error) {
return subprocess.SimpleExec("git", "config", "--global", key, val)
}
示例12: UnsetSystemSection
// UnsetGlobalSection removes the entire named section from the system config
func (c *gitConfig) UnsetSystemSection(key string) (string, error) {
return subprocess.SimpleExec("git", "config", "--system", "--remove-section", key)
}
示例13: UnsetSystem
// UnsetSystem removes the git config value for the key from the system config
func (c *gitConfig) UnsetSystem(key string) (string, error) {
return subprocess.SimpleExec("git", "config", "--system", "--unset", key)
}
示例14: UnsetGlobal
// UnsetGlobal removes the git config value for the key from the global config
func (c *gitConfig) UnsetGlobal(key string) (string, error) {
return subprocess.SimpleExec("git", "config", "--global", "--unset", key)
}
示例15: SetSystem
// SetSystem sets the git config value for the key in the system config
func (c *gitConfig) SetSystem(key, val string) (string, error) {
return subprocess.SimpleExec("git", "config", "--system", key, val)
}