@@ -75,6 +75,7 @@ int error = git_clone(&repo, url, path, NULL);
75
75
### Clone (Progress)
76
76
77
77
``` c
78
+ typedef struct { /* … * / } progress_data;
78
79
int fetch_progress(
79
80
const git_transfer_progress * stats,
80
81
void * payload)
@@ -94,13 +95,16 @@ void checkout_progress(
94
95
}
95
96
96
97
/* … * /
98
+ progress_data d = {0};
97
99
git_clone_options opts = GIT_CLONE_OPTIONS_INIT;
98
100
git_checkout_opts checkout_opts = GIT_CHECKOUT_OPTS_INIT;
99
101
100
102
checkout_opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
101
103
checkout_opts.progress_cb = checkout_progress;
104
+ checkout_opts.progress_payload = &d;
102
105
clone_opts.checkout_opts = checkout_opts;
103
106
clone_opts.remote_callbacks.transfer_progress = &fetch_progress;
107
+ clone_opts.remote_callbacks.payload = &d;
104
108
105
109
git_repository * repo = NULL;
106
110
int error = git_clone(&repo, url, path, &opts);
@@ -320,6 +324,8 @@ int error = git_diff_find_similar(diff, &opts);
320
324
### Iterating Deltas
321
325
322
326
``` c
327
+ typedef struct { /* … * / } diff_data;
328
+
323
329
int each_file_cb(const git_diff_delta * delta,
324
330
float progress,
325
331
void * payload)
@@ -374,6 +380,8 @@ int error = git_patch_from_diff(&patch, diff, 0);
374
380
### Iterating (Simple)
375
381
376
382
``` c
383
+ typedef struct { /* … * / } status_data;
384
+
377
385
int status_cb(const char * path,
378
386
unsigned int status_flags,
379
387
void * payload)
@@ -392,6 +400,8 @@ int error = git_status_foreach(repo, status_cb, &d);
392
400
### Iterating (Options)
393
401
394
402
```c
403
+ typedef struct { /* … */ } status_data;
404
+
395
405
int status_cb(const char *path,
396
406
unsigned int status_flags,
397
407
void *payload)
0 commit comments