syncBranchCmds syncs a branch to ref: a hard reset when force is set, otherwise a fast-forward-only merge. A non-empty path runs the commands there.
(path, ref string, force bool)
| 342 | // syncBranchCmds syncs a branch to ref: a hard reset when force is set, |
| 343 | // otherwise a fast-forward-only merge. A non-empty path runs the commands there. |
| 344 | func syncBranchCmds(path, ref string, force bool) [][]string { |
| 345 | var prefix []string |
| 346 | if path != "" { |
| 347 | prefix = []string{"-C", path} |
| 348 | } |
| 349 | if force { |
| 350 | return [][]string{append(prefix, "reset", "--hard", ref)} |
| 351 | } |
| 352 | // TODO: check if non-fast-forward and suggest to use `--force` |
| 353 | return [][]string{append(prefix, "merge", "--ff-only", ref)} |
| 354 | } |
| 355 | |
| 356 | func executeCmds(client *git.Client, credentialPattern git.CredentialPattern, cmdQueue [][]string) error { |
| 357 | for _, args := range cmdQueue { |
no outgoing calls
no test coverage detected