aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitmodules6
-rw-r--r--src/gistatic.c23
m---------tests/submodules/repo-10
m---------tests/submodules/repo-20
4 files changed, 26 insertions, 3 deletions
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..0c070fa
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,6 @@
+[submodule "tests/submodules/repo-2"]
+ path = tests/submodules/repo-2
+ url = https://euandreh.xyz/gistatic-repo-2.git/
+[submodule "tests/submodules/repo-1"]
+ path = tests/submodules/repo-1
+ url = https://euandreh.xyz/gistatic-repo-1.git/
diff --git a/src/gistatic.c b/src/gistatic.c
index 92bcf7d..3464e89 100644
--- a/src/gistatic.c
+++ b/src/gistatic.c
@@ -911,18 +911,35 @@ cleanup:
static void test_last_commit_date() {
test_start("test_last_commit_date");
{
- testing("embedded Git repository");
+ testing("embedded Git repository tests/submodules/repo-1");
struct git_repository *repo;
const int e = git_repository_open_ext(
&repo,
- "tests/resources/embedded-repo",
+ "tests/submodules/repo-1",
GIT_REPOSITORY_OPEN_NO_SEARCH,
NULL
);
assert(e == 0);
char *const date = last_commit_date(repo);
assert(date);
- assert(strcmp(date, "2021-07-30 14:18") == 0);
+ assert(strcmp(date, "2021-07-31 19:24") == 0);
+ free(date);
+ git_repository_free(repo);
+ test_ok();
+ }
+ {
+ testing("embedded Git repository tests/submodules/repo-2");
+ struct git_repository *repo;
+ const int e = git_repository_open_ext(
+ &repo,
+ "tests/submodules/repo-2",
+ GIT_REPOSITORY_OPEN_NO_SEARCH,
+ NULL
+ );
+ assert(e == 0);
+ char *const date = last_commit_date(repo);
+ assert(date);
+ assert(strcmp(date, "2021-07-31 19:27") == 0);
free(date);
git_repository_free(repo);
test_ok();
diff --git a/tests/submodules/repo-1 b/tests/submodules/repo-1
new file mode 160000
+Subproject cd361fd9443d04c4563df5ca35689a639aad945
diff --git a/tests/submodules/repo-2 b/tests/submodules/repo-2
new file mode 160000
+Subproject 4e63a2b00ec7e4d4a25262c97bb5d698cd72e3d