Skip to content

Commit d4af5d5

Browse files
author
merge-queue-bot
committed
Merge PR #753: chore(ci): bump pinned baseline to v0.53.0 and adopt scoped .gitattributes
2 parents bfd0deb + ee61045 commit d4af5d5

5 files changed

Lines changed: 24 additions & 78 deletions

File tree

.gitattributes

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,23 @@
44
# BEGIN mdsmith merge-driver
55
*.md merge=mdsmith
66
*.markdown merge=mdsmith
7-
.git/** -merge
8-
demo/** -merge
9-
internal/rules/*/bad/** -merge
7+
.git/**/*.md -merge
8+
.git/**/*.markdown -merge
9+
demo/**/*.md -merge
10+
demo/**/*.markdown -merge
11+
internal/rules/*/bad/**/*.md -merge
12+
internal/rules/*/bad/**/*.markdown -merge
1013
internal/rules/*/bad.md -merge
11-
internal/rules/*/good/** -merge
12-
internal/rules/*/fixed/** -merge
13-
internal/rules/*/pattern/** -merge
14-
.claude/worktrees/** -merge
15-
editors/**/node_modules/** -merge
16-
editors/**/dist/** -merge
14+
internal/rules/*/good/**/*.md -merge
15+
internal/rules/*/good/**/*.markdown -merge
16+
internal/rules/*/fixed/**/*.md -merge
17+
internal/rules/*/fixed/**/*.markdown -merge
18+
internal/rules/*/pattern/**/*.md -merge
19+
internal/rules/*/pattern/**/*.markdown -merge
20+
.claude/worktrees/**/*.md -merge
21+
.claude/worktrees/**/*.markdown -merge
22+
editors/**/node_modules/**/*.md -merge
23+
editors/**/node_modules/**/*.markdown -merge
24+
editors/**/dist/**/*.md -merge
25+
editors/**/dist/**/*.markdown -merge
1726
# END mdsmith merge-driver

.github/actions/setup-mdsmith-pinned-version/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ runs:
1212
# Bump here only when intentionally updating that baseline.
1313
# After bumping, scan PLAN.md for plans waiting to adopt the
1414
# newly-released syntax. See docs/development/adopt-new-directive-syntax.md.
15-
MDSMITH_VERSION: v0.41.0
16-
MDSMITH_SHA256: 4df9683fe598db9ea7e55789fd8b78db6390760fb88d0f46beb9bfc25e775dde
15+
MDSMITH_VERSION: v0.53.0
16+
MDSMITH_SHA256: bfee797520d02d7b0132d09bd273ced9334a8d858872a8f65a348c028fbb0a0e
1717
# The binary is downloaded over HTTPS and SHA256-verified above
1818
# before $HOME/.local/bin is appended to PATH, so the github-env
1919
# write is safe to ignore.

internal/githooks/githooks.go

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -216,36 +216,6 @@ func GlobsFromConfig(cfg *config.Config) (Globs, []string) {
216216
return g, skipped
217217
}
218218

219-
// LegacyGlobs renders cfg.Ignore the pre-#750 way: the default include
220-
// set plus each representable ignore pattern copied verbatim, without
221-
// markdown scoping (`demo/** -merge`). This is the managed block that a
222-
// mdsmith release from before the markdown-scoping change produces and
223-
// expects — including the pinned CI baseline that validates
224-
// .gitattributes in the merge queue via `merge-driver ci-install`.
225-
//
226-
// It exists only for the transition window (see
227-
// docs/development/adopt-new-directive-syntax.md): a change to the
228-
// managed-block format cannot reach main through the merge queue while
229-
// the queue is gated by a pinned binary that predates the format. So
230-
// the repository keeps its committed .gitattributes in this legacy form
231-
// — validated by TestRepoGitattributesInSyncWithConfig against this
232-
// render — while GlobsFromConfig renders the markdown-scoped form that
233-
// `install` now writes for users and that the repository itself adopts
234-
// once the feature ships in a release and the pin is bumped.
235-
func LegacyGlobs(cfg *config.Config) Globs {
236-
g := Globs{Include: DefaultIncludes()}
237-
if cfg == nil || len(cfg.Ignore) == 0 {
238-
return g
239-
}
240-
g.Exclude = make([]string, 0, len(cfg.Ignore))
241-
for _, p := range cfg.Ignore {
242-
if isRepresentableGitattributesPattern(p) {
243-
g.Exclude = append(g.Exclude, p)
244-
}
245-
}
246-
return g
247-
}
248-
249219
// scopeExcludeToMarkdown rewrites one .mdsmith.yml ignore pattern into
250220
// the .gitattributes exclude patterns that turn off the mdsmith merge
251221
// driver for the Markdown files the pattern grandfathers — and only

internal/githooks/githooks_test.go

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,26 +1045,6 @@ func TestGlobsFromConfig_TranslatesIgnore(t *testing.T) {
10451045
assert.Empty(t, skipped, "representable patterns must not be reported as skipped")
10461046
}
10471047

1048-
func TestLegacyGlobs(t *testing.T) {
1049-
// The pre-#750 render: representable ignore patterns copied verbatim
1050-
// and unscoped, with negation/whitespace patterns dropped — exactly
1051-
// what the pinned merge-queue baseline produces and expects.
1052-
cfg := &config.Config{Ignore: []string{"demo/**", "vendor/*.md", "!neg.md", "with space"}}
1053-
got := LegacyGlobs(cfg)
1054-
assert.Equal(t, DefaultIncludes(), got.Include)
1055-
assert.Equal(t, []string{"demo/**", "vendor/*.md"}, got.Exclude)
1056-
}
1057-
1058-
func TestLegacyGlobs_NilAndEmpty(t *testing.T) {
1059-
got := LegacyGlobs(nil)
1060-
assert.Equal(t, DefaultIncludes(), got.Include)
1061-
assert.Empty(t, got.Exclude)
1062-
1063-
got = LegacyGlobs(&config.Config{})
1064-
assert.Equal(t, DefaultIncludes(), got.Include)
1065-
assert.Empty(t, got.Exclude)
1066-
}
1067-
10681048
func TestGlobsFromConfig_KeepsMarkdownScopedIgnoreVerbatim(t *testing.T) {
10691049
// An ignore pattern that already targets a specific Markdown
10701050
// extension can only affect Markdown, so its -merge line is safe

internal/integration/gitattributes_sync_test.go

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,7 @@ func TestRepoGitattributesInSyncWithConfig(t *testing.T) {
6060
// misleading "run merge-driver install" message).
6161
cfg, err := config.Load(filepath.Join(root, ".mdsmith.yml"))
6262
require.NoError(t, err, "repository .mdsmith.yml must load and parse")
63-
64-
// During the transition to markdown-scoped merge-driver excludes
65-
// (#750), the committed .gitattributes deliberately stays in the
66-
// legacy bare form (`demo/** -merge`). The merge queue validates it
67-
// with `mdsmith merge-driver ci-install` run by the *pinned* release
68-
// baseline (see .github/actions/setup-mdsmith-pinned-version), which
69-
// predates markdown scoping and expects that legacy render — so the
70-
// committed file must match LegacyGlobs, not the branch's
71-
// markdown-scoped GlobsFromConfig. Once the scoped format ships in a
72-
// release and the pin is bumped, regenerate .gitattributes with
73-
// `mdsmith merge-driver install` and switch this assertion to
74-
// GlobsFromConfig. See docs/development/adopt-new-directive-syntax.md.
75-
expected := githooks.LegacyGlobs(cfg)
63+
expected, _ := githooks.GlobsFromConfig(cfg)
7664

7765
data, err := os.ReadFile(filepath.Join(root, ".gitattributes"))
7866
require.NoError(t, err, "repository .gitattributes must exist")
@@ -82,9 +70,8 @@ func TestRepoGitattributesInSyncWithConfig(t *testing.T) {
8270
"committed .gitattributes has no mdsmith merge-driver managed block")
8371

8472
assert.True(t, githooks.GlobsEqual(installed, expected),
85-
"committed .gitattributes is out of sync with .mdsmith.yml's legacy "+
86-
"(pinned-baseline) render — keep it in the bare form the pinned "+
87-
"merge-queue binary expects until the pin is bumped.\n"+
88-
" committed: include=%v exclude=%v\n expected: include=%v exclude=%v",
73+
"committed .gitattributes is out of sync with .mdsmith.yml — run "+
74+
"`mdsmith merge-driver install` (or `mdsmith fix`) and commit the "+
75+
"result.\n committed: include=%v exclude=%v\n expected: include=%v exclude=%v",
8976
installed.Include, installed.Exclude, expected.Include, expected.Exclude)
9077
}

0 commit comments

Comments
 (0)