fix(git): gate merge.conflictStyle zdiff3 on git >= 2.35#35
Merged
Conversation
zdiff3 was added in git 2.35.0; older git (Ubuntu jammy = 2.34.1) errors 'unknown style zdiff3' on checkout/merge — surfaced on the jetson during mise upgrade (git failed reclone). Render-time gate via git --version: zdiff3 on >=2.35, diff3 (universally supported) below. git --version doesn't read merge config, so this renders even on a currently-broken box.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
dot_gitconfig.tmplsetmerge.conflictStyle = zdiff3unconditionally.zdiff3was added in git 2.35.0 (release notes: "Zealous diff3 style … has been added"). Ubuntu jammy (the jetson) ships git 2.34.1 → git errorsfatal: unknown style 'zdiff3' given for 'merge.conflictstyle'on operations that validate it (checkout/merge).Surfaced live during
mise upgradeon the jetson (its internalgit checkoutfailed; mise self-repaired by recloning).Fix
Render-time version gate:
{{- $gitVersion := output "git" "--version" | regexFind "[0-9]+\.[0-9]+\.[0-9]+" }} {{- if semverCompare ">=2.35.0" $gitVersion }} conflictStyle = zdiff3 {{- else }} conflictStyle = diff3 # universally supported, still 3-way {{- end }}Matches the repo's existing render-time gating (like delta's
lookPath).Verified
semverCompare ">=2.35.0" "2.34.1"→ false →diff3;"2.53.0"→ true →zdiff3(ran it)zdiff3;git config --file <rendered> --get merge.conflictStyleparses ✓git --versiondoesn't read merge config → renders fine even on the currently-broken jammy box → self-heals on nextchezmoi update