From: Jiang Xin <worldhello.net@gmail.com>
To: Junio C Hamano <gitster@pobox.com>, Git List <git@vger.kernel.org>
Cc: Jiang Xin <zhiyou.jx@alibaba-inc.com>
Subject: [PATCH 1/2] test-lib-functions: test_create_repo learns --bare
Date: Thu, 17 Jun 2021 20:43:30 +0800 [thread overview]
Message-ID: <20210617124331.17888-1-zhiyou.jx@alibaba-inc.com> (raw)
"test_create_repo" learns --bare option to create bare repository.
Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
---
t/test-lib-functions.sh | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index b823c14027..f6d1afe295 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -1216,8 +1216,21 @@ test_atexit () {
}
# Most tests can use the created repository, but some may need to create more.
-# Usage: test_create_repo <directory>
+# Usage: test_create_repo [--bare] <directory>
test_create_repo () {
+ bare= &&
+ while test $# -gt 0
+ do
+ case "$1" in
+ --bare)
+ bare=yes
+ ;;
+ *)
+ break
+ ;;
+ esac
+ shift
+ done &&
test "$#" = 1 ||
BUG "not 1 parameter to test-create-repo"
repo="$1"
@@ -1226,10 +1239,13 @@ test_create_repo () {
cd "$repo" || error "Cannot setup test environment"
"${GIT_TEST_INSTALLED:-$GIT_EXEC_PATH}/git$X" -c \
init.defaultBranch="${GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME-master}" \
- init \
+ init ${bare:+--bare} \
"--template=$GIT_BUILD_DIR/templates/blt/" >&3 2>&4 ||
error "cannot run git init -- have you built things yet?"
- mv .git/hooks .git/hooks-disabled
+ if test -z "$bare"
+ then
+ mv .git/hooks .git/hooks-disabled
+ fi
) || exit
}
--
2.32.0.rc0.27.g7b1e85181b
next reply other threads:[~2021-06-17 12:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-17 12:43 Jiang Xin [this message]
2021-06-17 12:43 ` [PATCH 2/2] test: create repo using test_create_repo Jiang Xin
2021-06-22 16:48 ` [PATCH 1/2] test-lib-functions: test_create_repo learns --bare Ævar Arnfjörð Bjarmason
2021-06-23 0:53 ` Jiang Xin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210617124331.17888-1-zhiyou.jx@alibaba-inc.com \
--to=worldhello.net@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=zhiyou.jx@alibaba-inc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).