Skip to content

Use the "union" merge driver for changelogs#5283

Merged
lehins merged 2 commits intomasterfrom
nm/changelog-merge-driver
Sep 15, 2025
Merged

Use the "union" merge driver for changelogs#5283
lehins merged 2 commits intomasterfrom
nm/changelog-merge-driver

Conversation

@neilmayhew
Copy link
Contributor

@neilmayhew neilmayhew commented Sep 9, 2025

Description

Avoid merge conflicts in changelog files by setting a custom merge driver for them in .gitattributes.

The union driver is built into git so there's no need to add any settings to .git/config.

Unfortunately, the changes from the merged or rebased branch are inserted below the changes from the main branch, but that seems like an acceptable price to pay for a simple configuration that doesn't involve any per-developer setup.

Checklist

  • Commits in meaningful sequence and with useful messages.
  • Tests added or updated when needed.
  • CHANGELOG.md files updated for packages with externally visible changes.
    NOTE: New section is never added with the code changes. (See RELEASING.md).
  • Versions updated in .cabal and CHANGELOG.md files when necessary, according to the
    versioning process.
  • Version bounds in .cabal files updated when necessary.
    NOTE: If bounds change in a cabal file, that package itself must have a version increase. (See RELEASING.md).
  • Code formatted (use scripts/fourmolize.sh).
  • Cabal files formatted (use scripts/cabal-format.sh).
  • CDDL files are up to date (use scripts/gen-cddl.sh)
  • hie.yaml updated (use scripts/gen-hie.sh).
  • Self-reviewed the diff.

@neilmayhew neilmayhew requested a review from a team as a code owner September 9, 2025 21:47
@neilmayhew neilmayhew force-pushed the nm/changelog-merge-driver branch from f5aa91f to 2823e79 Compare September 10, 2025 21:06
Copy link
Contributor

@teodanciu teodanciu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this will result in fewer merge conflicts, nice!
Are there other implications? If we do get merge conflicts, is there anything that we should be aware of, that we need to do different compared to what we've been doing so far?

@neilmayhew
Copy link
Contributor Author

Are there other implications?

It's possible the merged result could have the lines in a strange order, although my experiments so far haven't shown any problems other than the one I mentioned in the description.

If we do get merge conflicts, is there anything that we should be aware of, that we need to do different compared to what we've been doing so far?

I don't think conflicts happen at all with this driver, but we should check the merge result carefully, at least until we have more experience with using this.

@neilmayhew neilmayhew force-pushed the nm/changelog-merge-driver branch from 2823e79 to 1584f17 Compare September 12, 2025 17:43
Copy link
Collaborator

@lehins lehins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should watch out carefully in the near future whether we can spot any issues with this strategy.
If it does work out fine, then it will be indeed a very nice improvement in our workflow, since chnagelogs is the most common source of git conflicts

@lehins lehins force-pushed the nm/changelog-merge-driver branch from 1584f17 to 4ae84de Compare September 15, 2025 15:14
@lehins lehins enabled auto-merge September 15, 2025 15:15
@lehins lehins merged commit 9a4c747 into master Sep 15, 2025
115 checks passed
@lehins lehins deleted the nm/changelog-merge-driver branch September 15, 2025 17:15
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.

3 participants