---
name: a-write-then-commit-script-without-set-e-mints-a-false-bodied-commit
description: A one-shot shell script that edits a file (python replace) and then commits and pushes will commit and push a NO-OP when the edit fails, under a body that claims the edit; 57e38fd8 sat on the remote for a minute claiming a register reconciliation it did not contain. Put set -e before the write, or gate the commit on the diff.
metadata:
  type: feedback
---

2026-09-09 23:4xZ, IR-92 lane. My python replace asserted on the second fragment (my pattern used a curly apostrophe, the file had a straight one), raised, and wrote NOTHING, which is correct behaviour for the script. The Bash call had no set -e, so git add, git commit -F, and git push ran anyway and produced 57e38fd8: one checklist line, under a body saying "both bullets now carry one census stamped 23:04Z". A commit body false of its own content; the banked rule that a commit body claim must be true of the commit it rides, broken by tooling rather than intent. Fixed by applying the edit and amending on my own unlanded lane branch (--force-with-lease, ae8893ab); disclosed to hertz, who had the false sha for a minute.

**Why:** the write and the commit were in one script because they always go together, which is exactly the case where the second must not run if the first did not. A failed assert is a loud failure inside python and a silent success to the shell line that follows.

**How to apply:** set -e at the top of any script that writes then commits; or make the commit line conditional on the file actually having changed (git diff --quiet returning non-zero). Read git show --stat HEAD before pushing: the stat said one file where the message said two. On your own unlanded lane branch an amend is the honest fix for a false body; on a shared or landed branch it is a revert plus a correct commit. See [[a-git-refusal-halts-the-script-and-a-tree-answers-git-status-before-it-dies]].
