Skip to content

Commit 144c46b

Browse files
authored
Make describe docs more accurate/informative (#23477)
* Make describe docs more accurate/informative
1 parent 05037f5 commit 144c46b

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

base/libgit2/repository.jl

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,16 @@ contains detailed information about it based on the keyword argument:
251251
252252
* `options::DescribeOptions=DescribeOptions()`
253253
254-
Equivalent to `git describe <commitish>`.
254+
A git decription of a `commitish` object looks for the tag (by default, annotated,
255+
although a search of all tags can be performed) which can be reached from `commitish`
256+
which is most recent. If the tag is pointing to `commitish`, then only the tag is
257+
included in the description. Otherwise, a suffix is included which contains the
258+
number of commits between `commitish` and the most recent tag. If there is no such
259+
tag, the default behavior is for the description to fail, although this can be
260+
changed through `options`.
261+
262+
Equivalent to `git describe <commitish>`. See [`DescribeOptions`](@ref) for more
263+
information.
255264
"""
256265
function GitDescribeResult(commitish::GitObject;
257266
options::DescribeOptions=DescribeOptions())
@@ -265,14 +274,19 @@ end
265274
"""
266275
LibGit2.GitDescribeResult(repo::GitRepo; kwarg...)
267276
268-
Produce a `GitDescribeResult` of the repository `repo`'s working directory,
269-
which can include all the commits and tags (or, for instance, HEAD only).
277+
Produce a `GitDescribeResult` of the repository `repo`'s working directory.
270278
The `GitDescribeResult` contains detailed information about the workdir based
271279
on the keyword argument:
272280
273281
* `options::DescribeOptions=DescribeOptions()`
274282
275-
Equivalent to `git describe`.
283+
In this case, the description is run on HEAD, producing the most recent tag
284+
which is an ancestor of HEAD. Afterwards, a status check on
285+
the [`workdir`](@ref) is performed and if the `workdir` is dirty
286+
(see [`isdirty`](@ref)) the description is also considered dirty.
287+
288+
Equivalent to `git describe`. See [`DescribeOptions`](@ref) for more
289+
information.
276290
"""
277291
function GitDescribeResult(repo::GitRepo; options::DescribeOptions=DescribeOptions())
278292
result_ptr_ptr = Ref{Ptr{Void}}(C_NULL)

doc/src/devdocs/libgit2.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ Base.LibGit2.Buffer
1717
Base.LibGit2.CachedCredentials
1818
Base.LibGit2.CheckoutOptions
1919
Base.LibGit2.CloneOptions
20+
Base.LibGit2.DescribeOptions
21+
Base.LibGit2.DescribeFormatOptions
2022
Base.LibGit2.DiffDelta
2123
Base.LibGit2.DiffFile
2224
Base.LibGit2.DiffOptionsStruct

0 commit comments

Comments
 (0)