Skip to content

Commit 0c2eab8

Browse files
committed
style(hooks): normalize pre-push computeRange skip sentinel to null
computeRange's return type is `string | null`. The early-skip branches were returning `undefined`, which TS coerces but is the wrong sentinel — "no range to compute" is intentional absence, not "didn't bother to set". No behavior change.
1 parent 234a4de commit 0c2eab8

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

.git-hooks/pre-push.mts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,10 @@ const computeRange = (
100100
): string | null => {
101101
if (localRef.startsWith('refs/tags/')) {
102102
logger.info(`Skipping tag push: ${localRef}`)
103-
return undefined
103+
return null
104104
}
105105
if (localSha === ZERO_SHA) {
106-
return undefined
106+
return null
107107
}
108108

109109
const defaultBranchOf = (remoteName: string): string => {
@@ -132,7 +132,7 @@ const computeRange = (
132132
const baseRef = `${remote}/${def}`
133133
if (!refExists(baseRef)) {
134134
logger.success('Skipping validation (no baseline to compare against)')
135-
return undefined
135+
return null
136136
}
137137
return `${baseRef}..${localSha}`
138138
}
@@ -144,7 +144,7 @@ const computeRange = (
144144
const baseRef = `${remote}/${def}`
145145
if (!refExists(baseRef)) {
146146
logger.success('Skipping validation (no baseline for force-push)')
147-
return undefined
147+
return null
148148
}
149149
return `${baseRef}..${localSha}`
150150
}

0 commit comments

Comments
 (0)