@@ -56,4 +56,56 @@ test_expect_success 'grep outside repository' '
5656 test_cmp expect actual
5757'
5858
59+ test_expect_success ' imap-send outside repository' '
60+ test_config_global imap.host imaps://localhost &&
61+ test_config_global imap.folder Drafts &&
62+
63+ echo nothing to send >expect &&
64+ test_must_fail git imap-send -v </dev/null 2>actual &&
65+ test_cmp expect actual &&
66+
67+ (
68+ cd non-repo &&
69+ test_must_fail git imap-send -v </dev/null 2>../actual
70+ ) &&
71+ test_cmp expect actual
72+ '
73+
74+ test_expect_success ' check-ref-format outside repository' '
75+ git check-ref-format --branch refs/heads/xyzzy >expect &&
76+ nongit git check-ref-format --branch refs/heads/xyzzy >actual &&
77+ test_cmp expect actual
78+ '
79+
80+ test_expect_success ' diff outside repository' '
81+ echo one >one &&
82+ echo two >two &&
83+ test_must_fail git diff --no-index one two >expect.raw &&
84+ (
85+ cd non-repo &&
86+ cp ../one . &&
87+ cp ../two . &&
88+ test_must_fail git diff one two >../actual.raw
89+ ) &&
90+ # outside repository diff falls back to SHA-1 but
91+ # GIT_DEFAULT_HASH may be set to sha256 on the in-repo side.
92+ sed -e "/^index /d" expect.raw >expect &&
93+ sed -e "/^index /d" actual.raw >actual &&
94+ test_cmp expect actual
95+ '
96+
97+ test_expect_success ' stripspace outside repository' '
98+ nongit git stripspace -s </dev/null
99+ '
100+
101+ test_expect_success ' remote-http outside repository' '
102+ test_must_fail git remote-http 2>actual &&
103+ test_grep "^error: remote-curl" actual &&
104+ (
105+ cd non-repo &&
106+ test_must_fail git remote-http 2>../actual
107+ ) &&
108+ test_grep "^error: remote-curl" actual
109+ '
110+
59111test_done
0 commit comments