From 97506154331e65a966c7adf2ef8d7c19ae1dcd33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Fri, 9 Sep 2016 00:32:08 +0200 Subject: [PATCH] Fix inferred `pull-request` head for usernames with capital letters Fixes #1256 --- features/pull_request.feature | 18 ++++++++++++++++++ github/localrepo.go | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/features/pull_request.feature b/features/pull_request.feature index f97cbde2..3bb290a5 100644 --- a/features/pull_request.feature +++ b/features/pull_request.feature @@ -630,6 +630,24 @@ BODY When I successfully run `hub pull-request -m hereyougo` Then the output should contain exactly "the://url\n" + Scenario: Create pull request from branch on the personal fork, capitalized + Given the "origin" remote has url "git://github.com/LightAlf/FirstRepo.git" + And the "Kristinita" remote has url "git@github.com:Kristinita/FirstRepo.git" + And I am on the "add-py3kwarn" branch pushed to "Kristinita/add-py3kwarn" + And I am "Kristinita" on github.com with OAuth token "OTOKEN" + Given the GitHub API server: + """ + post('/repos/LightAlf/FirstRepo/pulls') { + assert :base => 'master', + :head => 'Kristinita:add-py3kwarn', + :title => 'hereyougo' + status 201 + json :html_url => "the://url" + } + """ + When I successfully run `hub pull-request -m hereyougo` + Then the output should contain exactly "the://url\n" + Scenario: Create pull request to "upstream" remote Given the "upstream" remote has url "git://github.com/github/coral.git" And I am on the "master" branch pushed to "origin/master" diff --git a/github/localrepo.go b/github/localrepo.go index 749ce6ad..f8ed720f 100644 --- a/github/localrepo.go +++ b/github/localrepo.go @@ -57,7 +57,7 @@ func (r *GitHubRepo) remotesForPublish(owner string) (remotes []Remote) { if owner != "" { for _, remote := range r.remotes { p, e := remote.Project() - if e == nil && strings.ToLower(p.Owner) == owner { + if e == nil && strings.EqualFold(p.Owner, owner) { remotesMap[remote.Name] = remote } } -- GitLab