From: Jeff King <peff@peff.net>
To: David Turner <dturner@twopensource.com>
Cc: git@vger.kernel.org, "Michael Haggerty" <mhagger@alum.mit.edu>,
"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 6/6] use setup_git_directory() in test-* programs
Date: Sat, 5 Mar 2016 17:16:50 -0500 [thread overview]
Message-ID: <20160305221650.GF31508@sigill.intra.peff.net> (raw)
In-Reply-To: <20160305220829.GA31316@sigill.intra.peff.net>
Some of the test-* programs rely on examining refs, but did
not bother to make sure we are actually in a git repository.
Let's have them call setup_git_directory() to do so.
Signed-off-by: Jeff King <peff@peff.net>
---
As discussed elsewhere, test-match-trees isn't actually used in the test
suite (except for the weird use which was removed in patch 1 here). So
we could also just get rid of it, but maybe somebody uses it for
debugging or something.
test-match-trees.c | 2 ++
test-revision-walking.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/test-match-trees.c b/test-match-trees.c
index 109f03e..4dad709 100644
--- a/test-match-trees.c
+++ b/test-match-trees.c
@@ -6,6 +6,8 @@ int main(int ac, char **av)
unsigned char hash1[20], hash2[20], shifted[20];
struct tree *one, *two;
+ setup_git_directory();
+
if (get_sha1(av[1], hash1))
die("cannot parse %s as an object name", av[1]);
if (get_sha1(av[2], hash2))
diff --git a/test-revision-walking.c b/test-revision-walking.c
index 285f06b..3d03133 100644
--- a/test-revision-walking.c
+++ b/test-revision-walking.c
@@ -50,6 +50,8 @@ int main(int argc, char **argv)
if (argc < 2)
return 1;
+ setup_git_directory();
+
if (!strcmp(argv[1], "run-twice")) {
printf("1st\n");
if (!run_revision_walk())
--
2.8.0.rc1.318.g2193183
next prev parent reply other threads:[~2016-03-05 22:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-05 22:08 [PATCH 0/6] avoid touching ref code in non-repositories Jeff King
2016-03-05 22:10 ` [PATCH 1/6] setup: make startup_info available everywhere Jeff King
2016-03-05 22:11 ` [PATCH 2/6] setup: set startup_info->have_repository more reliably Jeff King
2016-03-05 22:11 ` [PATCH 3/6] remote: don't resolve HEAD in non-repository Jeff King
2016-03-05 22:13 ` [PATCH 4/6] mailmap: do not resolve blobs in a non-repository Jeff King
2016-03-05 22:15 ` [PATCH 5/6] grep: turn off gitlink detection for --no-index Jeff King
2016-03-07 1:29 ` Junio C Hamano
2016-03-07 15:51 ` [PATCH v2 " Jeff King
2016-03-05 22:16 ` Jeff King [this message]
2016-03-07 1:28 ` [PATCH 6/6] use setup_git_directory() in test-* programs Junio C Hamano
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=20160305221650.GF31508@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=dturner@twopensource.com \
--cc=git@vger.kernel.org \
--cc=mhagger@alum.mit.edu \
--cc=pclouds@gmail.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).