You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This works, of course - but only if the file is actually committed into a Git repository, and otherwise fails with a (to me) obscure internal error.
This confused the hell out of me, and it took me a fair bit of trial and error to narrow this down to being root cause related to the file is actually committed into a Git repository.
In an ideal world, it might be cool if Linguist also just worked for uncommitted files?
Unless this is a deliberate design decision, and not just an oversight, or regression? If that's the case, a clear error message would be neat.
Here are the fully reproducible technical details of what actually currently happens:
$ bin/github-linguist README.md
README.md: 228 lines (167 sloc)
type: Text
mime type: text/markdown
language: Markdown
$ cp README.md README2.md
$ bin/github-linguist README2.md
/home/vorburger/git/github.com/github-linguist/linguist/lib/linguist/source/rugged.rb:65:in `to_buffer': wrong argument type nil (expected String) (TypeError)
Rugged::Blob.to_buffer(@rugged, blob_id, max_size)
^^^^^^^^^^^^^^^^^^^^^^^^^^
from /home/vorburger/git/github.com/github-linguist/linguist/lib/linguist/source/rugged.rb:65:in `load_blob'
from /home/vorburger/git/github.com/github-linguist/linguist/lib/linguist/lazy_blob.rb:117:in `load_blob!'
from /home/vorburger/git/github.com/github-linguist/linguist/lib/linguist/lazy_blob.rb:91:in `data'
from /home/vorburger/git/github.com/github-linguist/linguist/lib/linguist/blob_helper.rb:127:in `binary?'
from /home/vorburger/git/github.com/github-linguist/linguist/lib/linguist/blob_helper.rb:155:in `text?'
from bin/github-linguist:112:in `github_linguist'
from bin/github-linguist:155:in `<main>'
The text was updated successfully, but these errors were encountered:
Unless this is a deliberate design decision, and not just an oversight, or regression?
It is deliberate. Linguist runs on GitHub's servers against bare repos which means there are no individual files to analyse. We have a point about this in the troubleshooting doc.
That said, this used to work. I suspect #7094 may have inadvertently broken this.
FYI my "use case" which made me raise this was simply trying to contribute to Linguist (for #7161) and trying to verify a fix on file which was not (yet) committed in the repo. Understanding the cause of this error, through trial and error, is where I spent the majority of the time 🤣 when I put together #7163.
https://github.com/github-linguist/linguist#single-file says you can do e.g.
github-linguist README.md
.This works, of course - but only if the file is actually committed into a Git repository, and otherwise fails with a (to me) obscure internal error.
This confused the hell out of me, and it took me a fair bit of trial and error to narrow this down to being root cause related to the file is actually committed into a Git repository.
In an ideal world, it might be cool if Linguist also just worked for uncommitted files?
Unless this is a deliberate design decision, and not just an oversight, or regression? If that's the case, a clear error message would be neat.
Here are the fully reproducible technical details of what actually currently happens:
The text was updated successfully, but these errors were encountered: