Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: If remote cannot be inferred, default to config clone.defaultRemoteName, then origin #173

Merged

Conversation

hyperupcall
Copy link
Contributor

@hyperupcall hyperupcall commented Sep 22, 2023

From this comment in the referrenced issue:

This broke linting because the code did not take into account that HEAD may not point to a branch - it could be in a detached state. And this commonly occurs in Github Actions when @actions/checkout is used to clone a repository.

If we are not currently in a branch, then we:

  • Infer remote name from the config key clone.defaultRemoteName
  • If that config key is not set, then the value is defaulted to 'origin' (the original default)

These fixes were tested in this PR (and this PR), which had CI config like:

jobs:
  awesome-lint:
    steps:
      - name: "checkout repo"
        uses: actions/checkout@v2.0.0
        with:
          fetch-depth: 0
      - run: |
          npm install --global 'https://github.com/fox-forks/awesome-lint.git#hyperupcall-detached-state-patch'
          awesome-lint

Fixes #172

@hyperupcall hyperupcall force-pushed the hyperupcall-detached-state-patch branch from 0e8da06 to 685a19b Compare September 22, 2023 22:14
@hyperupcall hyperupcall changed the title fix: If remote cannot be inferred, default to origin fix: If remote cannot be inferred, default to config clone.defaultRemoteName, then origin Sep 22, 2023
@sindresorhus sindresorhus merged commit e7abb5d into sindresorhus:main Sep 23, 2023
0 of 3 checks passed
@sindresorhus
Copy link
Owner

Thanks for the quick fix :)

@hyperupcall hyperupcall deleted the hyperupcall-detached-state-patch branch September 23, 2023 02:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

v0.18.4 broke linting from forks
2 participants