Build a command-line tool that applies a unified diff patch to a target file. The tool must accept two…
Build a command-line tool that applies a unified diff patch to a target file. The tool must accept two…: a task in TermGrade Environments: 1,004 executable Linux tasks (Harbor dataset). Exact I/O contract: - If the patch applies cleanly, exit code 0 and the target file is modified. - If the patch…
The task
Exact I/O contract: - If the patch applies cleanly, exit code 0 and the target file is modified. - If the patch does NOT apply cleanly (any hunk fails), exit code 1 and the target file is UNMODIFIED (no partial application). - If the patch file is missing or unreadable, exit code 2 and print "patch error: cannot read…
Part of ai-and/termgrade-environments.