Skip to content

Commit eddb205

Browse files
authored
fix(git-node): support on shallow clones (#876)
1 parent d944670 commit eddb205

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/prepare_release.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,16 @@ export default class ReleasePreparation extends Session {
367367
runSync('git', ['fetch', this.upstream, 'tag', '-n', tagName]);
368368
this.cli.stopSpinner(`Tag fetched: ${tagName}`);
369369
}
370+
try {
371+
if (runSync('git', ['describe', '--abbrev=0', '--tags']).trim() !== tagName) {
372+
this.cli.warn(`${tagName} is not the closest tag`);
373+
}
374+
} catch {
375+
this.cli.startSpinner(`${tagName} is unreachable from the current HEAD`);
376+
runSync('git', ['fetch', '--shallow-exclude', tagName, this.upstream, this.branch]);
377+
runSync('git', ['fetch', '--deepen=1', this.upstream, this.branch]);
378+
this.cli.stopSpinner('Local clone unshallowed');
379+
}
370380
return tagName;
371381
}
372382

0 commit comments

Comments
 (0)