commit - b2b1792329f5adf1e755614e710d49388845293e
commit + 44ff0a4492e37763f0d19d4eeb2157221122cb1b
blob - 637c3892a77b86d3be16a1e964a55ed285543c41
blob + 31b889e400597f70997ea145da4a699458ca4443
--- regress/gotd/Makefile
+++ regress/gotd/Makefile
REGRESS_TARGETS=test_repo_read test_repo_read_group \
test_repo_read_denied_user test_repo_read_denied_group \
test_repo_read_bad_user test_repo_read_bad_group \
- test_repo_write test_repo_write_empty
+ test_repo_write test_repo_write_empty repo_req_wrong_commit
NOOBJ=Yes
.PHONY: ensure_root prepare_test_repo check_test_repo start_gotd
@$(GOTD_STOP_CMD) 2>/dev/null
@su -m ${GOTD_USER} -c 'env $(GOTD_TEST_ENV) sh ./check_test_repo.sh'
+repo_req_wrong_commit: prepare_test_repo_empty start_gotd_ro
+ @-$(GOTD_TRAP); su -m ${GOTD_TEST_USER} -c \
+ 'env $(GOTD_TEST_ENV) sh ./repo_req_wrong_commit.sh'
+ @$(GOTD_STOP_CMD) 2>/dev/null
+
.include <bsd.regress.mk>
blob - /dev/null
blob + 6f231756ab4735e23571a91145eabebe5484620e (mode 644)
--- /dev/null
+++ regress/gotd/repo_req_wrong_commit.sh
+#!/bin/sh
+#
+# Copyright (c) 2022 Mikhail Pchelin <misha@freebsd.org>
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+. ../cmdline/common.sh
+. ./common.sh
+
+test_wrong_commit() {
+ local testroot=`test_init wrong_commit`
+
+ echo "0054want aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa multi_ack \
+side-band-64k ofs-delta" | ssh ${GOTD_DEVUSER}@127.0.0.1 \
+ git-upload-pack '/test-repo' > $testroot/stdout \
+ 2>$testroot/stderr
+
+ echo -n "0041ERR object aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \
+not found" > $testroot/stdout.expected
+
+ echo "gotsh: object aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \
+not found" > $testroot/stderr.expected
+
+ # We use OpenBSD cmp(1) offset extension
+ cmp -s $testroot/stdout $testroot/stdout.expected 112 0
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ echo "unexpected stdout" >&2
+ test_done "$testroot" "1"
+ return 1
+ fi
+
+ cmp -s $testroot/stderr $testroot/stderr.expected
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ echo "unexpected stderr" >&2
+ test_done "$testroot" "1"
+ return 1
+ fi
+ test_done "$testroot" "$ret"
+}
+
+test_parseargs "$@"
+run_test test_wrong_commit