From dd2569a57e88f0509d649cced19c276ebfc52972 Mon Sep 17 00:00:00 2001 From: Jingwen Owen Ou Date: Tue, 2 Jul 2013 12:37:28 -0700 Subject: [PATCH] Fix merge message number --- commands/merge.go | 2 +- commands/merge_test.go | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/commands/merge.go b/commands/merge.go index 37f1b262..6923fe79 100644 --- a/commands/merge.go +++ b/commands/merge.go @@ -58,7 +58,7 @@ func fetchAndMerge(args *Args, pullRequest *octokat.PullRequest) error { mergeHead := fmt.Sprintf("%s/%s", user, branch) ref := fmt.Sprintf("+refs/heads/%s:refs/remotes/%s", branch, mergeHead) args.Before("git", "fetch", url, ref) - mergeMsg := fmt.Sprintf("Merge pull request #%v from %s\n\n%s", pullRequest.Id, mergeHead, pullRequest.Title) + mergeMsg := fmt.Sprintf("Merge pull request #%v from %s\n\n%s", pullRequest.Number, mergeHead, pullRequest.Title) args.AppendParams(mergeHead, "--no-ff", "-m", mergeMsg) return nil diff --git a/commands/merge_test.go b/commands/merge_test.go index 49603b0c..09dc36b2 100644 --- a/commands/merge_test.go +++ b/commands/merge_test.go @@ -8,12 +8,11 @@ import ( func TestFetchAndMerge(t *testing.T) { url := "https://github.com/jingweno/gh/pull/73" + number := 73 + title := "title" args := NewArgs([]string{"merge", url}) - id := 73 - title := "title" - userLogin := "jingweno" user := octokat.User{Login: userLogin} @@ -23,7 +22,7 @@ func TestFetchAndMerge(t *testing.T) { headRef := "new-feature" head := octokat.Commit{Ref: headRef, Repo: repo} - pullRequest := octokat.PullRequest{Id: id, Title: title, HTMLURL: url, User: user, Head: head} + pullRequest := octokat.PullRequest{Number: number, Title: title, HTMLURL: url, User: user, Head: head} err := fetchAndMerge(args, &pullRequest) assert.Equal(t, nil, err)