dvc stage add --force: Only adds new outs to .gitignore, doesn't remove unused outs
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.9k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
Bug Report
Description
According to the documentation I should use dvc stage add --force when I want to update a stage. However the .gitignore file only gets updated with new output files and old output files aren't removed from .gitignore.
Reproduce
- dvc stage add -n test_stage -o file1 -o file2 python test_script.py
- View the produced .gitignore. It should contain the following
/file1
/file2
- dvc stage add --force -n test_stage -o file1 -o file3 python test_script.py
- View the produced .gitignore. It should contain the following
/file1
/file2
/file3
Expected
Updating a stage via dvc stage add --force should remove outs from the stage that are no longer included. Using dvc remove does do this.
I'm expecting the gitignore file to look like this after step 4
/file1
/file3
Environment information
Output of dvc doctor:
DVC version: 2.0.18 (conda)
---------------------------------
Platform: Python 3.9.4 on macOS-10.15.7-x86_64-i386-64bit
Supports: http, https
Cache types: reflink, hardlink, symlink
Cache directory: apfs on /dev/disk1s5
Caches: local
Remotes: None
Workspace directory: apfs on /dev/disk1s5
Repo: dvc, git
Additional Information (if any):
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the implementation and tests for dvc stage add --force, then reproduce the four command-line steps from the issue. Confirm that replacing file2 with file3 removes /file2 while retaining /file1 and adding /file3 in .gitignore.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100