зеркало из https://github.com/mislav/hub.git
Allow `args.Before/After` in combination with `NoForward`
This commit is contained in:
Родитель
3255fce35f
Коммит
8d5a3e9103
|
@ -53,17 +53,17 @@ func (a *Args) Replace(executable, command string, params ...string) {
|
|||
a.Command = command
|
||||
a.Params = params
|
||||
a.GlobalFlags = []string{}
|
||||
a.noForward = false
|
||||
}
|
||||
|
||||
func (a *Args) Commands() []*cmd.Cmd {
|
||||
result := []*cmd.Cmd{}
|
||||
result := a.beforeChain
|
||||
|
||||
if !a.noForward {
|
||||
result = append(result, a.beforeChain...)
|
||||
result = append(result, a.ToCmd())
|
||||
result = append(result, a.afterChain...)
|
||||
}
|
||||
|
||||
result = append(result, a.afterChain...)
|
||||
return result
|
||||
}
|
||||
|
||||
|
|
|
@ -80,13 +80,12 @@ func fork(cmd *Command, args *Args) {
|
|||
}
|
||||
}
|
||||
|
||||
if flagForkNoRemote {
|
||||
args.NoForward()
|
||||
} else {
|
||||
args.NoForward()
|
||||
if !flagForkNoRemote {
|
||||
originURL := originRemote.URL.String()
|
||||
url := forkProject.GitURL("", "", true)
|
||||
args.Replace("git", "remote", "add", "-f", newRemoteName, originURL)
|
||||
args.After("git", "remote", "set-url", newRemoteName, url)
|
||||
args.Before("git", "remote", "add", "-f", newRemoteName, originURL)
|
||||
args.Before("git", "remote", "set-url", newRemoteName, url)
|
||||
|
||||
args.AfterFn(func() error {
|
||||
ui.Printf("new remote: %s\n", newRemoteName)
|
||||
|
|
Загрузка…
Ссылка в новой задаче