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

Add check for executability of scripts with shebangs #545

Merged
merged 2 commits into from May 5, 2021
Merged

Add check for executability of scripts with shebangs #545

merged 2 commits into from May 5, 2021

Conversation

scop
Copy link
Contributor

@scop scop commented Jan 8, 2021

First cut, applies on top of #544.

@asottile
Copy link
Member

asottile commented Feb 4, 2021

@scop are you planning to finish this up?

@scop
Copy link
Contributor Author

scop commented Feb 5, 2021

Ah yeah, had forgotten about it. The problem is kind of with the "improved" git ls-files parser I added here. ls-files --stage is documented to output [<tag> ]<mode> <object> <stage> <file> but I haven't been able to construct a state in which it would ever actually output anything in the tag (even if the head version is tagged), hence no possibility to add a test case to complete the coverage.

If you know how to provoke it to output the tag, pointers appreciated.

The other option would be to revert back towards the current ls-files parser which doesn't have this "problem", but then again I don't see how it could work properly in case where it was actually fed the above formatted ls-files output with a tag in it, as it picks the first space separated token from it which in those cases would be the tag, not a "tag+mode" string as the implementation/naming implies.

@scop
Copy link
Contributor Author

scop commented Apr 13, 2021

@asottile any thoughts about the above?

@asottile
Copy link
Member

if the tag output is impossible then probably we don't need the code that would handle it

@scop
Copy link
Contributor Author

scop commented May 4, 2021

Ok, this should be good now. I was confused about the tags thing -- it's not a "git tag" in the usual sense, but just file status identifiers that will appear only if ls-files is called with -t (which we don't): http://git-scm.com/docs/git-ls-files#Documentation/git-ls-files.txt--t

Copy link
Member

@asottile asottile left a comment

Choose a reason for hiding this comment

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

@asottile asottile merged commit 11cdc8d into pre-commit:master May 5, 2021
@scop scop deleted the check-shebangs-executable branch May 5, 2021 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants