Skip to content

Commit 66d11cc

Browse files
committed
update docs for git_revwalk_next
This does not fix many preexisting documentation issues. Should have been part of libgit2-racket#1 Related to libgit2-racket#3 Closes libgit2-racket#5
1 parent e5abf8a commit 66d11cc

File tree

2 files changed

+41
-57
lines changed

2 files changed

+41
-57
lines changed

libgit2/include/revwalk.rkt

+6-5
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@
1212

1313
(define-cpointer-type _git_revwalk)
1414

15-
(define _git_sort_t
16-
(_bitmask '(GIT_SORT_NONE = 0
17-
GIT_SORT_TOPOLOGICAL = 1
18-
GIT_SORT_TIME = 2
19-
GIT_SORT_REVERSE = 4)))
15+
(define-bitmask _git_sort_t
16+
#:contract git_sort/c
17+
[GIT_SORT_NONE = 0]
18+
[GIT_SORT_TOPOLOGICAL = 1]
19+
[GIT_SORT_TIME = 2]
20+
[GIT_SORT_REVERSE = 4])
2021

2122
(define _git_revwalk_hide_cb
2223
(_fun _git_oid-pointer _bytes -> _int))

libgit2/scribblings/revwalk.scrbl

+35-52
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,28 @@
11
#lang scribble/manual
22

3-
@(require (for-label racket))
3+
@(require (for-label racket libgit2)
4+
"doc.rkt")
45

56
@title{Revwalk}
67

7-
@defmodule[libgit2/include/revwalk]
8+
@defmodule-lg2[libgit2/include/revwalk]
89

910

10-
@defproc[(git_revwalk_add_hide_cb
11-
[walk revwalk?]
12-
[hide_cb git_revwalk_hide_cb]
13-
[payload bytes?])
11+
@defproc[(git_revwalk_add_hide_cb [walk revwalk?]
12+
[hide_cb git_revwalk_hide_cb]
13+
[payload bytes?])
1414
integer?]{
1515
Adds a callback function to hide a commit and its parents
1616

1717
}
1818

19-
@defproc[(git_revwalk_free
20-
[walk revwalk?])
19+
@defproc[(git_revwalk_free [walk revwalk?])
2120
void?]{
2221
Free a revision walker previously allocated.
2322

2423
}
2524

26-
@defproc[(git_revwalk_hide
27-
[walk revwalk?]
28-
[commit_id oid?])
25+
@defproc[(git_revwalk_hide [walk revwalk?] [commit_id oid?])
2926
integer?]{
3027
Mark a commit (and its ancestors) uninteresting for the output.
3128

@@ -35,9 +32,7 @@
3532

3633
}
3734

38-
@defproc[(git_revwalk_hide_glob
39-
[walk revwalk?]
40-
[glob string?])
35+
@defproc[(git_revwalk_hide_glob [walk revwalk?] [glob string?])
4136
integer?]{
4237
Hide matching references.
4338

@@ -49,25 +44,21 @@
4944

5045
}
5146

52-
@defproc[(git_revwalk_hide_head
53-
[walk revwalk?])
47+
@defproc[(git_revwalk_hide_head [walk revwalk?])
5448
integer?]{
5549
Hide the repository's HEAD
5650

5751
}
5852

59-
@defproc[(git_revwalk_hide_ref
60-
[walk revwalk?]
61-
[refname string?])
53+
@defproc[(git_revwalk_hide_ref [walk revwalk?] [refname string?])
6254
integer?]{
6355
Hide the OID pointed to by a reference
6456

6557
The reference must point to a committish.
6658

6759
}
6860

69-
@defproc[(git_revwalk_new
70-
[repo repository?])
61+
@defproc[(git_revwalk_new [repo repository?])
7162
revwalk?]{
7263
Allocate a new revision walker to iterate through a repo.
7364

@@ -79,23 +70,25 @@
7970

8071
}
8172

82-
@defproc[(git_revwalk_next
83-
[out oid?]
84-
[walk revwalk?])
85-
integer?]{
86-
Get the next commit from the revision walk.
73+
@defproc[(git_revwalk_next [walk revwalk?])
74+
(or/c oid? #f)]{
75+
Pops the next commit from @racket[walk], or, there are no
76+
more commits, returns @racket[#f]
8777

88-
The initial call to this method is not blocking when iterating through a repo with a time-sorting mode.
78+
The initial call to this method is not blocking when
79+
iterating through a repo with a time-sorting mode.
8980

90-
Iterating with Topological or inverted modes makes the initial call blocking to preprocess the commit list, but this block should be mostly unnoticeable on most repositories (topological preprocessing times at 0.3s on the git.git repo).
81+
Iterating with Topological or inverted modes makes the
82+
initial call blocking to preprocess the commit list, but
83+
this block should be mostly unnoticeable on most
84+
repositories (topological preprocessing times at 0.3s on the
85+
git.git repo).
9186

9287
The revision walker is reset when the walk is over.
9388

9489
}
9590

96-
@defproc[(git_revwalk_push
97-
[walk revwalk?]
98-
[id oid?])
91+
@defproc[(git_revwalk_push [walk revwalk?] [id oid?])
9992
integer?]{
10093
Add a new root for the traversal
10194

@@ -107,9 +100,7 @@
107100

108101
}
109102

110-
@defproc[(git_revwalk_push_glob
111-
[walk revwalk?]
112-
[glob string?])
103+
@defproc[(git_revwalk_push_glob [walk revwalk?] [glob string?])
113104
integer?]{
114105
Push matching references
115106

@@ -121,42 +112,35 @@
121112

122113
}
123114

124-
@defproc[(git_revwalk_push_head
125-
[walk revwalk?])
115+
@defproc[(git_revwalk_push_head [walk revwalk?])
126116
integer?]{
127117
Push the repository's HEAD
128118

129119
}
130120

131-
@defproc[(git_revwalk_push_range
132-
[walk revwalk?]
133-
[range string?])
121+
@defproc[(git_revwalk_push_range [walk revwalk?] [range string?])
134122
integer?]{
135123
Push and hide the respective endpoints of the given range.
136124

137125
The range should be of the form .. where each is in the form accepted by 'git_revparse_single'. The left-hand commit will be hidden and the right-hand commit pushed.
138126

139127
}
140128

141-
@defproc[(git_revwalk_push_ref
142-
[walk revwalk?]
143-
[refname string?])
129+
@defproc[(git_revwalk_push_ref [walk revwalk?] [refname string?])
144130
integer?]{
145131
Push the OID pointed to by a reference
146132

147133
The reference must point to a committish.
148134

149135
}
150136

151-
@defproc[(git_revwalk_repository
152-
[walk revwalk?])
137+
@defproc[(git_revwalk_repository [walk revwalk?])
153138
repository?]{
154139
Return the repository on which this walker is operating.
155140

156141
}
157142

158-
@defproc[(git_revwalk_reset
159-
[walker revwalk?])
143+
@defproc[(git_revwalk_reset [walker revwalk?])
160144
void?]{
161145
Reset the revision walker for reuse.
162146

@@ -166,19 +150,18 @@
166150

167151
}
168152

169-
@defproc[(git_revwalk_simplify_first_parent
170-
[walk revwalk?])
153+
@defproc[(git_revwalk_simplify_first_parent [walk revwalk?])
171154
void?]{
172155
Simplify the history by first-parent
173156

174157
No parents other than the first for each commit will be enqueued.
175158

176159
}
177160

178-
@defproc[(git_revwalk_sorting
179-
[walk revwalk?]
180-
[sort_mode _git_sort_t])
181-
void?]{
161+
@deftogether[
162+
(@defproc[(git_revwalk_sorting [walk revwalk?] [sort_mode git_sort/c])
163+
void?]
164+
@defthing[git_sort/c flat-contract?])]{
182165
Change the sorting mode when iterating through the repository's contents.
183166

184167
Changing the sorting mode resets the walker.

0 commit comments

Comments
 (0)