Re-running `zig build` after fixing exercise results in confusing questions about patches
matgis opened this issue ยท 3 comments
(I am new to both Zig and Ziglings, so please bear with me if I'm doing it wrong and the following is expected behavior. ๐)
Seen on macOS Monterey 12.6.3 with Zig 0.11.0-dev.2613+b42562be7.
Steps to reproduce
- Run
zig build
in a fresh clone of the repository. - Fix the reported issue in
exercises/001_hello.zig
by insertingpub
beforefn main
. - Re-run
zig build
to verify the fix, and hopefully proceed to the next exercise.
Expected outcome
The test passes and we move on to exercises/002_std.zig
.
Actual outcome
Even before the Ziglings banner appears, I am presented with this question:
Reversed (or previously applied) patch detected! Assume -R? [n]
After I chose the default response, a follow-up question appears:
Apply anyway? [n]
Selecting the default response prints a warning about the patch being rejected:
1 out of 1 hunk ignored -- saving rejects to file patches/healed/001_hello.zig.rej
Eventually I am told my fix to exercises/001_hello.zig
is valid and we move on to exercise two. However, my responses don't take, and these questions are repeated for every fixed exercise every time I re-run zig build
:
% zig build
Reversed (or previously applied) patch detected! Assume -R? [n]
Apply anyway? [n]
1 out of 1 hunk ignored -- saving rejects to file patches/healed/001_hello.zig.rej
Reversed (or previously applied) patch detected! Assume -R? [n]
Apply anyway? [n]
1 out of 1 hunk ignored -- saving rejects to file patches/healed/002_std.zig.rej
Additional information
These prompts seem to originate from the patch
shell command, which appears to be called from the heal
function in tests.zig
. The heal
function is itself called from addCliTests
, which is called at the bottom of build
in build.zig
.
Workaround
Running the exercises individually with zig build -Dn=1, 2, 3, ...
does not trigger the issue.
Works great! Thank you! โค๏ธ