Skip to content

Commit ce75bf9

Browse files
Merge pull request #3 from thoughtbot/nc/force-push-branch
Force push when creating a new branch
2 parents 8af5c16 + 80fd88b commit ce75bf9

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

lib/executor.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def handle_open(action)
120120
detail: "No changes after pinning — packages may already be at latest."
121121
)
122122
end
123-
@git.push(branch: spec.branch)
123+
@git.push(branch: spec.branch, force: true)
124124
number = @gh.create_pr(
125125
branch: spec.branch, base: @base,
126126
title: spec.title, body: @body_renderer.call(spec),

lib/git_client.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def commit_all(message:)
4646

4747
def push(branch:, force: false)
4848
argv = ["git", "push", "origin", "#{branch}:#{branch}"]
49-
argv.push("--force-with-lease") if force
49+
argv.push("--force") if force
5050
@runner.run!(*argv)
5151
nil
5252
end

test/executor_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def test_open_action_pins_pushes_and_creates_pr
150150
# Git operations: checkout fresh, commit, push.
151151
assert_equal [{branch: "importmap-updates/patch", base: "main"}], @git.checkouts
152152
assert_equal 1, @git.commits.size
153-
assert_equal [{branch: "importmap-updates/patch", force: false}], @git.pushes
153+
assert_equal [{branch: "importmap-updates/patch", force: true}], @git.pushes
154154

155155
# gh create_pr called with planner-provided title and rendered body.
156156
assert_equal 1, @gh.created.size

0 commit comments

Comments
 (0)