Merge branch 'cb/grep-pcre-ucp'
[alt-git.git] / t / t0068-for-each-repo.sh
blob3648d439a87eabb37b581cf5e731f9048085703b
1 #!/bin/sh
3 test_description='git for-each-repo builtin'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
8 test_expect_success 'run based on configured value' '
9 git init one &&
10 git init two &&
11 git init three &&
12 git init ~/four &&
13 git -C two commit --allow-empty -m "DID NOT RUN" &&
14 git config run.key "$TRASH_DIRECTORY/one" &&
15 git config --add run.key "$TRASH_DIRECTORY/three" &&
16 git config --add run.key "~/four" &&
17 git for-each-repo --config=run.key commit --allow-empty -m "ran" &&
18 git -C one log -1 --pretty=format:%s >message &&
19 grep ran message &&
20 git -C two log -1 --pretty=format:%s >message &&
21 ! grep ran message &&
22 git -C three log -1 --pretty=format:%s >message &&
23 grep ran message &&
24 git -C ~/four log -1 --pretty=format:%s >message &&
25 grep ran message &&
26 git for-each-repo --config=run.key -- commit --allow-empty -m "ran again" &&
27 git -C one log -1 --pretty=format:%s >message &&
28 grep again message &&
29 git -C two log -1 --pretty=format:%s >message &&
30 ! grep again message &&
31 git -C three log -1 --pretty=format:%s >message &&
32 grep again message &&
33 git -C ~/four log -1 --pretty=format:%s >message &&
34 grep again message
37 test_expect_success 'do nothing on empty config' '
38 # the whole thing would fail if for-each-ref iterated even
39 # once, because "git help --no-such-option" would fail
40 git for-each-repo --config=bogus.config -- help --no-such-option
43 test_done