code: def get_relevant_upstream_commit(
      repo: "git.Repo",
  ) -> Optional["git.Commit"]:
      try:
          tracking_branch = repo.active_branch.tracking_branch()
      except (TypeError, ValueError):
          return
  
      if tracking_branch:
          return tracking_branch.commit
  
      return search_for_most_recent_ancestor(repo)
  
file_path: neptune-client/src/neptune/internal/utils/git.py
imports: import logging
  import warnings
  from dataclasses import dataclass
  from datetime import datetime
  from typing import TYPE_CHECKING, List, Optional, Union
  from neptune.attributes.constants import DIFF_HEAD_INDEX_PATH, UPSTREAM_INDEX_DIFF
  from neptune.types import File
  from neptune.types.atoms.git_ref import GitRef, GitRefDisabled
label_desc: Use image node_id 5 for calling a global function with example usage: get_relevant_upstream_commit(repo) and returns: search_for_most_recent_ancestor, tracking_branch