Initial commit
This commit is contained in:
commit
f87d6bd4c8
3 changed files with 134 additions and 0 deletions
51
README.md
Normal file
51
README.md
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
# git-check-assertions
|
||||
|
||||
🚧 Merely a proof-of-concept right now.
|
||||
|
||||
I recently wrote two blogs posts arguing that there might be some value in writing verifiable claims, i.e. assertions, inside of our commit messages:
|
||||
|
||||
* [Should we start writing verifiable claims in commit message?](https://sven.memcmp.org/2026-02-19-should-we-start-writing-verifiable-claims-in-commit-messages/)
|
||||
* [Writing the steps to validate a test in the commit message](https://sven.memcmp.org/2026-02-20-writing-the-steps-to-validate-a-test-in-the-commit-message/)
|
||||
|
||||
This is a simple verifier for such assertions.
|
||||
|
||||
You include a small bash script inside your commit messages, and `git-check-assertions` will then check out every commit (from the point that your branch diverged from `main`), and verify that the script in the commit message runs successfully.
|
||||
|
||||
⚠️ Only run this on repositories and branches that you trust, since the `bash` scripts in the commit messages can do whatever they want.
|
||||
|
||||
## Examples of commit messages
|
||||
|
||||
Assert that a commit builds:
|
||||
|
||||
~~~
|
||||
```git-check-assertions
|
||||
dotnet build
|
||||
```
|
||||
~~~
|
||||
|
||||
Assert that a commit builds and that the tests succeed:
|
||||
|
||||
~~~
|
||||
```git-check-assertions
|
||||
dotnet build
|
||||
dotnet test --no-build
|
||||
```
|
||||
~~~
|
||||
|
||||
Assert that a commit builds, but that the tests do not succeed (`assert_fails` is a helper function included in `git-check-assertions`):
|
||||
|
||||
~~~
|
||||
```git-check-assertions
|
||||
dotnet build
|
||||
assert_fails dotnet test --no-build
|
||||
```
|
||||
~~~
|
||||
|
||||
Assert that a commit builds, and that the tests fail with exactly the error that you expect:
|
||||
|
||||
~~~
|
||||
```git-check-assertions
|
||||
dotnet build
|
||||
(assert_fails dotnet test --no-build) | grep "Invalid URL"
|
||||
```
|
||||
~~~
|
||||
Loading…
Add table
Add a link
Reference in a new issue