Skip to content

Commit 185e618

Browse files
authored
Merge pull request #187 from jserv/hotfix-sanity-check
Disable full git log validation in CI
2 parents 993fc09 + 8f0fb3e commit 185e618

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

qtest.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,8 +1236,9 @@ bool commit_exists(const char *commit_hash)
12361236

12371237
pid_t pid;
12381238
/* Use "--no-abbrev-commit" to ensure full SHA-1 hash is printed */
1239-
char *argv[] = {"git", "log", "--pretty=oneline", "--no-abbrev-commit",
1240-
NULL};
1239+
char *argv[] = {
1240+
"git", "log", "--pretty=oneline", "--no-abbrev-commit", NULL,
1241+
};
12411242
int spawn_ret = posix_spawnp(&pid, "git", &actions, NULL, argv, environ);
12421243
posix_spawn_file_actions_destroy(&actions);
12431244
if (spawn_ret != 0) {
@@ -1261,7 +1262,7 @@ bool commit_exists(const char *commit_hash)
12611262
char buffer[1024];
12621263
while (fgets(buffer, sizeof(buffer), stream)) {
12631264
/* Compare the first 40 characters of each line with commit_hash */
1264-
if (strncmp(buffer, commit_hash, 40) == 0) {
1265+
if (!strncmp(buffer, commit_hash, 40)) {
12651266
found = true;
12661267
break;
12671268
}
@@ -1304,11 +1305,14 @@ static bool sanity_check()
13041305
}
13051306
return false;
13061307
}
1308+
if (stat("/home/runner/work", &buf)) { /* Skip the check in CI */
13071309
#define COPYRIGHT_COMMIT_SHA1 "50c5ac53d31adf6baac4f8d3db6b3ce2215fee40"
1308-
if (!commit_exists(COPYRIGHT_COMMIT_SHA1)) {
1309-
fprintf(stderr,
1310+
if (!commit_exists(COPYRIGHT_COMMIT_SHA1)) {
1311+
fprintf(
1312+
stderr,
13101313
"FATAL: The repository is outdated. Please update properly.\n");
1311-
return false;
1314+
return false;
1315+
}
13121316
}
13131317

13141318
return true;

0 commit comments

Comments
 (0)