Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d8ab99c

Browse files
committedMar 15, 2024
Use Sphinx manpage references where applicable
In docstrings within the git module. This makes text of the same general form as, e.g. git-rev-parse or ``git rev-parse`` or URLs that link directly to a documentation page equivalent to a manpage or that link to the first section where preceding material is trivial... ...instead be in the form: :manpage:`git-rev-parse(1)` with variations as appropriate, for example changing gitglossary(7) to :manpage:`gitglossary(7)` and making other changes accordingly, such as adjusting phrasing and the use of hyphens in a small number of cases. Together with c5a29a9, which made such references linkify to the' official online documentation for Git, this makes it so that when git subcommands are mentioned in docstrings, the Sphinx autodoc generated documentation in the API Reference page now renders them as links to the relevant documentation page. Links to specific sections where it matters or potentially matters that it goes to that section are not replaced. In particular, links to specific entries in gitglossary(7) are not replaced. To do this properly would involve adding a new Sphinx role for it, which would work well in the rendered documentation but could be unclear when the documentation is read in docstrings appearing in the code.
1 parent e883293 commit d8ab99c

File tree

19 files changed

+109
-99
lines changed

19 files changed

+109
-99
lines changed
 

‎git/cmd.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,8 @@ def working_dir(self) -> Union[None, PathLike]:
901901
def version_info(self) -> Tuple[int, ...]:
902902
"""
903903
:return: Tuple with integers representing the major, minor and additional
904-
version numbers as parsed from ``git version``. Up to four fields are used.
904+
version numbers as parsed from :manpage:`git-version(1)`. Up to four fields
905+
are used.
905906
906907
This value is generated on demand and is cached.
907908
"""
@@ -1038,9 +1039,9 @@ def execute(
10381039
3. Deeper descendants do not receive signals, though they may sometimes
10391040
terminate as a consequence of their parent processes being killed.
10401041
4. `kill_after_timeout` uses ``SIGKILL``, which can have negative side
1041-
effects on a repository. For example, stale locks in case of ``git gc``
1042-
could render the repository incapable of accepting changes until the lock
1043-
is manually removed.
1042+
effects on a repository. For example, stale locks in case of
1043+
:manpage:`git-gc(1)` could render the repository incapable of accepting
1044+
changes until the lock is manually removed.
10441045
10451046
:param with_stdout:
10461047
If ``True``, default ``True``, we open stdout on the created process.

‎git/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ def get_config_path(config_level: Lit_config_levels) -> str:
270270
class GitConfigParser(cp.RawConfigParser, metaclass=MetaParserBuilder):
271271
"""Implements specifics required to read git style configuration files.
272272
273-
This variation behaves much like the ``git config`` command, such that the
273+
This variation behaves much like the :manpage:`git-config(1)` command, such that the
274274
configuration will be read on demand based on the filepath given during
275275
initialization.
276276

‎git/diff.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,8 @@ def diff(
222222
to be read and diffed.
223223
224224
:param kwargs:
225-
Additional arguments passed to ``git diff``, such as ``R=True`` to swap both
226-
sides of the diff.
225+
Additional arguments passed to :manpage:`git-diff(1)`, such as ``R=True`` to
226+
swap both sides of the diff.
227227
228228
:return:
229229
A :class:`DiffIndex` representing the computed diff.
@@ -590,7 +590,7 @@ def _index_from_patch_format(cls, repo: "Repo", proc: Union["Popen", "Git.AutoIn
590590
The repository we are operating on.
591591
592592
:param proc:
593-
``git diff`` process to read from
593+
:manpage:`git-diff(1)` process to read from
594594
(supports :class:`Git.AutoInterrupt <git.cmd.Git.AutoInterrupt>` wrapper).
595595
596596
:return:

‎git/index/base.py

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,11 @@ def write(
225225
226226
:param ignore_extension_data:
227227
If ``True``, the TREE type extension data read in the index will not be
228-
written to disk. NOTE that no extension data is actually written.
229-
Use this if you have altered the index and would like to use
230-
``git write-tree`` afterwards to create a tree representing your written
231-
changes. If this data is present in the written index, ``git write-tree``
232-
will instead write the stored/cached tree.
228+
written to disk. NOTE that no extension data is actually written. Use this
229+
if you have altered the index and would like to use
230+
:manpage:`git-write-tree(1)` afterwards to create a tree representing your
231+
written changes. If this data is present in the written index,
232+
:manpage:`git-write-tree(1)` will instead write the stored/cached tree.
233233
Alternatively, use :meth:`write_tree` to handle this case automatically.
234234
"""
235235
# Make sure we have our entries read before getting a write lock.
@@ -343,7 +343,7 @@ def from_tree(cls, repo: "Repo", *treeish: Treeish, **kwargs: Any) -> "IndexFile
343343
tree, tree 3 is the 'other' one.
344344
345345
:param kwargs:
346-
Additional arguments passed to ``git read-tree``.
346+
Additional arguments passed to :manpage:`git-read-tree(1)`.
347347
348348
:return:
349349
New :class:`IndexFile` instance. It will point to a temporary index location
@@ -355,9 +355,9 @@ def from_tree(cls, repo: "Repo", *treeish: Treeish, **kwargs: Any) -> "IndexFile
355355
automatically resolve more cases in a commonly correct manner. Specify
356356
``trivial=True`` as a keyword argument to override that.
357357
358-
As the underlying ``git read-tree`` command takes into account the current
359-
index, it will be temporarily moved out of the way to prevent any unexpected
360-
interference.
358+
As the underlying :manpage:`git-read-tree(1)` command takes into account the
359+
current index, it will be temporarily moved out of the way to prevent any
360+
unexpected interference.
361361
"""
362362
if len(treeish) == 0 or len(treeish) > 3:
363363
raise ValueError("Please specify between 1 and 3 treeish, got %i" % len(treeish))
@@ -470,10 +470,10 @@ def _write_path_to_stdin(
470470
In that case, it will return ``None``.
471471
472472
:note:
473-
There is a bug in git-update-index that prevents it from sending reports
474-
just in time. This is why we have a version that tries to read stdout and
475-
one which doesn't. In fact, the stdout is not important as the piped-in
476-
files are processed anyway and just in time.
473+
There is a bug in :manpage:`git-update-index(1)` that prevents it from
474+
sending reports just in time. This is why we have a version that tries to
475+
read stdout and one which doesn't. In fact, the stdout is not important as
476+
the piped-in files are processed anyway and just in time.
477477
478478
:note:
479479
Newlines are essential here, git's behaviour is somewhat inconsistent on
@@ -782,11 +782,12 @@ def add(
782782
directories like ``lib``, which will add all the files within the
783783
directory and subdirectories.
784784
785-
This equals a straight ``git add``.
785+
This equals a straight :manpage:`git-add(1)`.
786786
787787
They are added at stage 0.
788788
789-
- :class:~`git.objects.blob.Blob` or :class:`~git.objects.submodule.base.Submodule` object
789+
- :class:~`git.objects.blob.Blob` or
790+
:class:`~git.objects.submodule.base.Submodule` object
790791
791792
Blobs are added as they are assuming a valid mode is set.
792793
@@ -818,8 +819,8 @@ def add(
818819
:param force:
819820
**CURRENTLY INEFFECTIVE**
820821
If ``True``, otherwise ignored or excluded files will be added anyway. As
821-
opposed to the ``git add`` command, we enable this flag by default as the
822-
API user usually wants the item to be added even though they might be
822+
opposed to the :manpage:`git-add(1)` command, we enable this flag by default
823+
as the API user usually wants the item to be added even though they might be
823824
excluded.
824825
825826
:param fprogress:
@@ -850,8 +851,8 @@ def add(
850851
:param write_extension_data:
851852
If ``True``, extension data will be written back to the index. This can lead
852853
to issues in case it is containing the 'TREE' extension, which will cause
853-
the ``git commit`` command to write an old tree, instead of a new one
854-
representing the now changed index.
854+
the :manpage:`git-commit(1)` command to write an old tree, instead of a new
855+
one representing the now changed index.
855856
856857
This doesn't matter if you use :meth:`IndexFile.commit`, which ignores the
857858
'TREE' extension altogether. You should set it to ``True`` if you intend to
@@ -1008,8 +1009,8 @@ def remove(
10081009
uncommitted changes in it.
10091010
10101011
:param kwargs:
1011-
Additional keyword arguments to be passed to ``git rm``, such as ``r`` to
1012-
allow recursive removal.
1012+
Additional keyword arguments to be passed to :manpage:`git-rm(1)`, such as
1013+
``r`` to allow recursive removal.
10131014
10141015
:return:
10151016
List(path_string, ...) list of repository relative paths that have been
@@ -1058,7 +1059,7 @@ def move(
10581059
skipped.
10591060
10601061
:param kwargs:
1061-
Additional arguments you would like to pass to ``git mv``, such as
1062+
Additional arguments you would like to pass to :manpage:`git-mv(1)`, such as
10621063
``dry_run`` or ``force``.
10631064
10641065
:return:
@@ -1224,7 +1225,7 @@ def checkout(
12241225
prior and after a file has been checked out.
12251226
12261227
:param kwargs:
1227-
Additional arguments to be passed to ``git checkout-index``.
1228+
Additional arguments to be passed to :manpage:`git-checkout-index(1)`.
12281229
12291230
:return:
12301231
Iterable yielding paths to files which have been checked out and are
@@ -1243,8 +1244,8 @@ def checkout(
12431244
The checkout is limited to checking out the files in the index. Files which
12441245
are not in the index anymore and exist in the working tree will not be
12451246
deleted. This behaviour is fundamentally different to ``head.checkout``,
1246-
i.e. if you want ``git checkout`` like behaviour, use ``head.checkout``
1247-
instead of ``index.checkout``.
1247+
i.e. if you want :manpage:`git-checkout(1)`-like behaviour, use
1248+
``head.checkout`` instead of ``index.checkout``.
12481249
"""
12491250
args = ["--index"]
12501251
if force:
@@ -1416,14 +1417,14 @@ def reset(
14161417
raised.
14171418
14181419
:param kwargs:
1419-
Additional keyword arguments passed to ``git reset``.
1420+
Additional keyword arguments passed to :manpage:`git-reset(1)`.
14201421
14211422
:note:
14221423
:meth:`IndexFile.reset`, as opposed to
14231424
:meth:`HEAD.reset <git.refs.head.HEAD.reset>`, will not delete any files in
14241425
order to maintain a consistent working tree. Instead, it will just check out
14251426
the files according to their state in the index.
1426-
If you want ``git reset``-like behaviour, use
1427+
If you want :manpage:`git-reset(1)`-like behaviour, use
14271428
:meth:`HEAD.reset <git.refs.head.HEAD.reset>` instead.
14281429
14291430
:return:

‎git/index/typ.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,7 @@ def stage(self) -> int:
130130
* 3 = stage of entries from the 'right' side of the merge
131131
132132
:note:
133-
For more information, see:
134-
http://www.kernel.org/pub/software/scm/git/docs/git-read-tree.html
133+
For more information, see :manpage:`git-read-tree(1)`.
135134
"""
136135
return (self.flags & CE_STAGEMASK) >> CE_STAGESHIFT
137136

‎git/objects/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class Object(LazyMixin):
4545
* :class:`Commit <git.objects.commit.Commit>`
4646
* :class:`TagObject <git.objects.tag.TagObject>`
4747
48-
See gitglossary(7) on:
48+
See :manpage:`gitglossary(7)` on:
4949
5050
* "object": https://git-scm.com/docs/gitglossary#def_object
5151
* "object type": https://git-scm.com/docs/gitglossary#def_object_type

‎git/objects/blob.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
class Blob(base.IndexObject):
2020
"""A Blob encapsulates a git blob object.
2121
22-
See gitglossary(7) on "blob": https://git-scm.com/docs/gitglossary#def_blob_object
22+
See :manpage:`gitglossary(7)` on "blob":
23+
https://git-scm.com/docs/gitglossary#def_blob_object
2324
"""
2425

2526
DEFAULT_MIME_TYPE = "text/plain"

‎git/objects/commit.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
class Commit(base.Object, TraversableIterableObj, Diffable, Serializable):
6666
"""Wraps a git commit object.
6767
68-
See gitglossary(7) on "commit object":
68+
See :manpage:`gitglossary(7)` on "commit object":
6969
https://git-scm.com/docs/gitglossary#def_commit_object
7070
7171
:note:
@@ -269,8 +269,9 @@ def count(self, paths: Union[PathLike, Sequence[PathLike]] = "", **kwargs: Any)
269269
actually containing the paths.
270270
271271
:param kwargs:
272-
Additional options to be passed to ``git rev-list``. They must not alter the
273-
output style of the command, or parsing will yield incorrect results.
272+
Additional options to be passed to :manpage:`git-rev-list(1)`. They must not
273+
alter the output style of the command, or parsing will yield incorrect
274+
results.
274275
275276
:return:
276277
An int defining the number of reachable commits
@@ -307,14 +308,14 @@ def iter_items(
307308
The :class:`~git.repo.base.Repo`.
308309
309310
:param rev:
310-
Revision specifier. See git-rev-parse for viable options.
311+
Revision specifier. See :manpage:`git-rev-parse(1)` for viable options.
311312
312313
:param paths:
313314
An optional path or list of paths. If set only :class:`Commit`\s that
314315
include the path or paths will be considered.
315316
316317
:param kwargs:
317-
Optional keyword arguments to ``git rev-list`` where:
318+
Optional keyword arguments to :manpage:`git-rev-list(1)` where:
318319
319320
* ``max_count`` is the maximum number of commits to fetch.
320321
* ``skip`` is the number of commits to skip.
@@ -353,7 +354,7 @@ def iter_parents(self, paths: Union[PathLike, Sequence[PathLike]] = "", **kwargs
353354
contain at least one of the paths.
354355
355356
:param kwargs:
356-
All arguments allowed by ``git rev-list``.
357+
All arguments allowed by :manpage:`git-rev-list(1)`.
357358
358359
:return:
359360
Iterator yielding :class:`Commit` objects which are parents of ``self``
@@ -404,7 +405,7 @@ def trailers_list(self) -> List[Tuple[str, str]]:
404405
"""Get the trailers of the message as a list.
405406
406407
Git messages can contain trailer information that are similar to RFC 822 e-mail
407-
headers (see: https://git-scm.com/docs/git-interpret-trailers).
408+
headers. See :manpage:`git-interpret-trailers(1)`.
408409
409410
This function calls ``git interpret-trailers --parse`` onto the message to
410411
extract the trailer information, returns the raw trailer data as a list.
@@ -456,7 +457,7 @@ def trailers_dict(self) -> Dict[str, List[str]]:
456457
"""Get the trailers of the message as a dictionary.
457458
458459
Git messages can contain trailer information that are similar to RFC 822 e-mail
459-
headers (see: https://git-scm.com/docs/git-interpret-trailers).
460+
headers. See :manpage:`git-interpret-trailers(1)`.
460461
461462
This function calls ``git interpret-trailers --parse`` onto the message to
462463
extract the trailer information. The key value pairs are stripped of leading and
@@ -499,7 +500,7 @@ def _iter_from_process_or_stream(cls, repo: "Repo", proc_or_stream: Union[Popen,
499500
from our lighting fast object database.
500501
501502
:param proc:
502-
``git rev-list`` process instance - one sha per line.
503+
:manpage:`git-rev-list(1)` process instance - one sha per line.
503504
504505
:return:
505506
Iterator supplying :class:`Commit` objects
@@ -596,8 +597,8 @@ def create_from_tree(
596597
597598
:note:
598599
Additional information about the committer and author are taken from the
599-
environment or from the git configuration. See git-commit-tree for more
600-
information.
600+
environment or from the git configuration. See :manpage:`git-commit-tree(1)`
601+
for more information.
601602
"""
602603
if parent_commits is None:
603604
try:

‎git/objects/submodule/base.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ def _clone_repo(
342342
Allow unsafe options to be used, like ``--upload-pack``.
343343
344344
:param kwargs:
345-
Additional arguments given to ``git clone``.
345+
Additional arguments given to :manpage:`git-clone(1)`.
346346
"""
347347
module_abspath = cls._module_abspath(repo, path, name)
348348
module_checkout_path = module_abspath
@@ -463,10 +463,10 @@ def add(
463463
It will be created as required during the repository initialization.
464464
465465
:param url:
466-
git-clone compatible URL, see git-clone reference for more information.
467-
If ``None``, the repository is assumed to exist, and the url of the first
468-
remote is taken instead. This is useful if you want to make an existing
469-
repository a submodule of another one.
466+
``git clone ...``-compatible URL. See :manpage:`git-clone(1)` for more
467+
information. If ``None``, the repository is assumed to exist, and the URL of
468+
the first remote is taken instead. This is useful if you want to make an
469+
existing repository a submodule of another one.
470470
471471
:param branch:
472472
Name of branch at which the submodule should (later) be checked out. The
@@ -696,7 +696,7 @@ def update(
696696
its value.
697697
698698
:param clone_multi_options:
699-
List of ``git clone`` options.
699+
List of :manpage:`git-clone(1)` options.
700700
Please see :meth:`Repo.clone <git.repo.base.Repo.clone>` for details.
701701
They only take effect with the `init` option.
702702

‎git/objects/tag.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class TagObject(base.Object):
3737
"""Annotated (i.e. non-lightweight) tag carrying additional information about an
3838
object we are pointing to.
3939
40-
See gitglossary(7) on "tag object":
40+
See :manpage:`gitglossary(7)` on "tag object":
4141
https://git-scm.com/docs/gitglossary#def_tag_object
4242
"""
4343

‎git/objects/tree.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ class Tree(IndexObject, git_diff.Diffable, util.Traversable, util.Serializable):
168168
R"""Tree objects represent an ordered list of :class:`~git.objects.blob.Blob`\s and
169169
other :class:`Tree`\s.
170170
171-
See gitglossary(7) on "tree object":
171+
See :manpage:`gitglossary(7)` on "tree object":
172172
https://git-scm.com/docs/gitglossary#def_tree_object
173173
174174
Subscripting is supported, as with a list or dict:

‎git/refs/head.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def reset(
8989
that are to be reset. This allows to partially reset individual files.
9090
9191
:param kwargs:
92-
Additional arguments passed to ``git reset``.
92+
Additional arguments passed to :manpage:`git-reset(1)`.
9393
9494
:return:
9595
self

‎git/refs/symbolic.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,7 @@ def dereference_recursive(cls, repo: "Repo", ref_path: Union[PathLike, None]) ->
173173
def _check_ref_name_valid(ref_path: PathLike) -> None:
174174
"""Check a ref name for validity.
175175
176-
This is based on the rules described in:
177-
https://git-scm.com/docs/git-check-ref-format/#_description
176+
This is based on the rules described in :manpage:`git-check-ref-format(1)`.
178177
"""
179178
previous: Union[str, None] = None
180179
one_before_previous: Union[str, None] = None

‎git/refs/tag.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def create(
124124
If ``True``, force creation of a tag even though that tag already exists.
125125
126126
:param kwargs:
127-
Additional keyword arguments to be passed to ``git tag``.
127+
Additional keyword arguments to be passed to :manpage:`git-tag(1)`.
128128
129129
:return:
130130
A new :class:`TagReference`.

‎git/remote.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,8 @@ class FetchInfo(IterableObj):
333333

334334
@classmethod
335335
def refresh(cls) -> Literal[True]:
336-
"""Update information about which ``git fetch`` flags are supported by the git
337-
executable being used.
336+
"""Update information about which :manpage:`git-fetch(1)` flags are supported
337+
by the git executable being used.
338338
339339
Called by the :func:`git.refresh` function in the top level ``__init__``.
340340
"""
@@ -1015,13 +1015,13 @@ def fetch(
10151015
"grab the master branch head from the $URL and store it as my origin
10161016
branch head". And ``git push $URL refs/heads/master:refs/heads/to-upstream``
10171017
means "publish my master branch head as to-upstream branch at $URL".
1018-
See also git-push(1).
1018+
See also :manpage:`git-push(1)`.
10191019
1020-
Taken from the git manual, gitglossary(7).
1020+
Taken from the git manual, :manpage:`gitglossary(7)`.
10211021
1022-
Fetch supports multiple refspecs (as the underlying git-fetch does) -
1023-
supplying a list rather than a string for 'refspec' will make use of this
1024-
facility.
1022+
Fetch supports multiple refspecs (as the underlying :manpage:`git-fetch(1)`
1023+
does) - supplying a list rather than a string for 'refspec' will make use of
1024+
this facility.
10251025
10261026
:param progress:
10271027
See the :meth:`push` method.
@@ -1040,7 +1040,7 @@ def fetch(
10401040
Allow unsafe options to be used, like ``--upload-pack``.
10411041
10421042
:param kwargs:
1043-
Additional arguments to be passed to ``git fetch``.
1043+
Additional arguments to be passed to :manpage:`git-fetch(1)`.
10441044
10451045
:return:
10461046
IterableList(FetchInfo, ...) list of :class:`FetchInfo` instances providing
@@ -1104,7 +1104,7 @@ def pull(
11041104
Allow unsafe options to be used, like ``--upload-pack``.
11051105
11061106
:param kwargs:
1107-
Additional arguments to be passed to ``git pull``.
1107+
Additional arguments to be passed to :manpage:`git-pull(1)`.
11081108
11091109
:return:
11101110
Please see :meth:`fetch` method.
@@ -1170,7 +1170,7 @@ def push(
11701170
Allow unsafe options to be used, like ``--receive-pack``.
11711171
11721172
:param kwargs:
1173-
Additional arguments to be passed to ``git push``.
1173+
Additional arguments to be passed to :manpage:`git-push(1)`.
11741174
11751175
:return:
11761176
A :class:`PushInfoList` object, where each list member represents an

‎git/repo/base.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ class Repo:
149149
"--config",
150150
"-c",
151151
]
152-
"""Options to ``git clone`` that allow arbitrary commands to be executed.
152+
"""Options to :manpage:`git-clone(1)` that allow arbitrary commands to be executed.
153153
154154
The ``--upload-pack``/``-u`` option allows users to execute arbitrary commands
155155
directly:
@@ -572,7 +572,7 @@ def delete_head(self, *heads: "Union[str, Head]", **kwargs: Any) -> None:
572572
"""Delete the given heads.
573573
574574
:param kwargs:
575-
Additional keyword arguments to be passed to ``git branch``.
575+
Additional keyword arguments to be passed to :manpage:`git-branch(1)`.
576576
"""
577577
return Head.delete(self, *heads, **kwargs)
578578

@@ -700,7 +700,7 @@ def commit(self, rev: Union[str, Commit_ish, None] = None) -> Commit:
700700
"""The :class:`~git.objects.commit.Commit` object for the specified revision.
701701
702702
:param rev:
703-
Revision specifier, see ``git rev-parse`` for viable options.
703+
Revision specifier, see :manpage:`git-rev-parse(1)` for viable options.
704704
705705
:return:
706706
:class:`~git.objects.commit.Commit`
@@ -749,15 +749,15 @@ def iter_commits(
749749
history of a given ref/commit.
750750
751751
:param rev:
752-
Revision specifier, see ``git rev-parse`` for viable options.
752+
Revision specifier, see :manpage:`git-rev-parse(1)` for viable options.
753753
If ``None``, the active branch will be used.
754754
755755
:param paths:
756756
An optional path or a list of paths. If set, only commits that include the
757757
path or paths will be returned.
758758
759759
:param kwargs:
760-
Arguments to be passed to ``git rev-list``.
760+
Arguments to be passed to :manpage:`git-rev-list(1)`.
761761
Common ones are ``max_count`` and ``skip``.
762762
763763
:note:
@@ -930,8 +930,8 @@ def is_dirty(
930930
"""
931931
:return:
932932
``True`` if the repository is considered dirty. By default it will react
933-
like a git-status without untracked files, hence it is dirty if the index or
934-
the working copy have changes.
933+
like a :manpage:`git-status(1)` without untracked files, hence it is dirty
934+
if the index or the working copy have changes.
935935
"""
936936
if self._bare:
937937
# Bare repositories with no associated working directory are
@@ -1001,7 +1001,7 @@ def _get_untracked_files(self, *args: Any, **kwargs: Any) -> List[str]:
10011001
def ignored(self, *paths: PathLike) -> List[str]:
10021002
"""Checks if paths are ignored via ``.gitignore``.
10031003
1004-
This does so using the ``git check-ignore`` method.
1004+
This does so using the :manpage:`git-check-ignore(1)` method.
10051005
10061006
:param paths:
10071007
List of paths to check whether they are ignored or not.
@@ -1044,7 +1044,7 @@ def blame_incremental(self, rev: str | HEAD | None, file: str, **kwargs: Any) ->
10441044
:param rev:
10451045
Revision specifier. If ``None``, the blame will include all the latest
10461046
uncommitted changes. Otherwise, anything successfully parsed by
1047-
``git rev-parse`` is a valid option.
1047+
:manpage:`git-rev-parse(1)` is a valid option.
10481048
10491049
:return:
10501050
Lazy iterator of :class:`BlameEntry` tuples, where the commit indicates the
@@ -1140,7 +1140,7 @@ def blame(
11401140
:param rev:
11411141
Revision specifier. If ``None``, the blame will include all the latest
11421142
uncommitted changes. Otherwise, anything successfully parsed by
1143-
``git rev-parse`` is a valid option.
1143+
:manpage:`git-rev-parse(1)` is a valid option.
11441144
11451145
:return:
11461146
list: [git.Commit, list: [<line>]]
@@ -1312,7 +1312,8 @@ def init(
13121312
environment variables.
13131313
13141314
:param kwargs:
1315-
Keyword arguments serving as additional options to the ``git init`` command.
1315+
Keyword arguments serving as additional options to the
1316+
:manpage:`git-init(1)` command.
13161317
13171318
:return:
13181319
:class:`Repo` (the newly created repo)
@@ -1432,7 +1433,8 @@ def clone(
14321433
See :meth:`Remote.push <git.remote.Remote.push>`.
14331434
14341435
:param multi_options:
1435-
A list of ``git clone`` options that can be provided multiple times.
1436+
A list of :manpage:`git-clone(1)` options that can be provided multiple
1437+
times.
14361438
14371439
One option per list item which is passed exactly as specified to clone.
14381440
For example::
@@ -1453,7 +1455,8 @@ def clone(
14531455
:param kwargs:
14541456
* ``odbt`` = ObjectDatabase Type, allowing to determine the object database
14551457
implementation used by the returned :class:`Repo` instance.
1456-
* All remaining keyword arguments are given to the ``git clone`` command.
1458+
* All remaining keyword arguments are given to the :manpage:`git-clone(1)`
1459+
command.
14571460
14581461
:return:
14591462
:class:`Repo` (the newly cloned repo)
@@ -1551,7 +1554,7 @@ def archive(
15511554
The optional prefix to prepend to each filename in the archive.
15521555
15531556
:param kwargs:
1554-
Additional arguments passed to ``git archive``:
1557+
Additional arguments passed to :manpage:`git-archive(1)`:
15551558
15561559
* Use the ``format`` argument to define the kind of format. Use specialized
15571560
ostreams to write any format supported by Python.

‎git/repo/fun.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ def to_commit(obj: Object) -> "Commit":
226226

227227

228228
def rev_parse(repo: "Repo", rev: str) -> AnyGitObject:
229-
"""Parse a revision string. Like ``git rev-parse``.
229+
"""Parse a revision string. Like :manpage:`git-rev-parse(1)`.
230230
231231
:return:
232232
`~git.objects.base.Object` at the given revision.
@@ -239,8 +239,8 @@ def rev_parse(repo: "Repo", rev: str) -> AnyGitObject:
239239
* :class:`Blob <git.objects.blob.Blob>`
240240
241241
:param rev:
242-
``git rev-parse``-compatible revision specification as string. Please see
243-
http://www.kernel.org/pub/software/scm/git/docs/git-rev-parse.html for details.
242+
:manpage:`git-rev-parse(1)`-compatible revision specification as string.
243+
Please see :manpage:`git-rev-parse(1)` for details.
244244
245245
:raise gitdb.exc.BadObject:
246246
If the given revision could not be found.

‎git/types.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@
5757
* :class:`Commit <git.objects.commit.Commit>`
5858
* :class:`TagObject <git.objects.tag.TagObject>`
5959
60-
Those GitPython classes represent the four git object types, per gitglossary(7):
60+
Those GitPython classes represent the four git object types, per
61+
:manpage:`gitglossary(7)`:
6162
6263
* "blob": https://git-scm.com/docs/gitglossary#def_blob_object
6364
* "tree object": https://git-scm.com/docs/gitglossary#def_tree_object
@@ -76,7 +77,8 @@
7677
Tree_ish = Union["Commit", "Tree", "TagObject"]
7778
"""Union of :class:`~git.objects.base.Object`-based types that are sometimes tree-ish.
7879
79-
See gitglossary(7) on "tree-ish": https://git-scm.com/docs/gitglossary#def_tree-ish
80+
See :manpage:`gitglossary(7)` on "tree-ish":
81+
https://git-scm.com/docs/gitglossary#def_tree-ish
8082
8183
:note:
8284
:class:`~git.objects.tree.Tree` and :class:`~git.objects.commit.Commit` are the
@@ -94,7 +96,8 @@
9496
Commit_ish = Union["Commit", "TagObject"]
9597
"""Union of :class:`~git.objects.base.Object`-based types that are sometimes commit-ish.
9698
97-
See gitglossary(7) on "commit-ish": https://git-scm.com/docs/gitglossary#def_commit-ish
99+
See :manpage:`gitglossary(7)` on "commit-ish":
100+
https://git-scm.com/docs/gitglossary#def_commit-ish
98101
99102
:note:
100103
:class:`~git.objects.commit.Commit` is the only class whose instances are all
@@ -117,8 +120,9 @@
117120
values in :class:`~git.objects.base.Object` subclasses that represent git objects. These
118121
literals therefore correspond to the types in the :class:`AnyGitObject` union.
119122
120-
These are the same strings git itself uses to identify its four object types. See
121-
gitglossary(7) on "object type": https://git-scm.com/docs/gitglossary#def_object_type
123+
These are the same strings git itself uses to identify its four object types.
124+
See :manpage:`gitglossary(7)` on "object type":
125+
https://git-scm.com/docs/gitglossary#def_object_type
122126
"""
123127

124128
Lit_commit_ish = Literal["commit", "tag"]

‎git/util.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -558,8 +558,8 @@ def remove_password_if_present(cmdline: Sequence[str]) -> List[str]:
558558

559559
class RemoteProgress:
560560
"""Handler providing an interface to parse progress information emitted by
561-
``git push`` and ``git fetch`` and to dispatch callbacks allowing subclasses to
562-
react to the progress."""
561+
:manpage:`git-push(1)` and :manpage:`git-fetch(1)` and to dispatch callbacks
562+
allowing subclasses to react to the progress."""
563563

564564
_num_op_codes: int = 9
565565
(
@@ -595,8 +595,8 @@ def __init__(self) -> None:
595595
self.other_lines: List[str] = []
596596

597597
def _parse_progress_line(self, line: AnyStr) -> None:
598-
"""Parse progress information from the given line as retrieved by ``git push``
599-
or ``git fetch``.
598+
"""Parse progress information from the given line as retrieved by
599+
:manpage:`git-push(1)` or :manpage:`git-fetch(1)`.
600600
601601
- Lines that do not contain progress info are stored in :attr:`other_lines`.
602602
- Lines that seem to contain an error (i.e. start with ``error:`` or ``fatal:``)
@@ -922,7 +922,8 @@ def __init__(self, total: Total_TD, files: Dict[PathLike, Files_TD]) -> None:
922922

923923
@classmethod
924924
def _list_from_string(cls, repo: "Repo", text: str) -> "Stats":
925-
"""Create a :class:`Stats` object from output retrieved by ``git diff``.
925+
"""Create a :class:`Stats` object from output retrieved by
926+
:manpage:`git-diff(1)`.
926927
927928
:return:
928929
:class:`git.Stats`

0 commit comments

Comments
 (0)
Please sign in to comment.