]>
Commit | Line | Data |
---|---|---|
4950b2a2 DS |
1 | #!/bin/sh |
2 | ||
3 | test_description='git for-each-repo builtin' | |
4 | ||
5 | . ./test-lib.sh | |
6 | ||
7 | test_expect_success 'run based on configured value' ' | |
8 | git init one && | |
9 | git init two && | |
10 | git init three && | |
13d5bbdf | 11 | git init ~/four && |
4950b2a2 DS |
12 | git -C two commit --allow-empty -m "DID NOT RUN" && |
13 | git config run.key "$TRASH_DIRECTORY/one" && | |
14 | git config --add run.key "$TRASH_DIRECTORY/three" && | |
13d5bbdf | 15 | git config --add run.key "~/four" && |
4950b2a2 DS |
16 | git for-each-repo --config=run.key commit --allow-empty -m "ran" && |
17 | git -C one log -1 --pretty=format:%s >message && | |
18 | grep ran message && | |
19 | git -C two log -1 --pretty=format:%s >message && | |
20 | ! grep ran message && | |
21 | git -C three log -1 --pretty=format:%s >message && | |
22 | grep ran message && | |
13d5bbdf RP |
23 | git -C ~/four log -1 --pretty=format:%s >message && |
24 | grep ran message && | |
4950b2a2 DS |
25 | git for-each-repo --config=run.key -- commit --allow-empty -m "ran again" && |
26 | git -C one log -1 --pretty=format:%s >message && | |
27 | grep again message && | |
28 | git -C two log -1 --pretty=format:%s >message && | |
29 | ! grep again message && | |
30 | git -C three log -1 --pretty=format:%s >message && | |
13d5bbdf RP |
31 | grep again message && |
32 | git -C ~/four log -1 --pretty=format:%s >message && | |
4950b2a2 DS |
33 | grep again message |
34 | ' | |
35 | ||
6c62f015 DS |
36 | test_expect_success 'do nothing on empty config' ' |
37 | # the whole thing would fail if for-each-ref iterated even | |
38 | # once, because "git help --no-such-option" would fail | |
39 | git for-each-repo --config=bogus.config -- help --no-such-option | |
40 | ' | |
41 | ||
4950b2a2 | 42 | test_done |