From 8ed36ac5a27df37029c24430d35dd5e65aab9f81 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 5 Aug 2021 16:17:55 -0300 Subject: Use .git symlink to simplify testing of embedded repositories --- Makefile | 7 ++++++- src/gistatic.c | 8 ++++---- 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 ); -- cgit v1.2.3