Skip to content

Commit 182336d

Browse files
committed
Docs for libgit2 utils
1 parent 9b3b2ff commit 182336d

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
@@ -79,6 +79,7 @@ Base.LibGit2.merge_base
7979
Base.LibGit2.merge!(::Base.LibGit2.GitRepo; ::Any...)
8080
Base.LibGit2.ffmerge!
8181
Base.LibGit2.fullname
82+
Base.LibGit2.features
8283
Base.LibGit2.get_creds!
8384
Base.LibGit2.gitdir
8485
Base.LibGit2.head
@@ -92,6 +93,7 @@ Base.LibGit2.iscommit
9293
Base.LibGit2.isdiff
9394
Base.LibGit2.isdirty
9495
Base.LibGit2.isorphan
96+
Base.LibGit2.isset
9597
Base.LibGit2.lookup_branch
9698
Base.LibGit2.map(::Function, ::Base.LibGit2.GitRevWalker; ::Base.LibGit2.GitHash, ::Cint, ::Bool)
9799
Base.LibGit2.mirror_callback
@@ -113,6 +115,7 @@ Base.LibGit2.ref_list
113115
Base.LibGit2.reftype
114116
Base.LibGit2.remotes
115117
Base.LibGit2.remove!
118+
Base.LibGit2.reset
116119
Base.LibGit2.reset!
117120
Base.LibGit2.restore
118121
Base.LibGit2.revcount
@@ -125,11 +128,13 @@ Base.LibGit2.tag_create
125128
Base.LibGit2.tag_delete
126129
Base.LibGit2.tag_list
127130
Base.LibGit2.target
131+
Base.LibGit2.toggle
128132
Base.LibGit2.transact
129133
Base.LibGit2.treewalk
130134
Base.LibGit2.upstream
131135
Base.LibGit2.update!
132136
Base.LibGit2.url
137+
Base.LibGit2.version
133138
Base.LibGit2.with
134139
Base.LibGit2.workdir
135140
```

0 commit comments

Comments
 (0)