2
3
test_description='git for-each-repo builtin'
4
5
+# We need to test running 'git for-each-repo' outside of a repo context.
6
+TEST_NO_CREATE_REPO=1
7
+
8
. ./test-lib.sh
9
10
test_expect_success 'run based on configured value' '
13
git init three &&
14
git init ~/four &&
15
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" &&
15
- git config --add run.key "~/four" &&
16
+ git config --global run.key "$TRASH_DIRECTORY/one" &&
17
+ git config --global --add run.key "$TRASH_DIRECTORY/three" &&
18
+ git config --global --add run.key "~/four" &&
19
+
20
git for-each-repo --config=run.key commit --allow-empty -m "ran" &&
21
git -C one log -1 --pretty=format:%s >message &&
22
grep ran message &&
26
grep ran message &&
27
git -C ~/four log -1 --pretty=format:%s >message &&
28
grep ran message &&
29
+
30
git for-each-repo --config=run.key -- commit --allow-empty -m "ran again" &&
31
git -C one log -1 --pretty=format:%s >message &&
32
grep again message &&
51
'
52
53
test_expect_success 'error on NULL value for config keys' '
49
- cat >>.git/config <<-\EOF &&
54
+ cat >>.gitconfig <<-\EOF &&
55
[empty]
56
key
57
EOF
64
'
65
66
test_expect_success '--keep-going' '
62
- git config keep.going non-existing &&
63
- git config --add keep.going . &&
67
+ git config --global keep.going non-existing &&
68
+ git config --global --add keep.going one &&
69
70
test_must_fail git for-each-repo --config=keep.going \
71
-- branch >out 2>err &&
75
test_must_fail git for-each-repo --config=keep.going --keep-going \
76
-- branch >out 2>err &&
77
test_grep "cannot change to .*non-existing" err &&
73
- git branch >expect &&
78
+ git -C one branch >expect &&
79
test_cmp expect out
80
'
81