code: def patch_git_repo():
      mock_repo = mock.Mock()
      mock_repo.head.commit.hexsha = MOCK_COMMIT_HASH
      mock_repo.ignored.return_value = []
      with mock.patch("git.Repo", return_value=mock_repo):
          yield mock_repo
  
file_path: mlflow/tests/tracking/context/test_git_context.py
imports: from unittest import mock
  import git
  import pytest
  from mlflow.tracking.context.git_context import GitRunContext
  from mlflow.utils.mlflow_tags import MLFLOW_GIT_COMMIT
label_desc: Use image node_id 2 for calling a global function with example usage: patch_git_repo() without return types