Skip to content

init: add missing ignore lines to an existing .gitignore (closes #6158) - #6423

Merged
TrapsterDK merged 1 commit into
mainfrom
fix-6158-gitignore
Nov 4, 2026
Merged

TrapsterDK merged 1 commit into
mainfrom
fix-6158-gitignore

Conversation

@TrapsterDK

@TrapsterDK TrapsterDK commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Closes #6158. Implements PR D of the plan on #6141.

  • preset.rs: an existing .gitignore gets every IGNORE_LINES entry that no line covers. A line covers an entry when it is equal after dropping leading and trailing /, or when it names an ancestor directory (.dx/ covers /.dx/bazelrc/). A missing .gitignore gets the whole set.
  • The .gitignore write no longer waits for the import block. Before, a workspace that already imported the layers, or had a symlinked .bazelrc, never got the new lines.
  • scaffold.rs: removes the .gitignore entry, so the preset is the only writer.
  • Docs: docs/cli/commands/init.md row for .gitignore.

Line references in the issue were from an older main. Current code is preset.rs ignore_with_missing and ignores, not LAYERS_IGNORE/COVERING_LINES.

Tests

  • tools/dx check --apply //cli/adopt/...: passed.
  • tools/dx test //cli/adopt:dx_adopt_test: 308 passed, 1 failed. The failure is overrides::tests::table_matches_the_repo_module_bazel (gcc_toolchain patch order). This file is not touched by this PR.
  • tools/dx test //cli/cli/tests/adopt:adopt_test: 3 passed, 1 failed. The failure is upgrade_moves_an_older_pin_to_this_dx. It also fails on base f394118d3 (checked with the change stashed).
  • New tests: target_only_gitignore_gains_every_other_line, an_equal_or_ancestor_line_ignores_the_entry, and the rewritten wiring_appends_the_missing_ignore_lines.

Not run: //cli/cli:dx_cli_test (init unit tests in cli/cli). No nested-Bazel or *_consumer_test targets were run; CI runs those.

Remaining

  • IGNORE_LINES still lists language-specific entries (node_modules/, __pycache__/, *.pyc, .gradle/). The owner preference is nothing language-specific in init, so this may need a decision.
  • No Windows, macOS or arm64 parts.

🤖 Generated with Claude Code

Assisted by Claude.

The preset appended only the layers line to an existing .gitignore, so
bazel-*, target/ and the other IGNORE_LINES stayed untracked. The preset
now appends every IGNORE_LINES entry that no line covers (an equal line
after dropping leading and trailing slashes, or a listed ancestor
directory) and writes the full set when the file is missing. The
scaffold no longer writes .gitignore, so the preset is the only writer.

The .gitignore write no longer waits for the import block to be added.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011u9TXHDZrfmzFQ2WT8QAKK
@TrapsterDK
TrapsterDK merged commit 805aab0 into main Nov 4, 2026
1 check failed
@TrapsterDK
TrapsterDK deleted the fix-6158-gitignore branch November 4, 2026 19:50
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.

init: add missing ignore lines to an existing .gitignore

1 participant