| 205 | |
| 206 | |
| 207 | def test_modified_subrepo(tmp_dir, scm, dvc): |
| 208 | from dvc.repo import Repo |
| 209 | |
| 210 | tmp_dir.gen({"subdir": {"file": "first"}}) |
| 211 | subrepo_dir = tmp_dir / "subdir" |
| 212 | |
| 213 | with subrepo_dir.chdir(): |
| 214 | subrepo = Repo.init(subdir=True) |
| 215 | subrepo.add("file") |
| 216 | |
| 217 | scm.add(os.path.join("subdir", "file.dvc")) |
| 218 | scm.commit("init") |
| 219 | |
| 220 | (subrepo_dir / "file").write_text("second") |
| 221 | |
| 222 | with subrepo_dir.chdir(): |
| 223 | subrepo = Repo() |
| 224 | assert subrepo.diff() == { |
| 225 | "added": [], |
| 226 | "deleted": [], |
| 227 | "modified": [ |
| 228 | { |
| 229 | "path": "file", |
| 230 | "hash": {"old": digest("first"), "new": digest("second")}, |
| 231 | } |
| 232 | ], |
| 233 | "not in cache": [], |
| 234 | "renamed": [], |
| 235 | } |
| 236 | |
| 237 | |
| 238 | def test_refs(tmp_dir, scm, dvc): |