Skip to content

Commit e6dcc49

Browse files
authored
Merge pull request #23454 from JuliaLang/ksh/docutils
Docs for libgit2 utils
2 parents 6ad3f6e + 182336d commit e6dcc49

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

base/libgit2/utils.jl

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ const URL_REGEX = r"""
2121
$
2222
"""x
2323

24+
"""
25+
version() -> VersionNumber
26+
27+
Return the version of libgit2 in use, as a [`VersionNumber`](@ref man-version-number-literals).
28+
"""
2429
function version()
2530
major = Ref{Cint}(0)
2631
minor = Ref{Cint}(0)
@@ -31,10 +36,34 @@ function version()
3136
end
3237
const VERSION = version()
3338

39+
"""
40+
isset(val::Integer, flag::Integer)
41+
42+
Test whether the bits of `val` indexed by `flag` are set (`1`) or unset (`0`).
43+
"""
3444
isset(val::Integer, flag::Integer) = (val & flag == flag)
45+
46+
"""
47+
reset(val::Integer, flag::Integer)
48+
49+
Unset the bits of `val` indexed by `flag`, returning them to `0`.
50+
"""
3551
reset(val::Integer, flag::Integer) = (val &= ~flag)
52+
53+
"""
54+
toggle(val::Integer, flag::Integer)
55+
56+
Flip the bits of `val` indexed by `flag`, so that if a bit is `0` it
57+
will be `1` after the toggle, and vice-versa.
58+
"""
3659
toggle(val::Integer, flag::Integer) = (val |= flag)
3760

61+
"""
62+
features()
63+
64+
Return a list of git features the current version of libgit2 supports, such as
65+
threading or using HTTPS or SSH.
66+
"""
3867
function features()
3968
feat = ccall((:git_libgit2_features, :libgit2), Cint, ())
4069
res = Consts.GIT_FEATURE[]

doc/src/devdocs/libgit2.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ Base.LibGit2.merge_base
8282
Base.LibGit2.merge!(::Base.LibGit2.GitRepo; ::Any...)
8383
Base.LibGit2.ffmerge!
8484
Base.LibGit2.fullname
85+
Base.LibGit2.features
8586
Base.LibGit2.get_creds!
8687
Base.LibGit2.gitdir
8788
Base.LibGit2.head
@@ -95,6 +96,7 @@ Base.LibGit2.iscommit
9596
Base.LibGit2.isdiff
9697
Base.LibGit2.isdirty
9798
Base.LibGit2.isorphan
99+
Base.LibGit2.isset
98100
Base.LibGit2.lookup_branch
99101
Base.LibGit2.map(::Function, ::Base.LibGit2.GitRevWalker; ::Base.LibGit2.GitHash, ::Cint, ::Bool)
100102
Base.LibGit2.mirror_callback
@@ -116,6 +118,7 @@ Base.LibGit2.ref_list
116118
Base.LibGit2.reftype
117119
Base.LibGit2.remotes
118120
Base.LibGit2.remove!
121+
Base.LibGit2.reset
119122
Base.LibGit2.reset!
120123
Base.LibGit2.restore
121124
Base.LibGit2.revcount
@@ -128,11 +131,13 @@ Base.LibGit2.tag_create
128131
Base.LibGit2.tag_delete
129132
Base.LibGit2.tag_list
130133
Base.LibGit2.target
134+
Base.LibGit2.toggle
131135
Base.LibGit2.transact
132136
Base.LibGit2.treewalk
133137
Base.LibGit2.upstream
134138
Base.LibGit2.update!
135139
Base.LibGit2.url
140+
Base.LibGit2.version
136141
Base.LibGit2.with
137142
Base.LibGit2.workdir
138143
```

0 commit comments

Comments
 (0)