{"id":13581388,"url":"https://github.com/spotify/git-test","last_synced_at":"2025-04-06T07:32:05.175Z","repository":{"id":25533228,"uuid":"28965711","full_name":"spotify/git-test","owner":"spotify","description":"test your commits","archived":true,"fork":false,"pushed_at":"2023-01-04T13:15:20.000Z","size":45,"stargazers_count":203,"open_issues_count":3,"forks_count":42,"subscribers_count":111,"default_branch":"master","last_synced_at":"2024-11-05T20:47:11.973Z","etag":null,"topics":["agnostic","test-automation","version-control"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spotify.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-01-08T12:50:22.000Z","updated_at":"2024-08-18T12:37:57.000Z","dependencies_parsed_at":"2023-01-14T02:54:35.785Z","dependency_job_id":null,"html_url":"https://github.com/spotify/git-test","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spotify%2Fgit-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spotify%2Fgit-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spotify%2Fgit-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spotify%2Fgit-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spotify","download_url":"https://codeload.github.com/spotify/git-test/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247450253,"owners_count":20940885,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["agnostic","test-automation","version-control"],"created_at":"2024-08-01T15:02:01.080Z","updated_at":"2025-04-06T07:32:04.908Z","avatar_url":"https://github.com/spotify.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"# git-test -- test your commits\n\nRun tests on each *distinct* tree in a revision list, skipping versions whose\ncontents have already been tested.\n\nThe 99% example is simply:\n\n    git test -v\n\nBy default it uses heuristics to try to determine what \"local commits\" to\ntest, but you can supply another ref spec. `git-test` looks at each commit and\nchecks the hash of the directory tree against the cache. You can also configure\na ref (usually a branch) to test against, per repo or or per branch.\n\nFrom the point of view of `git-test`, a test can be any shell command and a\ntest is considered successful if that shell command returns with a `0` exit\nstatus. This means `git-test` can be used both for specialised tests of a\nsingle feature or failure mode or for running a comprehensive set of automated\ntests. The cache is keyed on both directory tree and test, so it won't confuse\nthe unit tests with the integration tests, or a specific regression test.\n\n## Motivation\n\nAn important design goal for `git-test` has been to make it convenient to use.\n\nIdeally, you should have a work flow where you run your unit tests whenever\nyou save and run unit tests on all your local commits whenever you've done\nsomething with version control.\n\nFor ease, `git-test` offers a few advantages over a simple for loop over a\n`git rev-list`:\n\n- By default it spends some effort on working out which commits to test.\n- Cached results, which are keyed to tree contents, rather than commit. This\n  means that commits can be amended or reordered, but only content trees that\n  have never been tested before will be tested.\n- Separate pre- and post-action hooks, the results of which don't actually\n  factor into the test result. (Useful if cleaning fails if there is nothing\n  to clean, for instance.)\n- Configuration of housekeeping and verification steps using\n    - `git config`,\n    - environment variables or\n    - command line arguments\n- Selective redo, for where you trust failures but not successes, vice versa,\n  or trust nothing.\n- Save output (both `STDOUT` and `STDERR`) from cleaning and verifying to\n  an easily referenced symlink farm.\n\n\n## Configure\n\nMostly just this:\n\n    git config test.verify \"test command that returns nonzero on fail\"\n\nto default to testing against origin/master:\n\n    git config test.branch origin/master\n\nto do the same, but for a single branch:\n\n    git config branch.mybranch.test parentbranch\n\n\n## Self-Test\n\nTo try the test script with different shells:\n\n    for sh in /bin/dash /bin/bash /bin/ksh /bin/mksh /bin/pdksh; do\n        echo $sh\n        sh test.sh -s $sh\n    done\n\nNote that since version 1.0.2, the shebang is set to `/bin/bash`. Other shells\nare now supported on a \"patches welcome\" basis. (This is largely because I\ncouldn't find a shell I could run in my GNU/Linux environment that behaves\nlike the OS X (FreeBSD?) `sh` shell, which has very different behaviour from\nall the others.)\n\nTo regression test properly:\n\n    rev=$(git rev-parse --short HEAD)\n    cp test.sh regressions_${rev}.sh\n    GIT_TEST_VERIFY=\"sh regressions_${rev}.sh\" git test -v\n\n(The reason for copying the script is to test each commit against the new\ntests, and the reason for naming it based on the current commit is to key the\ncache correctly.)\n\n\n## Installation\n\nYou can just have the `git-test` script in your `PATH`, but there are other\noptions:\n\n### Homebrew (on OS X)\n\nIf you have [Homebrew](http://brew.sh) installed, you can install\n`git-test` with:\n\n    $ brew install git-test\n\n### From source\n\nAside from the packaging, you can also install from source. It's a single\nPOSIX shell script that uses core git, so all that's required for plain `git\ntest` to work (besides git, of course) is that `git-test` needs to be\nsomewhere in your `PATH` (or `GIT_EXEC_PATH`).\n\nYou can install from source by doing the following:\n\n    $ install git-test   /usr/local/bin\n    $ install git-test.1 /usr/local/share/man1\n\nOr just add this directory to your `PATH` environment variable.\n\n### Debian GNU/Linux\n\nThe usual\n\n    $ fakeroot debian/rules binary\n\nShould give you a Debian package.\n\n### Arch Linux\n\nWith Arch Linux, you can use the provided `PKGBUILD` file. Simply download the\nfile and run `makepkg` in the same directory as the file. It will always build\nthe latest `git` version of this package, even if you have an old checkout.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspotify%2Fgit-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspotify%2Fgit-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspotify%2Fgit-test/lists"}