@@ -1236,8 +1236,9 @@ bool commit_exists(const char *commit_hash)
1236
1236
1237
1237
pid_t pid ;
1238
1238
/* 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
+ };
1241
1242
int spawn_ret = posix_spawnp (& pid , "git" , & actions , NULL , argv , environ );
1242
1243
posix_spawn_file_actions_destroy (& actions );
1243
1244
if (spawn_ret != 0 ) {
@@ -1261,7 +1262,7 @@ bool commit_exists(const char *commit_hash)
1261
1262
char buffer [1024 ];
1262
1263
while (fgets (buffer , sizeof (buffer ), stream )) {
1263
1264
/* 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 )) {
1265
1266
found = true;
1266
1267
break ;
1267
1268
}
@@ -1304,11 +1305,14 @@ static bool sanity_check()
1304
1305
}
1305
1306
return false;
1306
1307
}
1308
+ if (stat ("/home/runner/work" , & buf )) { /* Skip the check in CI */
1307
1309
#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 ,
1310
1313
"FATAL: The repository is outdated. Please update properly.\n" );
1311
- return false;
1314
+ return false;
1315
+ }
1312
1316
}
1313
1317
1314
1318
return true;
0 commit comments