Skip to content

Commit c9f5fc9

Browse files
committed
Merge branch 'dl/test-cleanup'
Test cleanup. * dl/test-cleanup: (26 commits) t7700: stop losing return codes of git commands t7700: make references to SHA-1 generic t7700: replace egrep with grep t7700: consolidate code into test_has_duplicate_object() t7700: consolidate code into test_no_missing_in_packs() t7700: s/test -f/test_path_is_file/ t7700: move keywords onto their own line t7700: remove spaces after redirect operators t7700: drop redirections to /dev/null t7501: stop losing return codes of git commands t7501: remove spaces after redirect operators t5703: stop losing return codes of git commands t5703: simplify one-time-sed generation logic t5317: use ! grep to check for no matching lines t5317: stop losing return codes of git commands t4138: stop losing return codes of git commands t4015: use test_write_lines() t4015: stop losing return codes of git commands t3600: comment on inducing SIGPIPE in `git rm` t3600: stop losing return codes of git commands ...
2 parents 6d831b8 + d9b31db commit c9f5fc9

12 files changed

+425
-323
lines changed

t/lib-bash.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
# to run under Bash; primarily intended for tests of the completion
33
# script.
44

5-
if test -n "$BASH" && test -z "$POSIXLY_CORRECT"; then
5+
if test -n "$BASH" && test -z "$POSIXLY_CORRECT"
6+
then
67
# we are in full-on bash mode
78
true
8-
elif type bash >/dev/null 2>&1; then
9+
elif type bash >/dev/null 2>&1
10+
then
911
# execute in full-on bash mode
1012
unset POSIXLY_CORRECT
1113
exec bash "$0" "$@"

t/lib-httpd/apply-one-time-sed.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
#
88
# This can be used to simulate the effects of the repository changing in
99
# between HTTP request-response pairs.
10-
if [ -e one-time-sed ]; then
10+
if test -f one-time-sed
11+
then
1112
"$GIT_EXEC_PATH/git-http-backend" >out
12-
sed "$(cat one-time-sed)" <out >out_modified
13+
sed "$(cat one-time-sed)" out >out_modified
1314

14-
if diff out out_modified >/dev/null; then
15+
if cmp -s out out_modified
16+
then
1517
cat out
1618
else
1719
cat out_modified

t/t0014-alias.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ test_expect_success 'looping aliases - internal execution' '
3838
#'
3939

4040
test_expect_success 'run-command formats empty args properly' '
41-
GIT_TRACE=1 git frotz a "" b " " c 2>&1 |
42-
sed -ne "/run_command:/s/.*trace: run_command: //p" >actual &&
41+
test_must_fail env GIT_TRACE=1 git frotz a "" b " " c 2>actual.raw &&
42+
sed -ne "/run_command:/s/.*trace: run_command: //p" actual.raw >actual &&
4343
echo "git-frotz a '\'''\'' b '\'' '\'' c" >expect &&
4444
test_cmp expect actual
4545
'

t/t0090-cache-tree.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ generate_expected_cache_tree_rec () {
2121
parent="$2" &&
2222
# ls-files might have foo/bar, foo/bar/baz, and foo/bar/quux
2323
# We want to count only foo because it's the only direct child
24-
subtrees=$(git ls-files|grep /|cut -d / -f 1|uniq) &&
24+
git ls-files >files &&
25+
subtrees=$(grep / files|cut -d / -f 1|uniq) &&
2526
subtree_count=$(echo "$subtrees"|awk -v c=0 '$1 != "" {++c} END {print c}') &&
26-
entries=$(git ls-files|wc -l) &&
27+
entries=$(wc -l <files) &&
2728
printf "SHA $dir (%d entries, %d subtrees)\n" "$entries" "$subtree_count" &&
2829
for subtree in $subtrees
2930
do

0 commit comments

Comments
 (0)