@@ -355,13 +355,48 @@ def __setstate__(self, d: Dict[str, Any]) -> None:
355
355
GIT_PYTHON_GIT_EXECUTABLE = None
356
356
"""Provide the full path to the git executable. Otherwise it assumes git is in the path.
357
357
358
- Note that the git executable is actually found during the refresh step in
359
- the top level ``__init__``.
358
+ :note: The git executable is actually found during the refresh step in
359
+ the top level :mod:`__init__`. It can also be changed by explicitly calling
360
+ :func:`git.refresh`.
360
361
"""
361
362
362
363
@classmethod
363
364
def refresh (cls , path : Union [None , PathLike ] = None ) -> bool :
364
- """This gets called by the refresh function (see the top level __init__)."""
365
+ """This gets called by the refresh function (see the top level __init__).
366
+
367
+ :param path: Optional path to the git executable. If not absolute, it is
368
+ resolved immediately, relative to the current directory. (See note below.)
369
+
370
+ :note: The top-level :func:`git.refresh` should be preferred because it calls
371
+ this method and may also update other state accordingly.
372
+
373
+ :note: There are three different ways to specify what command refreshing causes
374
+ to be uses for git:
375
+
376
+ 1. Pass no *path* argument and do not set the ``GIT_PYTHON_GIT_EXECUTABLE``
377
+ environment variable. The command name ``git`` is used. It is looked up
378
+ in a path search by the system, in each command run (roughly similar to
379
+ how git is found when running ``git`` commands manually). This is usually
380
+ the desired behavior.
381
+
382
+ 2. Pass no *path* argument but set the ``GIT_PYTHON_GIT_EXECUTABLE``
383
+ environment variable. The command given as the value of that variable is
384
+ used. This may be a simple command or an arbitrary path. It is looked up
385
+ in each command run. Setting ``GIT_PYTHON_GIT_EXECUTABLE`` to ``git`` has
386
+ the same effect as not setting it.
387
+
388
+ 3. Pass a *path* argument. This path, if not absolute, it immediately
389
+ resolved, relative to the current directory. This resolution occurs at
390
+ the time of the refresh, and when git commands are run, they are run with
391
+ that actual path. If a *path* argument is passed, the
392
+ ``GIT_PYTHON_GIT_EXECUTABLE`` environment variable is not consulted.
393
+
394
+ :note: Refreshing always sets the :attr:`Git.GIT_PYTHON_GIT_EXECUTABLE` class
395
+ attribute, which can be read on the :class:`Git` class or any of its
396
+ instances to check what command is used to run git. This attribute should
397
+ not be confused with the related ``GIT_PYTHON_GIT_EXECUTABLE`` environment
398
+ variable. The class attribute is set no matter how refreshing is performed.
399
+ """
365
400
# Discern which path to refresh with.
366
401
if path is not None :
367
402
new_git = os .path .expanduser (path )
0 commit comments