Skip to main content

Module gitignore

Module gitignore 

Source
Expand description

Adding drep.toml to the repository’s .gitignore.

Whether the config belongs in version control is a judgement, not a fact. It names an endpoint, a model and a protocol - shareable, and worth sharing when a team wants one gate reviewing with one model - but it is also a personal choice of provider that a collaborator may not have a plan for. Since 2.1 the key is not in the file at all (it lives in the user-level auth store), so this is a preference rather than a safety requirement, and drep init asks rather than deciding.

§Why this is not one writeln!

Two states make a naive append useless, and both are silent:

  • Already ignored. By this exact path, by a glob, or by a parent directory’s rule. Appending again is a duplicate line that never changes behaviour.
  • Already tracked. .gitignore has no effect on a file git already tracks. Appending there looks like it worked, git status keeps showing the file, and nothing explains why. The fix is git rm --cached, so that is what gets reported.

Both are answered by asking git rather than by parsing .gitignore, which is the only way to get glob and parent-directory rules right.

Enums§

Outcome
What ensure did, so the caller can report it precisely.

Functions§

ensure
Ensure root’s .gitignore ignores drep.toml, and report what happened.
ensure_to
Ensure, then report to out. The shape init’s other steps use.