Skip to content

Commit 65d33db

Browse files
LemmingAvalanchegitster
authored andcommitted
t0014: test shadowing of aliases for a sample of builtins
The previous commit added tests for shadowing deprecated builtins. Let’s make the test suite more complete by exercising a sample of the builtins and in turn test the documentation for git-config(1): To avoid confusion and troubles with script usage, aliases that hide existing Git commands are ignored except for deprecated commands. Signed-off-by: Kristoffer Haugsbakk <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bf68b11 commit 65d33db

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

t/t0014-alias.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,21 @@ test_expect_success 'can alias-shadow via two deprecated builtins' '
9595
test_cmp expect actual
9696
'
9797

98+
cannot_alias_regular_builtin () {
99+
cmd="$1" &&
100+
# some git(1) commands will fail... (see above)
101+
test_might_fail git "$cmd" -h >expect &&
102+
test_file_not_empty expect &&
103+
test_might_fail git -c alias."$cmd"=status "$cmd" -h >actual &&
104+
test_cmp expect actual
105+
}
106+
107+
test_expect_success 'cannot alias-shadow a sample of regular builtins' '
108+
for cmd in grep check-ref-format interpret-trailers \
109+
checkout-index fast-import diagnose rev-list prune
110+
do
111+
cannot_alias_regular_builtin "$cmd" || return 1
112+
done
113+
'
114+
98115
test_done

0 commit comments

Comments
 (0)