Merge remote-tracking branch 'origin/merge-interactive-merge' into remote-delete
This commit is contained in:
commit
e643765027
3 changed files with 29 additions and 4 deletions
|
|
@ -549,7 +549,7 @@ func prMerge(cmd *cobra.Command, args []string) error {
|
|||
|
||||
fmt.Fprintf(colorableOut(cmd), "%s %s pull request #%d\n", utils.Magenta("✔"), action, pr.Number)
|
||||
|
||||
if deleteBranch {
|
||||
if deleteBranch && !cmd.Flags().Changed("repo") {
|
||||
repo, err := api.GitHubRepo(apiClient, baseRepo)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
|||
|
|
@ -1017,6 +1017,31 @@ func TestPrMerge(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestPrMerge_withRepoFlag(t *testing.T) {
|
||||
initBlankContext("", "OWNER/REPO", "master")
|
||||
http := initFakeHTTP()
|
||||
http.StubResponse(200, bytes.NewBufferString(`{ "data": { "repository": {
|
||||
"pullRequest": { "number": 1, "closed": false, "state": "OPEN"}
|
||||
} } }`))
|
||||
http.StubResponse(200, bytes.NewBufferString(`{"id": "THE-ID"}`))
|
||||
|
||||
cs, cmdTeardown := test.InitCmdStubber()
|
||||
defer cmdTeardown()
|
||||
|
||||
eq(t, len(cs.Calls), 0)
|
||||
|
||||
output, err := RunCommand("pr merge 1 --merge -R stinky/boi")
|
||||
if err != nil {
|
||||
t.Fatalf("error running command `pr merge`: %v", err)
|
||||
}
|
||||
|
||||
r := regexp.MustCompile(`Merged pull request #1`)
|
||||
|
||||
if !r.MatchString(output.String()) {
|
||||
t.Fatalf("output did not match regexp /%s/\n> output\n%q\n", r, output.Stderr())
|
||||
}
|
||||
}
|
||||
|
||||
func TestPrMerge_deleteBranch(t *testing.T) {
|
||||
initWithStubs("blueberries",
|
||||
stubResponse{200, bytes.NewBufferString(`
|
||||
|
|
|
|||
|
|
@ -204,8 +204,8 @@ func ReadBranchConfig(branch string) (cfg BranchConfig) {
|
|||
}
|
||||
|
||||
func DeleteLocalBranch(branch string) error {
|
||||
configCmd := GitCommand("branch", "-d", branch)
|
||||
_, err := run.PrepareCmd(configCmd).Output()
|
||||
branchCmd := GitCommand("branch", "-D", branch)
|
||||
err := run.PrepareCmd(branchCmd).Run()
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
@ -223,7 +223,7 @@ func HasLocalBranch(branch string) bool {
|
|||
|
||||
func CheckoutBranch(branch string) error {
|
||||
configCmd := GitCommand("checkout", branch)
|
||||
_, err := run.PrepareCmd(configCmd).Output()
|
||||
err := run.PrepareCmd(configCmd).Run()
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue