class_docstr: Representation of a Git repository
  
      
code: def __init__(self, path):
      # A lock to prevent multiple threads performing write operations in parallel
      self._write_lock = threading.Lock()
  
      # Note, that the following three path objects are used often and
      # therefore are stored for performance. Path object creation comes with
      # a cost. Most notably, this is used for validity checking of the
      # repository.
      self.pathobj = Path(path)
      self.dot_git = _get_dot_git(self.pathobj, ok_missing=True)
      self._valid_git_test_path = self.dot_git / "HEAD"
  
      self._cfg = None
      self._git_runner = GitWitlessRunner(cwd=self.pathobj)
  
      self.__fake_dates_enabled = None
  
      self._line_splitter = None
  
      # Finally, register a finalizer (instead of having a __del__ method).
      # This will be called by garbage collection as well as "atexit". By
      # keeping the reference here, we can also call it explicitly.
      # Note, that we can pass required attributes to the finalizer, but not
      # `self` itself. This would create an additional reference to the object
      # and thereby preventing it from being collected at all.
      self._finalizer = finalize(self, GitRepo._cleanup, self.pathobj)
  
imports: import logging
  import re
  import threading
  import time
  from contextlib import contextmanager
  from locale import getpreferredencoding
  from os import environ
  from os.path import lexists
  from typing import Optional
  from weakref import finalize, WeakValueDictionary
  from datalad.cmd import GitWitlessRunner, StdOutErrCapture
  from datalad.config import ConfigManager
  from datalad.dataset.repo import PathBasedFlyweight, RepoInterface, path_based_str_repr
  from datalad.runner.nonasyncrunner import STDERR_FILENO, STDOUT_FILENO
  from datalad.runner.protocol import GeneratorMixIn
  from datalad.runner.utils import AssemblingDecoderMixIn, LineSplitter
  from datalad.support.exceptions import CommandError, GitIgnoreError, InvalidGitRepositoryError, PathKnownToRepositoryError
  from datalad.utils import ensure_list, lock_if_required, Path
label_desc: Use image node_id 5 to create a new GitRepo object from inherited base classes: RepoInterface with example: obj = GitRepo(path)