Skip to content

[Internal] Changelog: Adds .gitattributes union merge driver for changelog files#5889

Open
NaluTripician wants to merge 2 commits into
mainfrom
nalutripician/users-ntripician-changelog-union-merge
Open

[Internal] Changelog: Adds .gitattributes union merge driver for changelog files#5889
NaluTripician wants to merge 2 commits into
mainfrom
nalutripician/users-ntripician-changelog-union-merge

Conversation

@NaluTripician
Copy link
Copy Markdown
Contributor

Problem

PR #5864 moved the SDK to a per-PR ### Unreleased model where every shipped-source PR appends a bullet to the same anchor, and each release PR (e.g. #5876) sweeps those bullets into a versioned section. Both shapes produce textbook merge conflicts on ### Unreleased for every in-flight PR. Concrete recent hits: #5829 and #5868.

Fix

Register the git union merge driver for the two changelog files shipped in this repo:

  • changelog.md (main SDK)
  • Microsoft.Azure.Cosmos/FaultInjection/changelog.md

On conflict, git takes lines from both sides — exactly the "take both bullets" rule already documented in CONTRIBUTING.md under Changelog entry → Merge conflicts. The manual rule remains valid as a reviewer-eyeball backstop; the union driver just automates the common case.

Scope

Exactly one file added (.gitattributes). Zero production / test / CI changes. Encryption changelogs are intentionally not included, deferred per #5864.

Caveat

If two PRs edit the same line — rare for append-only bullet lists, but possible during release sweeps that rewrite history blocks — union silently keeps both sides' versions of that line. Reviewers should continue to eyeball changelog diffs on conflict-prone PRs.

Validation

1. git check-attr confirms the driver applies to both targets:

$ git check-attr merge -- changelog.md
changelog.md: merge: union

$ git check-attr merge -- Microsoft.Azure.Cosmos/FaultInjection/changelog.md
Microsoft.Azure.Cosmos/FaultInjection/changelog.md: merge: union

2. End-to-end smoke test in a scratch worktree — two throwaway branches each appended a different bullet to ### Unreleased, then merged. With the driver in place the merge auto-resolved cleanly:

--- attempting merge smoke-a -> smoke-b ---
Auto-merging changelog.md
Merge made by the 'ort' strategy.
 changelog.md | 1 +
 1 file changed, 1 insertion(+)
Merge exit code: 0

--- post-merge Unreleased region ---
  ### <a name="unreleased"/> Unreleased

  - SMOKE B bullet (test only)
  - SMOKE A bullet (test only)
  #### Features Added
  ...

Contains SMOKE A : True
Contains SMOKE B : True
Conflict markers : False
SMOKE TEST PASSED

The scratch worktree and its branches were discarded after the test; the PR contains only .gitattributes.

3. Build sanity check:

$ dotnet build Microsoft.Azure.Cosmos\src\Microsoft.Azure.Cosmos.csproj -c Release --nologo
Build succeeded.
    0 Warning(s)
    0 Error(s)

Changelog entry

  • No changelog entry required. Repo-config-only change (.gitattributes). Does not modify any file under Microsoft.Azure.Cosmos/src/** or FaultInjection/src/**. Step 1 of the classifier in .github/copilot-instructions.md short-circuits to "no entry required."

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

…gelog files

PR #5864 moved the SDK to a per-PR `### Unreleased` model where every
shipped-source PR appends a bullet to the same anchor, and each release PR
(e.g. #5876) sweeps those bullets into a versioned section. Both shapes produce
textbook merge conflicts on `### Unreleased` for every in-flight PR (recent
hits: #5829, #5868).

This change registers the git `union` merge driver for the two changelog files
shipped in this repo. On conflict, git takes lines from both sides - exactly
the "take both bullets" rule already documented in CONTRIBUTING.md
(## Changelog entry > Merge conflicts).

Scope: only `.gitattributes` is added. No production / test / CI changes.
Encryption changelogs are intentionally deferred per #5864.

Caveat: if two PRs edit the SAME line (rare for append-only bullet lists),
union loses information silently. Reviewers should continue to eyeball
changelog diffs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
aavasthy
aavasthy previously approved these changes May 19, 2026
@NaluTripician NaluTripician enabled auto-merge (squash) May 19, 2026 21:22
Comment thread .gitattributes Outdated
kushagraThapar
kushagraThapar previously approved these changes May 19, 2026
Copy link
Copy Markdown
Member

@kushagraThapar kushagraThapar left a comment

Choose a reason for hiding this comment

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

Thank you for tackling this — the ### Unreleased merge-conflict pain is real and the union driver is exactly the right hammer. The PR is small, well-scoped, has great inline rationale in .gitattributes, and the end-to-end smoke test in the description is excellent evidence.

Approving with one small nit you may want to address either in this PR or as a follow-up — see the inline comment. It's about the pattern being unanchored and therefore accidentally matching the Encryption changelogs that #5864 explicitly deferred. Behavior impact is benign (those changelogs are append-only too, so union would also Do The Right Thing there), but the scope mismatch with the PR body is worth tightening.

Nice work overall — and the CONTRIBUTING.md cross-reference + caveat about same-line edits is the kind of thoughtful framing that makes this easy to review. 🚢

Comment thread .gitattributes Outdated
…epo root

Per review feedback from @kushagraThapar (and the matching question from
@kundadebdatta): without a leading slash, git attribute patterns match
gitignore-style at any depth, so the original lines also applied to
Microsoft.Azure.Cosmos.Encryption/changelog.md and
Microsoft.Azure.Cosmos.Encryption.Custom/changelog.md - both of which
#5864 explicitly deferred from this change.

Anchoring both patterns with a leading '/' restores the stated PR scope:

  changelog.md:                                            merge: union
  Microsoft.Azure.Cosmos/FaultInjection/changelog.md:      merge: union
  Microsoft.Azure.Cosmos.Encryption/changelog.md:          merge: unspecified
  Microsoft.Azure.Cosmos.Encryption.Custom/changelog.md:   merge: unspecified

Also expands the header comment to record the anchoring rationale so a
future contributor doesn't drop the leading slashes by accident.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@NaluTripician NaluTripician dismissed stale reviews from kushagraThapar and aavasthy via fb1ea07 May 19, 2026 22:23
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.

5 participants