mirror of
https://github.com/actions/checkout.git
synced 2025-04-01 22:10:06 +02:00
fix issue checking detached when git less than 2.22
This commit is contained in:
parent
c85684db76
commit
44e1b123fc
2 changed files with 9 additions and 11 deletions
8
dist/index.js
vendored
8
dist/index.js
vendored
|
@ -4887,11 +4887,9 @@ class GitCommandManager {
|
|||
}
|
||||
isDetached() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// Note, this implementation uses "branch --show-current" because
|
||||
// "rev-parse --symbolic-full-name HEAD" can fail on a new repo
|
||||
// with nothing checked out.
|
||||
const output = yield this.execGit(['branch', '--show-current']);
|
||||
return output.stdout.trim() === '';
|
||||
// Note, "branch --show-current" would be simpler but isn't available until Git 2.22
|
||||
const output = yield this.execGit(['rev-parse', '--symbolic-full-nane', 'HEAD'], true);
|
||||
return !output.stdout.trim().startsWith('refs/heads/');
|
||||
});
|
||||
}
|
||||
lfsFetch(ref) {
|
||||
|
|
|
@ -170,12 +170,12 @@ class GitCommandManager {
|
|||
}
|
||||
|
||||
async isDetached(): Promise<boolean> {
|
||||
// Note, this implementation uses "branch --show-current" because
|
||||
// "rev-parse --symbolic-full-name HEAD" can fail on a new repo
|
||||
// with nothing checked out.
|
||||
|
||||
const output = await this.execGit(['branch', '--show-current'])
|
||||
return output.stdout.trim() === ''
|
||||
// Note, "branch --show-current" would be simpler but isn't available until Git 2.22
|
||||
const output = await this.execGit(
|
||||
['rev-parse', '--symbolic-full-nane', 'HEAD'],
|
||||
true
|
||||
)
|
||||
return !output.stdout.trim().startsWith('refs/heads/')
|
||||
}
|
||||
|
||||
async lfsFetch(ref: string): Promise<void> {
|
||||
|
|
Loading…
Add table
Reference in a new issue