Skip to content

Commit 396288f

Browse files
committed
chore: be more specific when pushing
`git push` can push more than a single ref, depending on user's configuration. So make sure to push only those refs that we need.
1 parent 0f0e9fa commit 396288f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ fn main() -> Result<()> {
175175
.read()
176176
.context("reading remote branch sha")?;
177177
if branch_sha != remote_branch_sha {
178-
cmd!(sh, "git push -f")
178+
cmd!(sh, "git push -f origin {branch}")
179179
.run()
180180
.context("force-pushing branch")?;
181181
}
@@ -194,11 +194,11 @@ fn main() -> Result<()> {
194194
//
195195
// sometimes it takes a few seconds for github to catch up, so in the event of a failure we try again
196196
// a bit later.
197-
let push_result = cmd!(sh, "git push").run();
197+
let push_result = cmd!(sh, "git push origin {base}").run();
198198
if push_result.is_err() {
199199
println!("this is normal; retrying in {}s", args.push_retry_interval);
200200
std::thread::sleep(std::time::Duration::from_secs_f64(args.push_retry_interval));
201-
cmd!(sh, "git push")
201+
cmd!(sh, "git push origin {base}")
202202
.run()
203203
.context("2nd attempt to push to base")?;
204204
}

0 commit comments

Comments
 (0)