Skip to content

Commit 722ace6

Browse files
committed
fix(test): guard git_context git helpers behind #ifndef _WIN32
On Windows every git_context test SKIP_PLATFORMs, leaving git_run/make_git_repo as unused static functions -> -Wunused-function under -Werror failed the Windows build. Guard the two helpers (only called from the non-Windows test bodies) so the file compiles clean on Windows while the tests still run on Linux/macOS. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
1 parent 354befe commit 722ace6

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎tests/test_git_context.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434
#include <limits.h>
3535
#endif
3636

37+
/* These helpers shell out to git and are only used by the non-Windows test
38+
* bodies below; on Windows every test SKIP_PLATFORMs, so guard them here too or
39+
* they'd be unused-static functions and fail the -Werror build. */
40+
#ifndef _WIN32
3741
/* Run a git command inside dir, return 0 on success. */
3842
static int git_run(const char *dir, const char *args) {
3943
char cmd[1024];
@@ -55,6 +59,7 @@ static int make_git_repo(const char *dir) {
5559
if (git_run(dir, "commit -q -m init") != 0) return -1;
5660
return 0;
5761
}
62+
#endif /* _WIN32 */
5863

5964
/* ── canonical_root: normal repo indexed from its root ──────────── */
6065

0 commit comments

Comments
 (0)