Skip to content

Commit e1de87a

Browse files
WeslleyNasRochaJounQin
authored andcommitted
fix: simplify pushTags function by using HEAD directly for tag retrieval
1 parent 0b40266 commit e1de87a

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

src/git-utils.ts

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,19 @@ export const push = async (
2727
}
2828

2929
export const pushTags = async () => {
30-
// Get the commit hash
31-
const { stdout: commitHash } = await execWithOutput("git", [
32-
"rev-parse",
33-
"HEAD",
34-
]);
3530
// Get the tags that contain the commit
36-
const { stdout: tags } = await execWithOutput("git", [
37-
"--no-pager",
38-
"tag",
39-
"--contains",
40-
commitHash,
41-
]);
31+
const { stdout: tags } = await execWithOutput('git', [
32+
'--no-pager',
33+
'tag',
34+
`HEAD`,
35+
])
4236
// Separate the tags into a list
43-
const tagList = tags.split("\n");
37+
const tagList = tags.split('\n')
4438
// Push the tags individually to the remote
4539
for (const tag of tagList) {
46-
await exec("git", ["push", "origin", tag]);
40+
await exec('git', ['push', 'origin', tag])
4741
}
48-
};
49-
42+
}
5043

5144
export const switchToMaybeExistingBranch = async (branch: string) => {
5245
const { stderr } = await execWithOutput('git', ['checkout', branch], {

0 commit comments

Comments
 (0)