{"id":22691281,"url":"https://github.com/wisq/ex_git_test","last_synced_at":"2026-05-04T02:31:20.568Z","repository":{"id":153803559,"uuid":"628767534","full_name":"wisq/ex_git_test","owner":"wisq","description":"A git pre-commit hook that runs a `mix test`, but only on your git staged changes","archived":false,"fork":false,"pushed_at":"2023-04-21T01:18:49.000Z","size":82,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-29T16:41:42.500Z","etag":null,"topics":["automation","elixir-lang","git","testing"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wisq.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-16T23:54:44.000Z","updated_at":"2023-04-21T03:49:37.000Z","dependencies_parsed_at":"2023-06-29T07:16:50.128Z","dependency_job_id":null,"html_url":"https://github.com/wisq/ex_git_test","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/wisq/ex_git_test","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wisq%2Fex_git_test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wisq%2Fex_git_test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wisq%2Fex_git_test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wisq%2Fex_git_test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wisq","download_url":"https://codeload.github.com/wisq/ex_git_test/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wisq%2Fex_git_test/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32592310,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T22:12:39.696Z","status":"online","status_checked_at":"2026-05-04T02:00:06.625Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","elixir-lang","git","testing"],"created_at":"2024-12-10T01:10:02.473Z","updated_at":"2026-05-04T02:31:20.525Z","avatar_url":"https://github.com/wisq.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mix git.test\n\n[![Hex.pm Version](https://img.shields.io/hexpm/v/ex_git_test.svg?style=flat-square)](https://hex.pm/packages/ex_git_test)\n\nAutomatically run `mix test` before committing, but **only** on your staged changes.\n\n## Clean and reliable testing\n\nWe've all had those moments where we push a commit that breaks the test suite.\n\nMaybe you even ran the test suite first (and passed), but you added a new file and forgot to `git add` it.  Or maybe you're intentionally doing a partial commit, and you thought you got all the relevant changes, but one of them slipped through.  Or maybe you've got local `.gitignore`d files that your build accidentally relies on.\n\n`mix git.test` aims to solve this by (efficiently) cloning your work tree to a temporary directory, applying only the specific changes you're planning on committing, running the test suite there, and seeing if your tests pass on a \"clean\" build.  It's meant to be included in a git `pre-commit` hook, to automatically run every commit, and abort the commit if an error occurs.\n\n### Decently fast (for small projects, anyway)\n\nTo keep this quick, we take one major shortcut — the cloned tree's dependencies will be symbolic links to the working tree's dependencies, to avoid recompiling them.  While this doesn't normally cause any issues, you'll want to keep this in mind if you're doing anything weird like directly editing your `deps` tree.\n\nThat said, you're still looking at however long it takes to do a full compile and run your test suite.  If you've got a massive project that takes several minutes to compile and test, you'll probably want to give this library a pass!\n\n## Demo\n\n![Screenshot](https://github.com/wisq/ex_git_test/blob/images/images/screenshot.png?raw=true)\n\n## Setup\n\nFirst, add `ex_git_test` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:ex_git_test, \"~\u003e 0.1.1\", only: [:dev, :test], runtime: false}\n  ]\nend\n```\n\nNow fetch your dependencies with `mix deps.get`, and then test things with `MIX_ENV=test mix git.test`.  Hopefully everything passes.  (If it has issues with the state of your tree, try committing your existing changes first.)\n\nNext, run `mix git.test.install`.  This will create an executable `.git/hooks/pre-commit` file that runs `mix git.test` for you.  (This will **not** overwrite an existing pre-commit hook.  You can either move your existing hook out of the way, or just integrate `mix git.test` into your existing one.)\n\nFeel free to customise your new hook however you want.  The most important thing is just to ensure that if `mix git.test` fails, then the hook exits with a non-zero status.  The default script uses `exec` for this, but you could also do the equivalent of `mix git.test || exit 1`.  (Make sure you test your hook by staging some changes that deliberately break the tests and seeing if git lets you commit them.)\n\n## Documentation\n\nFull documentation can be found at \u003chttps://hexdocs.pm/ex_git_test\u003e.\n\nOnce installed, you can also run `mix help git.test` and `mix help git.test.install`.\n\n## Legal stuff\n\nCopyright © 2023, Adrian Irving-Beer.\n\n`ex_git_test` is released under the [MIT license](https://github.com/wisq/ex_git_test/blob/main/LICENSE) and is provided with **no warranty**.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwisq%2Fex_git_test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwisq%2Fex_git_test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwisq%2Fex_git_test/lists"}