Skip to content

Commit

Permalink
fix(git-node): support on shallow clones (#876)
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 authored Dec 3, 2024
1 parent d944670 commit eddb205
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/prepare_release.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,16 @@ export default class ReleasePreparation extends Session {
runSync('git', ['fetch', this.upstream, 'tag', '-n', tagName]);
this.cli.stopSpinner(`Tag fetched: ${tagName}`);
}
try {
if (runSync('git', ['describe', '--abbrev=0', '--tags']).trim() !== tagName) {
this.cli.warn(`${tagName} is not the closest tag`);
}
} catch {
this.cli.startSpinner(`${tagName} is unreachable from the current HEAD`);
runSync('git', ['fetch', '--shallow-exclude', tagName, this.upstream, this.branch]);
runSync('git', ['fetch', '--deepen=1', this.upstream, this.branch]);
this.cli.stopSpinner('Local clone unshallowed');
}
return tagName;
}

Expand Down

0 comments on commit eddb205

Please sign in to comment.