GIT-TEST(1)
π GIT-TEST(1) π
okay bestie, welcome to the git-test manual β this is the User Commands page for git-test version 1.0.4, and yes we're gonna get into all of it. grab a snack. π
β¨ NAME β¨
git-test β literally the whole manual page for git-test version 1.0.4, that's it, that's the name section π«Ά
πΈ SYNOPSIS πΈ
git test [options] [refs...]
git test --clear [refs...]
git test --version
π¦ DESCRIPTION π¦
So the vibe is: run tests on each distinct tree in a revision list. That's the whole pitch, and honestly? iconic. π
The 99% example is simply:
git test
If no refs are specified, the default operation is to test the commits on the current branch that are not in the origin branch of the same name, nor in origin/master. If neither origin/"current branch", nor origin/master exist, git-test will refuse to run in order to protect against surprisingly large runs. Bestie this is a real thing that would happen if, for instance, you're simply not using a remote named origin, in a large project with many versions. π
This is currently not configurable, but if you want any other ref, you can just supply it:
git test HEAD ^jeff/development
Note that ref exclusions are almost always necessary since not having them would mean testing everything since the dawn of time. π (no literally, everything.)
For example, this will test all commits on master that have not been pushed to origin:
git test --verify="make test" master ^origin/master
Tests are assumed to be deterministic and git-test uses a cache of trees with known results to speed up testing. Having non-deterministic, "flappy" tests, is a very special circle of hell, but there are some limited facilities for dealing with this situation. (Besides the obvious, fixing your tests.) π
Running with the verbose option shows progress as it happens:
$ git test
the-branch ^origin/the-branch ^origin/master will test 2 commits
iter commit tree result
0000 83d611b 718c490 ... pass
0001 0be28e9 6908e0d ... pass
Immediately re-running the tests will just take the results from the cache:
$ git test
the-branch ^origin/the-branch ^origin/master will test 2 commits
iter commit tree result
0000 83d611b 718c490 ... pass (cached)
0001 0be28e9 6908e0d ... pass (cached)
look at that caching go. she ate. π
π CONFIGURATION π
To specify what to run on each tree, the arguments --pre, --post and --verify can be used to set housekeeping commands and a (required) verifying command. The result of the housekeeping commands are ignored, because it's often convenient to just let it fail if there is nothing to clean up, or there's no artifact to save, or whatever it is you were trying to do. no stress, no drama. π§
To avoid having to specify action(s) on every invocation, they can be set using git-config feature, preferrably locally:
git config test.verify "make test"
git config test.pre "rm -f test-output"
git config test.post "cp a.out a.out.\$commit"
Alternatively, these can be set through environment variables GIT_TEST_PRE, GIT_TEST_POST and GIT_TEST_VERIFY respectively. pick your fighter. π«Ά
A default ref (usually a branch) to test against can be configured:
git config test.branch origin/release
A default ref can also be set for a specific branch:
git config branch.myfeature.test origin/staging
β¨ OPTIONS β¨
Available options are π
-v,--verboseβ be more explicit about what is going on (she's a talker, we love her)-q,--quietβ be quiet (shhh π€«)-r,--redo... β test if[any/pass/fail/both/never]result cached for tree. See the REDO MODES section-o,--output... β output directory for reports. See the SAVING OUTPUT section--pre...,--post... β command to run before and after running the test. Overrides the environment variablesGIT_TEST_PRE,GIT_TEST_POSTand thegit-configoptionstest.pre,test.post--verify... β the command to run as test. Overrides the environment variableGIT_TEST_VERIFYand thegit-configoptiontest.verify
π ACTIONS π
--clearβ clear the results cache (bye bye data π§Ή)--versionβ print version info and quit
π₯ REDO MODES π₯
If the tests have false negatives, git-test can be instructed to re-test failing commits. For symmetry, re-test everything, (all or any) re-test passing tests and the default behavior to never re-test can be specified. yes bestie, there's a mode for every mood. π
a,any,all,alwaysβ Always run all testp,pass,passed,passingβ Retest passed (and flappy) testsf,fail,failed,failingβ Retest failed (and flappy) testsb,both,flap,flappyβ Retest only flappy testsn,no,none,neverβ Never retest, always trust cache
(Default: none)
πΈ SAVING OUTPUT πΈ
By adding -o/--output to specify where, you can tell git-test to save stdout and stderr from the actions in separate files by tree. π
Files are created for each tree and symlinked from commit and test-run timestamp directories.
Example:
reports/
|-- 1418737218
| `-- 0000_pass -> ../tree/f864c32_4aab77c_pass
| `-- 0001_pass -> ../tree/da47834_4aab77c_pass
|-- 1418737342
| `-- 0000_pass -> ../tree/da47834_4aab77c_pass
|-- commit
| `-- 6eaff36_pass -> ../tree/f864c32_4aab77c_pass
| `-- 9d0234d_pass -> ../tree/da47834_4aab77c_pass
|-- latest -> 1418737342
`-- tree
|-- da47834_4aab77c_pass
`-- f864c32_4aab77c_pass
π CLEARING THE CACHE π
If refs are supplied when clearing the cache, the trees of the specified commits will be cleared, even though those exact trees may appear in other commits. It is what was requested and doing anything else would likely be prohibitively expensive and very confusing. so likeβ¦ we're doing it the requested way, periodt. π
π«Ά AUTHORS π«Ά
Anders Eurenius <aes@eurenius.eu>
π COPYRIGHT π
Copyright (C) 2015 Spotify AB Copyright (C) 2016 Anders Eurenius
β LICENSE β
Apache License 2.0
π§ SEE ALSO π§
- The full documentation for
git-testis the source. Whether it conflicts with any other information or not, the computer will execute the code, never the documentation. read that again bestie. π git-rebase(1), in particular, theexecfeaturegit-bisect(1)might also be of interest- For more information, please re-read.
fr fr, the source is the truth and this page is just the vibe. iykyk. π
that's the whole page!! git-test version 1.0.4, dated August 2016, and this was GIT-TEST(1) β slay, go run some tests, mwah πβ¨
π¦ where this page comes from
- nixos 26.05: git-test 1.0.4
- nixpkgs unstable: git-test 1.0.4
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms