actions / actions/checkout

Uses case-insensitive ref comparisons in various places

Open
#698 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
8.9k
Forks
2.8k
PR merge metrics
No merged PRs in 30d

Description

In various places in src/ref-helper.ts, there are places where the case of the ref is forced to uppercase, and then a comparison is made. This is incorrect because in Git, all refs are case sensitive.

Because Git stores refs in the file system, in some cases people may see cases where it is possible to access a ref by a name of a different case that was originally used, but that ultimately breaks in various ways, especially when refs are packed into the packed-refs file, such as on a fresh clone from the remote.

In addition, the case-folding performed is not necessarily the same as the one performed by the OS. On a Windows system, the table used for case-folding depends on the OS version that formatted the partition and is not exposed to userspace. Therefore, there is no possible way to perform case-folding correctly without asking the OS.

As a result, performing any sort of case-insensitive comparison is always incorrect when dealing with Git refs and should be avoided in the code.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/ref-helper.ts and locate each place where a ref is forced to uppercase before comparison. Trace those comparisons and verify that ref names remain case-sensitive, including packed refs; done means no case-insensitive ref comparisons remain in that file.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, typescript
Domain
devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.