9ea569dd7b6b5f189bd5bec3cebc37ab95cb88fb
braney
  Wed Aug 5 10:55:33 2026 -0700
autoBuild.sh: note that something else writes to the build tree now, refs #37925

nightlyRegister.sh runs from the build account's crontab and commits and pushes
hgConfCatalog.py out of $BUILDHOME/kent, so "hgConfCatalog: register ..."
commits appearing on master with nobody behind them are expected rather than a
stray edit somebody left in the tree.

The note sits at ensure_clean_git() rather than in the header because that is
the function whose failure would be puzzling: it aborts the whole build on any
uncommitted change in that tree.  The writer is built not to trip it, acting
only when HEAD is master (cherryPickCommits.csh and tagBeta.csh both check out
release branches in there), restoring the file on any exit that did not commit,
and standing aside entirely while the lockfile is held.  The note says what to
do in the one case where it does trip: the script died between writing and
committing, git checkout is the whole fix, and the next run redoes the work.

Also written up on the CGI_Build_Process wiki page, under "The build tree has a
second writer".

diff --git src/utils/qa/weeklybld/autoBuild.sh src/utils/qa/weeklybld/autoBuild.sh
index 058b723e3e9..5d97f0ea32b 100755
--- src/utils/qa/weeklybld/autoBuild.sh
+++ src/utils/qa/weeklybld/autoBuild.sh
@@ -188,30 +188,45 @@
     the GitHub release ($WEEKLYBLD/doZip.csh, refs #37741)."
     fi
 }
 
 # Check that we are on the master branch (in the WEEKLYBLD git repo).
 ensure_master_branch() {
     local branch
     branch=$(cd "$WEEKLYBLD" && git branch --show-current)
     if [[ "$branch" != "master" ]]; then
         die "WEEKLYBLD git repo is on branch '$branch', expected 'master'"
     fi
     log "OK: on master branch"
 }
 
 # Pull latest and check for uncommitted changes.
+#
+# NOT THE ONLY WRITER IN THIS TREE any more, which matters when this function is
+# what fails.  nightlyRegister.sh (hg/utils/hgConfCatalog, refs #37925) runs from
+# the build account's crontab, writes rows for hg.conf settings the tree reads
+# that the registry is missing, and commits and pushes that one file from
+# $BUILDHOME/kent.  So `hgConfCatalog: register ...` commits on master with
+# nobody behind them are expected, not a stray edit somebody left here.
+#
+# It is written to stay out of the way and should never be what trips the check
+# below: it acts only when HEAD is master (cherryPickCommits.csh and tagBeta.csh
+# both check out release branches in this tree), it restores the file on any exit
+# that did not commit, and it stands aside entirely while $LOCKFILE is held.  If
+# this function ever does report hgConfCatalog.py as dirty, that script died
+# between writing and committing; `git checkout -- <file>` is the whole fix, and
+# the next run redoes the work from scratch.
 ensure_clean_git() {
     cd "$WEEKLYBLD"
     local status_out
     status_out=$(git status --porcelain | grep -v '^??' || true)
     if [[ -n "$status_out" ]]; then
         die "Uncommitted changes in $WEEKLYBLD:\n$status_out"
     fi
     log "OK: git working tree clean"
     run git pull
     log "OK: git pulled"
 }
 
 # Acquire lockfile (prevent concurrent builds).
 acquire_lock() {
     if [[ -f "$LOCKFILE" ]]; then