ifcurl/forgejo/server-config/gitconfig-ifcmerge
Bruno Postle 27883e468e forgejo: document ifcmerge mergeability — bare repo gitattributes finding
Investigation confirmed: Forgejo's git merge-tree --write-tree (git ≥2.38)
does invoke configured merge drivers for .ifc files.

Key finding: bare repositories do NOT read committed .gitattributes — the
merge driver is silently skipped without a system-wide core.attributesFile.

Changes:
- server-config/gitattributes: new file to deploy at /etc/gitattributes,
  containing "*.ifc merge=ifcmerge"
- server-config/gitconfig-ifcmerge: adds [core] attributesFile = /etc/gitattributes
  and explains the bare-repo constraint
- forgejo/README.md: rewrites ifcmerge section with investigation findings,
  deployment steps, and distinction between server-side vs client-side setup

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 09:27:56 +01:00

33 lines
1.2 KiB
Text

# Add to /etc/gitconfig on the Forgejo server.
#
# IMPORTANT: also set core.attributesFile so that bare repositories pick up
# the merge driver. Committed per-repo .gitattributes files are NOT read by
# git merge-tree --write-tree in bare-repo context.
#
# [core]
# attributesFile = /etc/gitattributes
#
# and put "*.ifc merge=ifcmerge" in /etc/gitattributes (see gitattributes
# in this directory).
#
# How the merge drivers work
# --------------------------
# ifcmerge rewrites STEP IDs from %B to match %A's ID space, so %A's IDs
# are preserved in the merged result. Use the "Merge commit" strategy in
# Forgejo so that %A is always the base branch (e.g. main).
#
# Two variants are registered for symmetry:
# ifcmerge — base branch is %A (standard merge-commit direction)
# ifcmerge_ours — base branch is %B (rebase direction); swaps %A/%B so
# base-branch IDs are still preserved
[core]
attributesFile = /etc/gitattributes
[merge "ifcmerge"]
name = IFC merge driver (base is ours)
driver = ifcmerge %O %A %B %L
[merge "ifcmerge_ours"]
name = IFC merge driver (base is theirs)
driver = ifcmerge %O %B %A %L