1
0
Fork 0
mirror of https://code.forgejo.org/actions/checkout.git synced 2024-11-23 01:44:51 +01:00

updated other version-specific logic

This commit is contained in:
John Wesley Walker III 2024-03-12 16:25:38 +00:00
parent 06abf5564e
commit 64dbc8124d
4 changed files with 6 additions and 21 deletions

View file

@ -8,7 +8,7 @@ Only a single commit is fetched by default, for the ref/SHA that triggered the w
The auth token is persisted in the local git config. This enables your scripts to run authenticated git commands. The token is removed during post-job cleanup. Set `persist-credentials: false` to opt-out. The auth token is persisted in the local git config. This enables your scripts to run authenticated git commands. The token is removed during post-job cleanup. Set `persist-credentials: false` to opt-out.
When Git 2.18 or higher is not in your PATH, falls back to the REST API to download the files. When Git 2.25 or higher is not in your PATH, falls back to the REST API to download the files.
# What's new # What's new

View file

@ -24,7 +24,7 @@ describe('git-auth-helper tests', () => {
console.log(args, options.listeners.stdout) console.log(args, options.listeners.stdout)
if (args.includes('version')) { if (args.includes('version')) {
options.listeners.stdout(Buffer.from('2.18')) options.listeners.stdout(Buffer.from('2.25'))
return 0 return 0
} }
@ -57,7 +57,7 @@ describe('git-auth-helper tests', () => {
console.log(args, options.listeners.stdout) console.log(args, options.listeners.stdout)
if (args.includes('version')) { if (args.includes('version')) {
options.listeners.stdout(Buffer.from('2.18')) options.listeners.stdout(Buffer.from('2.25'))
return 0 return 0
} }
@ -97,7 +97,7 @@ describe('Test fetchDepth and fetchTags options', () => {
console.log(args, options.listeners.stdout) console.log(args, options.listeners.stdout)
if (args.includes('version')) { if (args.includes('version')) {
options.listeners.stdout(Buffer.from('2.18')) options.listeners.stdout(Buffer.from('2.25'))
} }
return 0 return 0

8
dist/index.js vendored
View file

@ -524,13 +524,7 @@ class GitCommandManager {
branchList(remote) { branchList(remote) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const result = []; const result = [];
// Note, this implementation uses "rev-parse --symbolic-full-name" because the output from const args = ['rev-parse', '--symbolic'];
// "branch --list" is more difficult when in a detached HEAD state.
// TODO(https://github.com/actions/checkout/issues/786): this implementation uses
// "rev-parse --symbolic-full-name" because there is a bug
// in Git 2.18 that causes "rev-parse --symbolic" to output symbolic full names. When
// 2.18 is no longer supported, we can switch back to --symbolic.
const args = ['rev-parse', '--symbolic-full-name'];
if (remote) { if (remote) {
args.push('--remotes=origin'); args.push('--remotes=origin');
} }

View file

@ -111,16 +111,7 @@ class GitCommandManager {
async branchList(remote: boolean): Promise<string[]> { async branchList(remote: boolean): Promise<string[]> {
const result: string[] = [] const result: string[] = []
const args = ['rev-parse', '--symbolic']
// Note, this implementation uses "rev-parse --symbolic-full-name" because the output from
// "branch --list" is more difficult when in a detached HEAD state.
// TODO(https://github.com/actions/checkout/issues/786): this implementation uses
// "rev-parse --symbolic-full-name" because there is a bug
// in Git 2.18 that causes "rev-parse --symbolic" to output symbolic full names. When
// 2.18 is no longer supported, we can switch back to --symbolic.
const args = ['rev-parse', '--symbolic-full-name']
if (remote) { if (remote) {
args.push('--remotes=origin') args.push('--remotes=origin')
} else { } else {