Skip to content

Commit

Permalink
Explicitly set remote branch name when doing git push (#78)
Browse files Browse the repository at this point in the history
* Explicitly set remote branch name when doing git push

Before this change my local git (version 2.14.1) was setting `6.x` as
remote branch for a local `backport/6.x/pr-20572`. This will ensure the
right name is used

* Update snapshots
  • Loading branch information
exekias authored and sorenlouv committed Jul 20, 2018
1 parent 3c5f757 commit c3ee625
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/lib/git.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function createAndCheckoutBranch(owner, repoName, baseBranch, featureBranch) {
}

function push(owner, repoName, username, branchName) {
return rpc.exec(`git push ${username} ${branchName} --force`, {
return rpc.exec(`git push ${username} ${branchName}:${branchName} --force`, {
cwd: env.getRepoPath(owner, repoName)
});
}
Expand Down
6 changes: 3 additions & 3 deletions test/__snapshots__/cliService.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Array [
[Function],
],
Array [
"git push sqren backport/6.x/pr-myPullRequest_pr-myOtherPullRequest --force",
"git push sqren backport/6.x/pr-myPullRequest_pr-myOtherPullRequest:backport/6.x/pr-myPullRequest_pr-myOtherPullRequest --force",
Object {
"cwd": "/myHomeDir/.backport/repositories/elastic/kibana",
"maxBuffer": 104857600,
Expand Down Expand Up @@ -134,7 +134,7 @@ Array [
[Function],
],
Array [
"git push sqren backport/6.x/pr-myPullRequest_pr-myOtherPullRequest --force",
"git push sqren backport/6.x/pr-myPullRequest_pr-myOtherPullRequest:backport/6.x/pr-myPullRequest_pr-myOtherPullRequest --force",
Object {
"cwd": "/myHomeDir/.backport/repositories/elastic/kibana",
"maxBuffer": 104857600,
Expand Down Expand Up @@ -166,7 +166,7 @@ Array [
[Function],
],
Array [
"git push sqren backport/6.x/commit-mySha --force",
"git push sqren backport/6.x/commit-mySha:backport/6.x/commit-mySha --force",
Object {
"cwd": "/myHomeDir/.backport/repositories/elastic/kibana",
"maxBuffer": 104857600,
Expand Down
8 changes: 4 additions & 4 deletions test/__snapshots__/steps.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Array [
[Function],
],
Array [
"git push sqren backport/6.2/pr-myPullRequest --force",
"git push sqren backport/6.2/pr-myPullRequest:backport/6.2/pr-myPullRequest --force",
Object {
"cwd": "/myHomeDir/.backport/repositories/elastic/kibana",
"maxBuffer": 104857600,
Expand Down Expand Up @@ -105,7 +105,7 @@ Array [
[Function],
],
Array [
"git push sqren backport/6.2/pr-myPullRequest --force",
"git push sqren backport/6.2/pr-myPullRequest:backport/6.2/pr-myPullRequest --force",
Object {
"cwd": "/myHomeDir/.backport/repositories/elastic/kibana",
"maxBuffer": 104857600,
Expand Down Expand Up @@ -160,7 +160,7 @@ Array [
[Function],
],
Array [
"git push sqren backport/6.2/pr-myPullRequest --force",
"git push sqren backport/6.2/pr-myPullRequest:backport/6.2/pr-myPullRequest --force",
Object {
"cwd": "/myHomeDir/.backport/repositories/elastic/kibana",
"maxBuffer": 104857600,
Expand Down Expand Up @@ -215,7 +215,7 @@ Array [
[Function],
],
Array [
"git push sqren backport/6.2/pr-myPullRequest --force",
"git push sqren backport/6.2/pr-myPullRequest:backport/6.2/pr-myPullRequest --force",
Object {
"cwd": "/myHomeDir/.backport/repositories/elastic/kibana",
"maxBuffer": 104857600,
Expand Down

0 comments on commit c3ee625

Please sign in to comment.