mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
+7
-2
@@ -156,8 +156,13 @@ def diff(
|
||||
for target in old_missing & new_missing:
|
||||
raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), target)
|
||||
|
||||
old = indexes[a_rev]
|
||||
new = indexes[b_rev]
|
||||
if len(indexes.keys()) == 1:
|
||||
# both a_rev and b_rev point to the same sha, nothing to compare
|
||||
old = None
|
||||
new = None
|
||||
else:
|
||||
old = indexes[a_rev]
|
||||
new = indexes[b_rev]
|
||||
|
||||
with ui.status("Calculating diff"):
|
||||
return _diff(old, new, with_missing=with_missing)
|
||||
|
||||
@@ -21,6 +21,14 @@ def test_no_scm(tmp_dir, dvc):
|
||||
dvc.diff()
|
||||
|
||||
|
||||
def test_same_rev(tmp_dir, scm, dvc):
|
||||
tmp_dir.dvc_gen("file", "text", commit="add file")
|
||||
|
||||
assert not dvc.diff("HEAD", "HEAD")
|
||||
assert not dvc.diff("HEAD", "master")
|
||||
assert not dvc.diff("master", "HEAD")
|
||||
|
||||
|
||||
def test_added(tmp_dir, scm, dvc):
|
||||
tmp_dir.dvc_gen("file", "text")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user