Skip to content

fix(git): gate merge.conflictStyle zdiff3 on git >= 2.35#35

Merged
vaintrub merged 1 commit into
masterfrom
fix/gitconfig-zdiff3-version-gate
May 31, 2026
Merged

fix(git): gate merge.conflictStyle zdiff3 on git >= 2.35#35
vaintrub merged 1 commit into
masterfrom
fix/gitconfig-zdiff3-version-gate

Conversation

@vaintrub

Copy link
Copy Markdown
Owner

Bug

dot_gitconfig.tmpl set merge.conflictStyle = zdiff3 unconditionally. zdiff3 was added in git 2.35.0 (release notes: "Zealous diff3 style … has been added"). Ubuntu jammy (the jetson) ships git 2.34.1 → git errors fatal: unknown style 'zdiff3' given for 'merge.conflictstyle' on operations that validate it (checkout/merge).

Surfaced live during mise upgrade on the jetson (its internal git checkout failed; 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

  • zdiff3 → git 2.35.0 (release notes, authoritative)
  • semverCompare ">=2.35.0" "2.34.1" → false → diff3; "2.53.0" → true → zdiff3 (ran it)
  • Mac (2.53) renders zdiff3; git config --file <rendered> --get merge.conflictStyle parses ✓
  • git --version doesn't read merge config → renders fine even on the currently-broken jammy box → self-heals on next chezmoi update

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.
@vaintrub vaintrub merged commit 14bf3a7 into master May 31, 2026
3 checks passed
@vaintrub vaintrub deleted the fix/gitconfig-zdiff3-version-gate branch May 31, 2026 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant