feat(git): require git 2.38, run git in the C locale, and pin the porcelain format #529
No reviewers
Labels
No labels
breaking
bug
documentation
enhancement
epic
good first issue
help wanted
refactoring
resolution/duplicate
resolution/invalid
resolution/wontfix
security
severity/critical
severity/high
severity/low
severity/medium
status/abandoned
status/blocked
status/needs-decision
status/needs-info
status/needs-verification
testing
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
sixfold-space/madtea!529
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "issue-524-git-pin-the-git-output-contract-and-declare-a-mini"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
madtea runs the
gitbinary, but it declared no minimum version and no output contract. This adds both, and records them in ADR 0038.What changes
internal/gitexecbuilds every git child process. It putsLC_ALL=Clast in the environment, so git prints untranslated messages. madtea searches git stderr for English text such asCONFLICT, and a translated message hid the conflict before this change.EnsureMinVersionchecks the git version once per process. Below 2.38.0 a command fails with a message that names the found version and the required version. It is wired into the plain runners, the unauthenticated clone, and both transports (HTTPS and SSH).exec.Command("git", ...)call now goes through the new package:internal/git,config,service/workflow,service/git,orchestrate,adr,analytics, andcmd/setup/web.go.git statususes--porcelain=v1, the form git documents as stable.git worktree listkeeps the bare--porcelain, because git offers no versioned form there and documents that format as stable.pr conflictsnow reports amerge-treefailure instead of an empty conflict list. That command needs git 2.38.--porcelain.LC_ALL=C.Why 2.38
madtea uses
git merge-tree --write-tree(git 2.38) andgit rev-parse --end-of-options(git 2.30). One floor for every command keeps one check and one CI range. Debian 12 and later, Ubuntu 24.04 and later, and RHEL 8.10 and later all meet it. Ubuntu 20.04, Ubuntu 22.04, and Debian 11 do not.Follow-ups
Run*variants with one call that takes options.Closes #524
Pre-merge review notes.
I read the whole diff against ADR 0038 and ran the full gate. It passes: build, gofmt, vet, tests with the race detector, staticcheck, govulncheck, gosec, modernize, docs verify, cross-compile, and the ADR check.
What I checked:
gitexec.NewCmdorNewCmdDir. A sweep finds no other exec of "git" in non-test code. The sites that add environment (askpass, terminal prompt, ssh batch mode) append to the constructor environment, soLC_ALL=Csurvives. The SSH transport keeps its no-credential intent.--porcelain, except forgit worktree list. The man page confirms thatworktree list --porcelaintakes no value and is stable, whilestatustakes--porcelain=v1.LC_ALL=C.Changes I made after the build:
setupSSHCmdnow calls the version check, so the SSH transport fails the same way as the HTTPS transport on an old git.--porcelain". It now states thegit worktree listexception, which matches the guard and the code.internal/gitexec, and the build-from-source prerequisites state the git version.Still open, tracked elsewhere: the git version matrix in CI (issue 525), and the 17
Run*variants (issue 527).