Skip to content

Commit ccfa5a5

Browse files
committed
fix deploy-dogfood script when used with a tag
1 parent 6196fa4 commit ccfa5a5

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

tools/deno/deploy-dogfood.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,22 @@ Usage:
3232
`.trim()
3333

3434
const args = parseArgs(Deno.args)
35-
const consoleCommit = args._[0]
35+
const consoleRevision = args._[0]
3636

37-
if (!consoleCommit) {
37+
if (!consoleRevision) {
3838
console.error('Error: Console commit hash is required\n')
3939
console.info(USAGE)
4040
Deno.exit(1)
4141
}
4242

43-
const fullCommit = await $`git rev-parse ${consoleCommit}`.text()
43+
const isTag = (await $`git cat-file -t ${consoleRevision}`.noThrow().text()) === 'tag'
4444

45-
if (consoleCommit !== fullCommit) {
46-
console.info(`Resolved ${consoleCommit} to ${fullCommit}`)
45+
// if console commit is a tag we use ^{} to get the hash of the commit
46+
// underneath the tag, not of the tag itself
47+
const fullCommit = await $`git rev-parse ${consoleRevision}${isTag ? '^{}' : ''}`.text()
48+
49+
if (consoleRevision !== fullCommit) {
50+
console.info(`Resolved ${consoleRevision} to ${fullCommit}`)
4751
}
4852

4953
console.info('Finding nexus zones...')

0 commit comments

Comments
 (0)