From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: [PATCH 1/3] t5000: extract nongit function to test-lib-functions.sh
Date: Thu, 15 Dec 2016 21:30:12 -0500 [thread overview]
Message-ID: <20161216023011.7k4wyekid3zitl56@sigill.intra.peff.net> (raw)
In-Reply-To: <20161216022904.cjang6napnl2vkc6@sigill.intra.peff.net>
This function abstracts the idea of running a command
outside of any repository (which is slightly awkward to do
because even if you make a non-repo directory, git may keep
walking up outside of the trash directory). There are
several scripts that use the same technique, so let's make
the function available for everyone.
Signed-off-by: Jeff King <peff@peff.net>
---
I waffled on the name. Something like test_outside_repo() is more
descriptive, but as this is prepended to existing commands, the lines
already end up quite long.
t/t5000-tar-tree.sh | 14 --------------
t/test-lib-functions.sh | 14 ++++++++++++++
2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
index 830bf2a2f6..886b6953e4 100755
--- a/t/t5000-tar-tree.sh
+++ b/t/t5000-tar-tree.sh
@@ -94,20 +94,6 @@ check_tar() {
'
}
-# run "$@" inside a non-git directory
-nongit () {
- test -d non-repo ||
- mkdir non-repo ||
- return 1
-
- (
- GIT_CEILING_DIRECTORIES=$(pwd) &&
- export GIT_CEILING_DIRECTORIES &&
- cd non-repo &&
- "$@"
- )
-}
-
test_expect_success \
'populate workdir' \
'mkdir a &&
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index fdaeb3a96b..adab7f51f4 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -994,3 +994,17 @@ test_copy_bytes () {
}
' - "$1"
}
+
+# run "$@" inside a non-git directory
+nongit () {
+ test -d non-repo ||
+ mkdir non-repo ||
+ return 1
+
+ (
+ GIT_CEILING_DIRECTORIES=$(pwd) &&
+ export GIT_CEILING_DIRECTORIES &&
+ cd non-repo &&
+ "$@"
+ )
+}
--
2.11.0.348.g960a0b554
next prev parent reply other threads:[~2016-12-16 2:30 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-15 20:40 index-pack outside of repository? Jeff King
2016-12-16 0:13 ` Junio C Hamano
2016-12-16 1:37 ` Jeff King
2016-12-16 2:29 ` Jeff King
2016-12-16 2:30 ` Jeff King [this message]
2016-12-16 2:30 ` [PATCH 2/3] index-pack: complain when --stdin is used outside of a repo Jeff King
2016-12-16 2:31 ` [PATCH 3/3] t: use nongit() function where applicable Jeff King
2016-12-16 17:52 ` index-pack outside of repository? Junio C Hamano
2016-12-16 17:59 ` Junio C Hamano
2016-12-16 18:01 ` Junio C Hamano
2016-12-16 21:43 ` Jeff King
2016-12-16 21:55 ` Junio C Hamano
2016-12-16 18:54 ` Junio C Hamano
2016-12-16 21:44 ` Jeff King
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161216023011.7k4wyekid3zitl56@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).