Skip to content

Commit aecff47

Browse files
Clemens Buchachergitster
authored andcommitted
t5570: use explicit push refspec
The default mode for push without arguments will change. Some warnings are about to be enabled for such use, which causes some t5570 tests to fail because they do not expect this output. Fix this by passing an explicit refspec to git push. To that end, change the calling conventions of test_remote_error in order to accomodate extra command arguments. Signed-off-by: Clemens Buchacher <[email protected]> Signed-off-by: Junio C Hamano <[email protected]> Signed-off-by: Matthieu Moy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b55e677 commit aecff47

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

t/t5570-git-daemon.sh

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,12 @@ test_remote_error()
103103
esac
104104
done
105105

106-
if test $# -ne 3
107-
then
108-
error "invalid number of arguments"
109-
fi
110-
106+
msg=$1
107+
shift
111108
cmd=$1
112-
repo=$2
113-
msg=$3
109+
shift
110+
repo=$1
111+
shift || error "invalid number of arguments"
114112

115113
if test -x "$GIT_DAEMON_DOCUMENT_ROOT_PATH/$repo"
116114
then
@@ -122,7 +120,7 @@ test_remote_error()
122120
fi
123121
fi
124122

125-
test_must_fail git "$cmd" "$GIT_DAEMON_URL/$repo" 2>output &&
123+
test_must_fail git "$cmd" "$GIT_DAEMON_URL/$repo" "$@" 2>output &&
126124
echo "fatal: remote error: $msg: /$repo" >expect &&
127125
test_cmp expect output
128126
ret=$?
@@ -131,18 +129,18 @@ test_remote_error()
131129
}
132130

133131
msg="access denied or repository not exported"
134-
test_expect_success 'clone non-existent' "test_remote_error clone nowhere.git '$msg'"
135-
test_expect_success 'push disabled' "test_remote_error push repo.git '$msg'"
136-
test_expect_success 'read access denied' "test_remote_error -x fetch repo.git '$msg'"
137-
test_expect_success 'not exported' "test_remote_error -n fetch repo.git '$msg'"
132+
test_expect_success 'clone non-existent' "test_remote_error '$msg' clone nowhere.git "
133+
test_expect_success 'push disabled' "test_remote_error '$msg' push repo.git master"
134+
test_expect_success 'read access denied' "test_remote_error -x '$msg' fetch repo.git "
135+
test_expect_success 'not exported' "test_remote_error -n '$msg' fetch repo.git "
138136

139137
stop_git_daemon
140138
start_git_daemon --informative-errors
141139

142-
test_expect_success 'clone non-existent' "test_remote_error clone nowhere.git 'no such repository'"
143-
test_expect_success 'push disabled' "test_remote_error push repo.git 'service not enabled'"
144-
test_expect_success 'read access denied' "test_remote_error -x fetch repo.git 'no such repository'"
145-
test_expect_success 'not exported' "test_remote_error -n fetch repo.git 'repository not exported'"
140+
test_expect_success 'clone non-existent' "test_remote_error 'no such repository' clone nowhere.git "
141+
test_expect_success 'push disabled' "test_remote_error 'service not enabled' push repo.git master"
142+
test_expect_success 'read access denied' "test_remote_error -x 'no such repository' fetch repo.git "
143+
test_expect_success 'not exported' "test_remote_error -n 'repository not exported' fetch repo.git "
146144

147145
stop_git_daemon
148146
test_done

0 commit comments

Comments
 (0)