Skip to content

Commit 527b36f

Browse files
committed
Add callback payload types
1 parent 76f808a commit 527b36f

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

docs/guides/101-samples/index.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ int error = git_clone(&repo, url, path, NULL);
7575
### Clone (Progress)
7676

7777
```c
78+
typedef struct { /**/ } progress_data;
7879
int fetch_progress(
7980
const git_transfer_progress *stats,
8081
void *payload)
@@ -94,13 +95,16 @@ void checkout_progress(
9495
}
9596

9697
/**/
98+
progress_data d = {0};
9799
git_clone_options opts = GIT_CLONE_OPTIONS_INIT;
98100
git_checkout_opts checkout_opts = GIT_CHECKOUT_OPTS_INIT;
99101

100102
checkout_opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
101103
checkout_opts.progress_cb = checkout_progress;
104+
checkout_opts.progress_payload = &d;
102105
clone_opts.checkout_opts = checkout_opts;
103106
clone_opts.remote_callbacks.transfer_progress = &fetch_progress;
107+
clone_opts.remote_callbacks.payload = &d;
104108

105109
git_repository *repo = NULL;
106110
int error = git_clone(&repo, url, path, &opts);
@@ -320,6 +324,8 @@ int error = git_diff_find_similar(diff, &opts);
320324
### Iterating Deltas
321325

322326
```c
327+
typedef struct { /**/ } diff_data;
328+
323329
int each_file_cb(const git_diff_delta *delta,
324330
float progress,
325331
void *payload)
@@ -374,6 +380,8 @@ int error = git_patch_from_diff(&patch, diff, 0);
374380
### Iterating (Simple)
375381

376382
```c
383+
typedef struct { /**/ } status_data;
384+
377385
int status_cb(const char *path,
378386
unsigned int status_flags,
379387
void *payload)
@@ -392,6 +400,8 @@ int error = git_status_foreach(repo, status_cb, &d);
392400
### Iterating (Options)
393401
394402
```c
403+
typedef struct { /* … */ } status_data;
404+
395405
int status_cb(const char *path,
396406
unsigned int status_flags,
397407
void *payload)

js/toc.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ $(function () {
55
}
66

77
// Generate the TOC contents
8-
var current_level = 0;
98
$('#primary :header[id]').each(function(i, el) {
109
var del = $(el);
1110
console.log(el);

0 commit comments

Comments
 (0)