Artifact 2ce6e958e0d633f1d465f744b1d87c655ffe924ca1e0386e0e25f0d30477d37e:
- File
src/exclude.h
— part of check-in
[45a7e1e117]
at
2026-11-13 07:44:25
on branch trunk
— Phase 4b-2: your own assets placed inside each project that matches
An outfit worn at personal scope for a project's key is now linked into every project with that key, and into each of its linked worktrees: skills, agents, commands, instructions and files, under the folders the harness names for a project. The machine limit and joined instructions work there as they do at the User scope.
The links are hidden from version control per project, never globally. For a git project suit keeps one marked block in that project's local exclude file, leaves every other byte of the file as it was, and removes only the block on suit off. A Fossil or zit project has no such file, so its links are placed and suit status says they are visible.
Suit never runs git and never stages or commits anything. A file already in the project at a destination is a clash, left as it is and reported, so a committed file always wins.
1006 unit checks, 227 shell cases, 146 store cases, 612 placement cases and 310 project cases, under clang and under gcc 16. 100% coverage in all 19 source files. The no-change run costs about 0.43 ms over an empty program. (user: dmestas, size: 1831) [annotate] [blame] [check-ins using]
#ifndef SUIT_EXCLUDE_H #define SUIT_EXCLUDE_H #include <stddef.h> #include <stdint.h> // The block suit keeps in a git repository's local exclude file, so the links it // places in a project stay out of that project's version control (docs/projects.md): // // # suit begin // /.claude/skills/tdd // # suit end // // Everything outside the block is left as it is. A file with no trailing newline // gets one before the block and the block's last line has none, so taking the // block out gives back the very bytes that were there. constexpr size_t EXCLUDE_FILE_MAX = 1048576; constexpr size_t EXCLUDE_PATH_MAX = 4096; // including the terminating NUL constexpr size_t EXCLUDE_LINE_MAX = 16384; // twice the longest path below a project, and more // The exclude file of the repository the git project at PROJECT belongs to: its // own .git folder's, or for a linked worktree the main repository's, found // through "gitdir:" and "commondir". Returns 0 or 1 after saying why. [[nodiscard]] int exclude_path(const char *project, char *out, size_t cap); // The line that hides REL, a path from a project's top with no leading "/": // "/REL" with a backslash before each of \ * ? [ that would otherwise be a pattern. // False if it does not fit. [[nodiscard]] bool exclude_line(const char *rel, char *out, size_t cap); // Make the block in PATH hold exactly the N LINES; with N 0, take the block out. // CREATED says suit made the file: taking the block out of it then removes the // file if nothing else is in it. With DRY nothing is written. CHANGED is set to // whether the file's bytes differ, EXISTS to whether the file was there. // Returns 0 or 1 after saying why. [[nodiscard]] int exclude_edit(const char *path, const char *const *lines, uint32_t n, bool created, bool dry, bool *changed, bool *exists); #endif