code: def test_refs(tmp_dir, scm, dvc):
      tmp_dir.dvc_gen("file", "first", commit="first version")
      tmp_dir.dvc_gen("file", "second", commit="second version")
      tmp_dir.dvc_gen("file", "third", commit="third version")
  
      HEAD_2 = digest("first")  # noqa: N806
      HEAD_1 = digest("second")  # noqa: N806
      HEAD = digest("third")  # noqa: N806
  
      assert dvc.diff("HEAD~1") == {
          "added": [],
          "deleted": [],
          "modified": [
              {"path": "file", "hash": {"old": HEAD_1, "new": HEAD}}
          ],
          "not in cache": [],
          "renamed": [],
      }
  
      assert dvc.diff("HEAD~2", "HEAD~1") == {
          "added": [],
          "deleted": [],
          "modified": [
              {"path": "file", "hash": {"old": HEAD_2, "new": HEAD_1}}
          ],
          "not in cache": [],
          "renamed": [],
      }
  
      with pytest.raises(
          DvcException, match=r"unknown Git revision 'missing'"
      ):
          dvc.diff("missing")
  
imports: import hashlib
  import os
  import pytest
  from funcy import first
  from dvc.exceptions import DvcException
  from dvc.utils.fs import remove
label_desc: Use image node_id 10 for calling a global function with example usage: test_refs(tmp_dir, scm, dvc) without return types