aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2021-08-05 16:17:55 -0300
committerEuAndreh <eu@euandre.org>2021-08-05 16:17:55 -0300
commit8ed36ac5a27df37029c24430d35dd5e65aab9f81 (patch)
treeb012f11791dcf04baa93aacf7eea1bed80df5c60
parent.gitignore: Add tmp/ (diff)
downloadgistatic-8ed36ac5a27df37029c24430d35dd5e65aab9f81.tar.gz
gistatic-8ed36ac5a27df37029c24430d35dd5e65aab9f81.tar.xz
Use .git symlink to simplify testing of embedded repositories
-rw-r--r--Makefile7
-rw-r--r--src/gistatic.c8
2 files changed, 10 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 55d389e..709364c 100644
--- a/Makefile
+++ b/Makefile
@@ -38,12 +38,17 @@ manpages = $(manpages.in:.in=)
all: $(manpages) src/gistatic
check: all src/gistatic.t
+ rm -f tests/resources/repo-1/.git
+ rm -f tests/resources/repo-2/.git
+ ln -s .gitdir tests/resources/repo-1/.git
+ ln -s .gitdir tests/resources/repo-2/.git
./src/gistatic.t
sh aux/assert-catgets.sh src/gistatic.c
clean:
rm -rf public/ $(manpages) README.*.md CHANGELOG.*.md messages.mo \
- src/gistatic src/gistatic.t vgcore.*
+ src/gistatic src/gistatic.t vgcore.* \
+ tests/resources/repo-1/.git tests/resources/repo-2/.git
install: all
mkdir -p $(DESTDIR)$(PREFIX)/bin
diff --git a/src/gistatic.c b/src/gistatic.c
index 0ce8394..3ce77bc 100644
--- a/src/gistatic.c
+++ b/src/gistatic.c
@@ -949,11 +949,11 @@ cleanup:
static void test_last_commit_date() {
test_start("test_last_commit_date");
{
- testing("embedded Git repository tests/submodules/repo-1");
+ testing("embedded Git repository tests/resources/repo-1");
struct git_repository *repo;
const int e = git_repository_open_ext(
&repo,
- "tests/resources/repo-1/.gitdir",
+ "tests/resources/repo-1",
GIT_REPOSITORY_OPEN_NO_SEARCH,
NULL
);
@@ -966,11 +966,11 @@ static void test_last_commit_date() {
test_ok();
}
{
- testing("embedded Git repository tests/submodules/repo-2");
+ testing("embedded Git repository tests/resources/repo-2");
struct git_repository *repo;
const int e = git_repository_open_ext(
&repo,
- "tests/resources/repo-2/.gitdir",
+ "tests/resources/repo-2",
GIT_REPOSITORY_OPEN_NO_SEARCH,
NULL
);