Provide human friendly message instead of `fatal: --local can only be used inside a git repository`
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 8.9k
- Forks
- 2.8k
- PR merge metrics
- No merged PRs in 30d
Description
This run managed to create a .git directory containing a single file (reporter.json):
https://github.com/jsoref/examples-testing/runs/5404530182?check_suite_focus=true#step:4:20
Download action repository 'actions/checkout@v2' (SHA:ec3a7ce113134d7a93b817d10a8272cb61118579)
...
Run actions/checkout@v2
with:
repository: jsoref/examples-testing
token: ***
ssh-strict: true
persist-credentials: true
clean: true
fetch-depth: 1
lfs: false
submodules: false
env:
PR_HEAD_SHA: 2f3e6fc9852caf53e728702a7adf0e871e2e1531
result_code:
Syncing repository: jsoref/examples-testing
Getting Git version info
/usr/bin/git config --local --get remote.origin.url
Error: fatal: --local can only be used inside a git repository
Deleting the contents of '/home/runner/work/examples-testing/examples-testing'
Which triggers:
https://github.com/actions/checkout/blob/ec3a7ce113134d7a93b817d10a8272cb61118579/src/git-command-manager.ts#L365
The message:
Error: fatal: --local can only be used inside a git repository
... is not particularly helpful to most people.
In this code path, what it means is:
There was a
.gitdirectory where the checkout was trying to operate, but it wasn't a valid.gitrepository.
The next log output line is fine:
Deleting the contents of '/home/runner/work/examples-testing/examples-testing'
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at src/git-command-manager.ts#L365 and inspect how the failed git config --local --get remote.origin.url call is reported during checkout. Reproduce or trace the invalid .git case described in the issue, then verify that the resulting message explains the invalid repository while the subsequent deletion log remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, github-actions, typescript
- Domain
- ci-cd, devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100