Skip to content

add: ignore DVC metadata matched by globs - #11087

Open
tandede wants to merge 2 commits into
treeverse:mainfrom
tandede:fix-repeat-add-glob-metadata
Open

add: ignore DVC metadata matched by globs#11087
tandede wants to merge 2 commits into
treeverse:mainfrom
tandede:fix-repeat-add-glob-metadata

Conversation

@tandede

@tandede tandede commented Aug 19, 2026

Copy link
Copy Markdown

Description

Repeated dvc add --glob calls currently fail because the second call also matches the .dvc stage files generated by the first one. Those metadata paths are passed to output validation and rejected as data outputs.

This change filters *.dvc, dvc.yaml, and dvc.lock only when they come from wildcard expansion. Explicit metadata targets keep the existing validation error, while repeated glob calls can update already tracked files and add new matches.

Fixes #11086.

Test plan

  • pytest -q — 3051 passed, 11 skipped, 2 xpassed
  • pytest -q tests/func/test_add.py — 68 passed, 1 skipped
  • mypy dvc/repo/add.py
  • pre-commit run --files dvc/repo/add.py tests/func/test_add.py
  • Reproduced the CLI failure before the change and verified two consecutive dvc add --glob "data/*" calls succeed after it
  • ❗ I have followed the Contributing to DVC checklist.

  • 📖 This fix preserves the documented --glob behavior and does not require a documentation update.

Thank you for the contribution - we'll try to review it as soon as possible. 🙏

@github-project-automation github-project-automation Bot moved this to Backlog in DVC Aug 19, 2026
@CLAassistant

CLAassistant commented Aug 19, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@codecov

codecov Bot commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.85714% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.98%. Comparing base (2431ec6) to head (4feca1b).
⚠️ Report is 213 commits behind head on main.

Files with missing lines Patch % Lines
dvc/repo/add.py 85.71% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11087      +/-   ##
==========================================
+ Coverage   90.68%   90.98%   +0.30%     
==========================================
  Files         504      505       +1     
  Lines       39795    41163    +1368     
  Branches     3141     3268     +127     
==========================================
+ Hits        36087    37452    +1365     
- Misses       3042     3071      +29     
+ Partials      666      640      -26     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

add: repeated --glob includes generated DVC metadata

2 participants