File 0006-test-git-C-workaround.patch of Package git.openSUSE_13.1_Update
From: Takashi Iwai <tiwai@suse.de>
Subject: use a wrapper for faking git -C
References: bsc#948969
The old git has no -C option while new tests want it.
Add a wrapper to fake it in each test unit.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
t/t5811-proto-disable-git.sh | 8 +++++++-
t/t5812-proto-disable-http.sh | 8 +++++++-
t/t5815-submodule-protos.sh | 14 ++++++++++----
3 files changed, 24 insertions(+), 6 deletions(-)
--- a/t/t5811-proto-disable-git.sh
+++ b/t/t5811-proto-disable-git.sh
@@ -6,13 +6,19 @@ test_description='test disabling of git-
. "$TEST_DIRECTORY/lib-git-daemon.sh"
start_git_daemon
+git_C () {
+ local d="$1"
+ shift
+ (cd "$d"; git "$@")
+}
+
test_expect_success 'create git-accessible repo' '
bare="$GIT_DAEMON_DOCUMENT_ROOT_PATH/repo.git" &&
test_commit one &&
git --bare init "$bare" &&
git push "$bare" HEAD &&
>"$bare/git-daemon-export-ok" &&
- git -C "$bare" config daemon.receivepack true
+ git_C "$bare" config daemon.receivepack true
'
test_proto "git://" git "$GIT_DAEMON_URL/repo.git"
--- a/t/t5812-proto-disable-http.sh
+++ b/t/t5812-proto-disable-http.sh
@@ -6,12 +6,18 @@ test_description='test disabling of git-
. "$TEST_DIRECTORY/lib-httpd.sh"
start_httpd
+git_C () {
+ local d="$1"
+ shift
+ (cd "$d"; git "$@")
+}
+
test_expect_success 'create git-accessible repo' '
bare="$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
test_commit one &&
git --bare init "$bare" &&
git push "$bare" HEAD &&
- git -C "$bare" config http.receivepack true
+ git_C "$bare" config http.receivepack true
'
test_proto "smart http" http "$HTTPD_URL/smart/repo.git"
--- a/t/t5815-submodule-protos.sh
+++ b/t/t5815-submodule-protos.sh
@@ -7,6 +7,12 @@ test_description='test protocol whitelis
setup_ext_wrapper
setup_ssh_wrapper
+git_C () {
+ local d="$1"
+ shift
+ (cd "$d"; git "$@")
+}
+
test_expect_success 'setup repository with submodules' '
mkdir remote &&
git init remote/repo.git &&
@@ -25,19 +31,19 @@ test_expect_success 'clone with recurse-
test_expect_success 'setup individual updates' '
rm -rf dst &&
git clone . dst &&
- git -C dst submodule init
+ git_C dst submodule init
'
test_expect_success 'update of ssh allowed' '
- git -C dst submodule update ssh-module
+ git_C dst submodule update ssh-module
'
test_expect_success 'update of ext not allowed' '
- test_must_fail git -C dst submodule update ext-module
+ test_must_fail git_C dst submodule update ext-module
'
test_expect_success 'user can override whitelist' '
- GIT_ALLOW_PROTOCOL=ext git -C dst submodule update ext-module
+ GIT_ALLOW_PROTOCOL=ext git_C dst submodule update ext-module
'
test_done