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

Accept branch name as argument #6069

Merged
merged 4 commits into from
Sep 29, 2022

Conversation

bval
Copy link
Contributor

@bval bval commented Sep 14, 2022

Modify the github-linguist CLI to accept a new, optional argument specifying a git revision other than HEAD to analyze.

Description

While working with a GitHub customer it came to my attention that linguist as a command line tool will only analyze HEAD in the current repo, which is typically the default branch in a newly cloned repo. I have added an optional command line flag to accept any gitrevisions(1) compatible ref so that other branches, tags, or individual SHAs can be analyzed provided they are reachable.

This does not regress any current functionality, and I also rescue the potential exception should the user provide a revision that is not reachable.

I have investigated adding a test but there appear to be none in the current suite related to the CLI at all, and this change should be safe to introduce without one.

This makes the tool useful for example in CI pipelines where the languages present may be an input to a later step, where certain build tools, linters, or scanning tools may be needed based on the results.

Checklist:

  • I am associating a language with a new file extension.

  • I am adding a new language.

  • I am fixing a misclassified language

    • I have included a new sample for the misclassified language:
      • Sample source(s):
        • [URL to each sample source, if applicable]
      • Sample license(s):
    • I have included a change to the heuristics to distinguish my language from others using the same extension.
  • I am changing the source of a syntax highlighting grammar

    • Old: [URL to grammar repo]
    • New: [URL to grammar repo]
  • I am updating a grammar submodule

  • I am adding new or changing current functionality

    • I have added or updated the tests for the new or changed functionality.
  • I am changing the color associated with a language

    • I have obtained agreement from the wider language community on this color change.
      • [URL to public discussion]
      • [Optional: URL to official branding guidelines for the language]

@bval bval requested a review from a team as a code owner September 14, 2022 16:33
Copy link
Contributor

@rewinfrey rewinfrey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋 @bval, thanks for adding this functionality. This patch looks good to me!

We'll need @lildude for a final sign off.

Copy link
Member

@lildude lildude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Sorry about the delay.

@bval bval merged commit 4ea1b93 into github-linguist:master Sep 29, 2022
@bval bval deleted the accept-branch-name-as-argument branch September 29, 2022 14:09
zekigedir referenced this pull request Mar 12, 2023
* Add .cnf to INI

* Add openssl.cnf

* Increase acceptable errors

---------

Co-authored-by: Colin Seymour <colin@github.com>
@github-linguist github-linguist locked as resolved and limited conversation to collaborators Jun 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants