# 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
