Skip to content

Commit 6ea070e

Browse files
authored
support manual refspec
1 parent c64b8dd commit 6ea070e

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/main.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,21 @@ if (exitCode) {
7878
const tags = stdout.split(/\r?\n/g);
7979
console.assert(tags.length === 1, `tags=${tags} longer than 1`);
8080
pushRefspec = tags[0];
81-
pushForce ??= true;
8281
console.assert(pushForce, "push-force: false never updates tag");
8382
} else {
8483
pushRefspec = stdout;
85-
pushForce ??= false;
84+
}
85+
}
86+
if (pushForce == null) {
87+
const { exitCode } = await $({
88+
cwd: rootPath,
89+
reject: false,
90+
})`git show-ref --verify refs/tags/${pushRefspec}`;
91+
if (exitCode) {
92+
pushForce = true;
93+
} else {
94+
// TODO: Any other force-push situations?
95+
pushForce = false;
8696
}
8797
}
8898

0 commit comments

Comments
 (0)