Merge pull request jingweno/gh:65 from jingweno/fix_merge_msg_number

Fix merge message number
This commit is contained in:
Jingwen Owen Ou 2013-07-02 12:38:11 -07:00
Родитель 1d22725666 dd2569a57e
Коммит 67eb2f9209
2 изменённых файлов: 4 добавлений и 5 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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)