Skip to content

Preserve excluded files during formatting and Git checkout - #50

Open
t-kalinowski wants to merge 61 commits into
mainfrom
fix/git-filter-exclusions
Open

t-kalinowski wants to merge 61 commits into
mainfrom
fix/git-filter-exclusions

Conversation

@t-kalinowski

@t-kalinowski t-kalinowski commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

Git can check out a Markdown file before its yamark.toml, or leave different versions of the config in the working tree and the index during a merge. Yamark could then rewrap an excluded file or reject its encoding. This change makes the experimental Git filter use the exclusions that belong to the content Git is checking out.

Exclusions

Patterns use Git wildmatch, including literal braces, escaped characters and POSIX character classes. They match names relative to the config's directory, including when the config is a symlink. An excluded stdin path passes its bytes through even if its extension or encoding would otherwise be unsupported. Rust callers can again construct FormatConfig with ..Default::default().

Git filter

Smudge reads the nearest tracked config from the incoming tree. A nearer untracked config can supply personal settings for both git add and git restore. When Git omits the tree, Yamark uses the staged config if the blob matches the staged file and the config is resolved. During a merge or cherry-pick, Git can delay writing a different blob until it has checked out the config. Yamark then column-wraps included Markdown and preserves excluded bytes. If Git cannot identify the source or delay checkout, Yamark passes the bytes through. Clean reads settings from the working tree up to the repository root. Built-in conversions skip external embedded formatters, and setup leaves merge.renormalize under repository control.

The process driver negotiates clean and smudge independently, runs the default commands in process, and delegates custom drivers. It reuses checkout settings and refreshes them when the index changes.

adopt and join batch conversions of regular staged files and preserve their working-tree permissions. Unix scratch directories are private. If the index changes during the final refresh, Yamark preserves the staged changes. git-filter check verifies committed files using the attributes and exclusions in HEAD, including when the files are missing locally.

This branch has not been deployed

No deployments
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.

1 participant