From 395dd0423d4698c91dbebba976aab4fee121267c Mon Sep 17 00:00:00 2001 From: Alexey Z Date: Fri, 8 May 2026 11:09:06 +0300 Subject: [PATCH] fix(windows): use cmd.exe-compatible syntax --- src/pipeline/pass_githistory.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/pipeline/pass_githistory.c b/src/pipeline/pass_githistory.c index 36b491f5..85de88ad 100644 --- a/src/pipeline/pass_githistory.c +++ b/src/pipeline/pass_githistory.c @@ -223,10 +223,16 @@ static int parse_git_log(const char *repo_path, commit_t **out, int *out_count) } char cmd[CBM_SZ_1K]; +#ifdef _WIN32 + /* cmd.exe does not recognize single quotes; '/dev/null' is a POSIX path. */ + const char *null_dev = "NUL"; +#else + const char *null_dev = "/dev/null"; +#endif snprintf(cmd, sizeof(cmd), - "cd '%s' && git log --name-only --pretty=format:COMMIT:%%H " - "--since='1 year ago' --max-count=10000 2>/dev/null", - repo_path); + "git -C \"%s\" log --name-only --pretty=format:COMMIT:%%H " + "--since=\"1 year ago\" --max-count=10000 2>%s", + repo_path, null_dev); FILE *fp = cbm_popen(cmd, "r"); if (!fp) {