-
Notifications
You must be signed in to change notification settings - Fork 100
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
Use as a pre-push hook #55
Comments
So I looked into this a bit more and think gitlint actually supports this out of the box already, perhaps with a small caveat. See http://jorisroovers.github.io/gitlint/#linting-a-range-of-commits You can use gitlint to lint a single sha like so: SHA="f0c4acf161a23f37c8af8985d281254822280227"
gitlint --commits ${SHA}^...${SHA}
# I've noticed that there's a mistake in the docs, since it says you can just do 'gitlint --commits ${SHA}' to lint a single commit.
# In reality, that will lint all commits in the repo that occured before (and incl) that particular commit (this is inline with git's refspec defintion).
# I'll fix the docs on that. This will also work if you want to specific a range of commits (which I'm thinking is what you'd really want): gitlint --commits ${START_SHA}...${END_SHA} The caveat is that if you want to lint a specific set of non-consecutive shas, you'll have to write a for loop: for sha in f0c4acf161a23f37c8af8985d281254822280227 03eec2042d97a4414b45e0f5f7e67fa85ce9f80b 2a05f1b12bcc830c5d2da93d180230e1f74922dd; do
gitlint --debug --commits ${sha}^...${sha}
done I've thought before about adding support for comma-separated sha lists to gitlint, but haven't gotten to it yet. gitlint --commits <sha1>,<sha2>,<sha3> As an FYI, if there's still a case for adding in PR #61, then it will need some changes - in particular wrt the tests, these should be added to the other integration tests in the I was planning on quickly doing that myself, but than figured out that this PR is likely not needed as per the above. I pushed the work I already did to the Hope this helps! |
The only difference is whether the loop is inside |
Doing so gives the developer feedback early on, before the changes hit the GitHub CI infrastructure. This would be a good candidate for using a Git pre-hook. Unfortunately, gitlint is a bit tricky to be used in a pre-push hook: jorisroovers/gitlint#55
Doing so gives the developer feedback early on, before the changes hit the GitHub CI infrastructure. This would be a good candidate for using a Git pre-hook. Unfortunately, gitlint is a bit tricky to be used in a pre-push hook: jorisroovers/gitlint#55
Doing so gives the developer feedback early on, before the changes hit the GitHub CI infrastructure. This would be a good candidate for using a Git pre-hook. Unfortunately, gitlint is a bit tricky to be used in a pre-push hook: jorisroovers/gitlint#55
Doing so gives the developer feedback early on, before the changes hit the GitHub CI infrastructure. This would be a good candidate for using a Git pre-hook. Unfortunately, gitlint is a bit tricky to be used in a pre-push hook: jorisroovers/gitlint#55
Doing so gives the developer feedback early on, before the changes hit the GitHub CI infrastructure. This would be a good candidate for using a Git pre-hook. Unfortunately, gitlint is a bit tricky to be used in a pre-push hook: jorisroovers/gitlint#55
Doing so gives the developer feedback early on, before the changes hit the GitHub CI infrastructure. This would be a good candidate for using a Git pre-hook. Unfortunately, gitlint is a bit tricky to be used in a pre-push hook: jorisroovers/gitlint#55
Can I use gitlint as a pre-push hook? It matched some unexpected data:
The text was updated successfully, but these errors were encountered: