diff options
author | Christian Hesse | 2016-09-04 12:38:18 +0200 |
---|---|---|
committer | Christian Hesse | 2016-09-04 12:38:18 +0200 |
commit | 11695a58fd732689be486edf88d145578a787c89 (patch) | |
tree | ab397b8346d89a01ecc1d99350e81f1bd7cbe7a4 /shared.c | |
parent | ff9893ac8192579a00dd4c73ddff18ab232099a6 (diff) | |
download | cgit-11695a58fd732689be486edf88d145578a787c89.tar.gz cgit-11695a58fd732689be486edf88d145578a787c89.tar.bz2 cgit-11695a58fd732689be486edf88d145578a787c89.zip |
git: update to v2.10.0
Upstream continues to replace unsigned char *sha1 with struct
object_id old_oid. This makes the required changes.
The git lib has its own main function now. Rename our main function
to cmd_main, it is called from main then.
Diffstat (limited to 'shared.c')
-rw-r--r-- | shared.c | 28 |
1 files changed, 14 insertions, 14 deletions
@@ -263,15 +263,15 @@ void cgit_diff_tree_cb(struct diff_queue_struct *q, | |||
263 | } | 263 | } |
264 | } | 264 | } |
265 | 265 | ||
266 | static int load_mmfile(mmfile_t *file, const unsigned char *sha1) | 266 | static int load_mmfile(mmfile_t *file, const struct object_id *oid) |
267 | { | 267 | { |
268 | enum object_type type; | 268 | enum object_type type; |
269 | 269 | ||
270 | if (is_null_sha1(sha1)) { | 270 | if (is_null_oid(oid)) { |
271 | file->ptr = (char *)""; | 271 | file->ptr = (char *)""; |
272 | file->size = 0; | 272 | file->size = 0; |
273 | } else { | 273 | } else { |
274 | file->ptr = read_sha1_file(sha1, &type, | 274 | file->ptr = read_sha1_file(oid->hash, &type, |
275 | (unsigned long *)&file->size); | 275 | (unsigned long *)&file->size); |
276 | } | 276 | } |
277 | return 1; | 277 | return 1; |
@@ -322,8 +322,8 @@ static int filediff_cb(void *priv, mmbuffer_t *mb, int nbuf) | |||
322 | return 0; | 322 | return 0; |
323 | } | 323 | } |
324 | 324 | ||
325 | int cgit_diff_files(const unsigned char *old_sha1, | 325 | int cgit_diff_files(const struct object_id *old_oid, |
326 | const unsigned char *new_sha1, unsigned long *old_size, | 326 | const struct object_id *new_oid, unsigned long *old_size, |
327 | unsigned long *new_size, int *binary, int context, | 327 | unsigned long *new_size, int *binary, int context, |
328 | int ignorews, linediff_fn fn) | 328 | int ignorews, linediff_fn fn) |
329 | { | 329 | { |
@@ -332,7 +332,7 @@ int cgit_diff_files(const unsigned char *old_sha1, | |||
332 | xdemitconf_t emit_params; | 332 | xdemitconf_t emit_params; |
333 | xdemitcb_t emit_cb; | 333 | xdemitcb_t emit_cb; |
334 | 334 | ||
335 | if (!load_mmfile(&file1, old_sha1) || !load_mmfile(&file2, new_sha1)) | 335 | if (!load_mmfile(&file1, old_oid) || !load_mmfile(&file2, new_oid)) |
336 | return 1; | 336 | return 1; |
337 | 337 | ||
338 | *old_size = file1.size; | 338 | *old_size = file1.size; |
@@ -366,8 +366,8 @@ int cgit_diff_files(const unsigned char *old_sha1, | |||
366 | return 0; | 366 | return 0; |
367 | } | 367 | } |
368 | 368 | ||
369 | void cgit_diff_tree(const unsigned char *old_sha1, | 369 | void cgit_diff_tree(const struct object_id *old_oid, |
370 | const unsigned char *new_sha1, | 370 | const struct object_id *new_oid, |
371 | filepair_fn fn, const char *prefix, int ignorews) | 371 | filepair_fn fn, const char *prefix, int ignorews) |
372 | { | 372 | { |
373 | struct diff_options opt; | 373 | struct diff_options opt; |
@@ -391,21 +391,21 @@ void cgit_diff_tree(const unsigned char *old_sha1, | |||
391 | } | 391 | } |
392 | diff_setup_done(&opt); | 392 | diff_setup_done(&opt); |
393 | 393 | ||
394 | if (old_sha1 && !is_null_sha1(old_sha1)) | 394 | if (old_oid && !is_null_oid(old_oid)) |
395 | diff_tree_sha1(old_sha1, new_sha1, "", &opt); | 395 | diff_tree_sha1(old_oid->hash, new_oid->hash, "", &opt); |
396 | else | 396 | else |
397 | diff_root_tree_sha1(new_sha1, "", &opt); | 397 | diff_root_tree_sha1(new_oid->hash, "", &opt); |
398 | diffcore_std(&opt); | 398 | diffcore_std(&opt); |
399 | diff_flush(&opt); | 399 | diff_flush(&opt); |
400 | } | 400 | } |
401 | 401 | ||
402 | void cgit_diff_commit(struct commit *commit, filepair_fn fn, const char *prefix) | 402 | void cgit_diff_commit(struct commit *commit, filepair_fn fn, const char *prefix) |
403 | { | 403 | { |
404 | unsigned char *old_sha1 = NULL; | 404 | const struct object_id *old_oid = NULL; |
405 | 405 | ||
406 | if (commit->parents) | 406 | if (commit->parents) |
407 | old_sha1 = commit->parents->item->object.oid.hash; | 407 | old_oid = &commit->parents->item->object.oid; |
408 | cgit_diff_tree(old_sha1, commit->object.oid.hash, fn, prefix, | 408 | cgit_diff_tree(old_oid, &commit->object.oid, fn, prefix, |
409 | ctx.qry.ignorews); | 409 | ctx.qry.ignorews); |
410 | } | 410 | } |
411 | 411 | ||