Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 am changing the source of a syntax highlighting grammar
I am updating a grammar submodule
I am adding new or changing current functionality
I am changing the color associated with a language