thunderbird-patch-review

Simple email patch review tool for Thunderbird

git clone git://mccd.space/thunderbird-patch-review
commit 368ca46edace56b940e794557559ef40fe012fc1
parent 2b3c49d14386c575ef5cb6027b897f5f51920d76
Author: Pi Agent <agent@pi.local>
Date:   Sun, 19 Jul 2026 11:06:35 +0200

patchHost: silence git hints during apply and check

git am prints a wall of hint: lines on conflict (Use 'git am --continue',
'skip', '--abort', 'Disable this message with git config set advice...')
that crowd the actual error. advice.enabled is not a real git knob —
git accepts any -c key without validation — and the per-advice names
that actually suppress am's hints are advice.mergeConflict and
advice.amWorkDir. Set both false via -c on every git invocation in
apply() and check(): apply, apply --check (forward and reverse), am
--abort, worktree add, and worktree remove --force.

Diffstat:
Mextension/api/patchHost/implementation.js | 16++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/extension/api/patchHost/implementation.js b/extension/api/patchHost/implementation.js
@@ -102,7 +102,7 @@ async function apply(repo, strategy, patches) {
   );
   await IOUtils.makeDirectory(work, { permissions: 0o700 });
   try {
-    const args = ["-C", repo, "am"];
+    const args = ["-C", repo, "-c", "advice.mergeConflict=false", "-c", "advice.amWorkDir=false", "am"];
     if (strategy !== "am") {
       args.push("--3way");
     }
@@ -115,7 +115,7 @@ async function apply(repo, strategy, patches) {
     if (am.exitCode === 0) {
       return { ok: true, output: am.output };
     }
-    const abort = await run(git, ["-C", repo, "am", "--abort"]);
+    const abort = await run(git, ["-C", repo, "-c", "advice.mergeConflict=false", "-c", "advice.amWorkDir=false", "am", "--abort"]);
     return {
       ok: false,
       output:
@@ -169,11 +169,11 @@ async function check(repo, strategy, patches) {
   await IOUtils.writeUTF8(probe, patches.join("\n"));
   let fwd;
   try {
-    fwd = await run(git, ["-C", repo, "apply", "--check", probe]);
+    fwd = await run(git, ["-C", repo, "-c", "advice.mergeConflict=false", "-c", "advice.amWorkDir=false", "apply", "--check", probe]);
     if (fwd.exitCode === 0) {
       return { ok: true, status: "applicable", output: fwd.output };
     }
-    const rev = await run(git, ["-C", repo, "apply", "--check", "--reverse", probe]);
+    const rev = await run(git, ["-C", repo, "-c", "advice.mergeConflict=false", "-c", "advice.amWorkDir=false", "apply", "--check", "--reverse", probe]);
     if (rev.exitCode === 0) {
       return { ok: true, status: "applied", output: fwd.output };
     }
@@ -192,7 +192,7 @@ async function check(repo, strategy, patches) {
     PathUtils.tempDir,
     `patch-review.am.${Date.now()}.${Math.floor(Math.random() * 1e9)}`
   );
-  const make = await run(git, ["-C", repo, "worktree", "add", "--detach", work]);
+  const make = await run(git, ["-C", repo, "-c", "advice.mergeConflict=false", "-c", "advice.amWorkDir=false", "worktree", "add", "--detach", work]);
   if (make.exitCode !== 0) {
     // Rare (bare repo, no worktree support, …). Don't trust --check's
     // partial answer here — report "conflict" so the user clicks Apply
@@ -202,7 +202,7 @@ async function check(repo, strategy, patches) {
   try {
     const file = PathUtils.join(work, "series.mbox");
     await IOUtils.writeUTF8(file, patches.join("\n"));
-    const args = ["-C", work, "am"];
+    const args = ["-C", work, "-c", "advice.mergeConflict=false", "-c", "advice.amWorkDir=false", "am"];
     if (strategy !== "am") {
       args.push("--3way");
     }
@@ -217,11 +217,11 @@ async function check(repo, strategy, patches) {
     // am stopped mid-series (context mismatch, merge conflict, dirty
     // tree). Roll the worktree back so its state isn't left dangling, then
     // report conflict with am's diagnostic — it names the file and hunk.
-    await run(git, ["-C", work, "am", "--abort"]);
+    await run(git, ["-C", work, "-c", "advice.mergeConflict=false", "-c", "advice.amWorkDir=false", "am", "--abort"]);
     return { ok: true, status: "conflict", output: am.output };
   } finally {
     // --force drops the worktree even if am left its working tree dirty.
-    await run(git, ["-C", repo, "worktree", "remove", "--force", work]);
+    await run(git, ["-C", repo, "-c", "advice.mergeConflict=false", "-c", "advice.amWorkDir=false", "worktree", "remove", "--force", work]);
     IOUtils.remove(work, { recursive: true }).catch(() => {});
   }
 }