rugged 0.23.0b1 → 0.23.0b2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/ext/rugged/rugged_note.c +7 -2
  3. data/ext/rugged/rugged_revwalk.c +321 -145
  4. data/lib/rugged/version.rb +1 -1
  5. data/vendor/libgit2/CMakeLists.txt +83 -8
  6. data/vendor/libgit2/cmake/Modules/FindCoreFoundation.cmake +9 -0
  7. data/vendor/libgit2/cmake/Modules/FindIconv.cmake +0 -3
  8. data/vendor/libgit2/cmake/Modules/FindSecurity.cmake +9 -0
  9. data/vendor/libgit2/deps/winhttp/urlmon.h +45 -0
  10. data/vendor/libgit2/deps/winhttp/winhttp.def +29 -0
  11. data/vendor/libgit2/deps/winhttp/winhttp.h +592 -0
  12. data/vendor/libgit2/deps/winhttp/winhttp64.def +29 -0
  13. data/vendor/libgit2/include/git2/diff.h +6 -1
  14. data/vendor/libgit2/include/git2/index.h +1 -1
  15. data/vendor/libgit2/include/git2/merge.h +2 -1
  16. data/vendor/libgit2/include/git2/notes.h +2 -2
  17. data/vendor/libgit2/include/git2/pack.h +12 -0
  18. data/vendor/libgit2/include/git2/push.h +30 -0
  19. data/vendor/libgit2/include/git2/rebase.h +36 -16
  20. data/vendor/libgit2/include/git2/remote.h +6 -0
  21. data/vendor/libgit2/include/git2/reset.h +2 -2
  22. data/vendor/libgit2/include/git2/revwalk.h +10 -8
  23. data/vendor/libgit2/include/git2/submodule.h +16 -0
  24. data/vendor/libgit2/include/git2/sys/transport.h +12 -4
  25. data/vendor/libgit2/include/git2/types.h +1 -0
  26. data/vendor/libgit2/src/attr.c +3 -3
  27. data/vendor/libgit2/src/attr_file.c +24 -3
  28. data/vendor/libgit2/src/attr_file.h +3 -1
  29. data/vendor/libgit2/src/checkout.c +31 -7
  30. data/vendor/libgit2/src/config.c +5 -6
  31. data/vendor/libgit2/src/config_file.c +533 -469
  32. data/vendor/libgit2/src/describe.c +1 -1
  33. data/vendor/libgit2/src/diff.c +20 -10
  34. data/vendor/libgit2/src/diff_driver.c +1 -1
  35. data/vendor/libgit2/src/diff_tform.c +8 -2
  36. data/vendor/libgit2/src/filter.c +6 -3
  37. data/vendor/libgit2/src/global.c +17 -15
  38. data/vendor/libgit2/src/global.h +3 -1
  39. data/vendor/libgit2/src/ignore.c +48 -8
  40. data/vendor/libgit2/src/ignore.h +1 -1
  41. data/vendor/libgit2/src/index.c +12 -8
  42. data/vendor/libgit2/src/iterator.c +133 -12
  43. data/vendor/libgit2/src/netops.h +2 -2
  44. data/vendor/libgit2/src/notes.c +40 -21
  45. data/vendor/libgit2/src/openssl_stream.c +5 -1
  46. data/vendor/libgit2/src/pack-objects.c +36 -0
  47. data/vendor/libgit2/src/path.c +277 -140
  48. data/vendor/libgit2/src/path.h +132 -60
  49. data/vendor/libgit2/src/posix.h +0 -1
  50. data/vendor/libgit2/src/push.c +43 -4
  51. data/vendor/libgit2/src/push.h +8 -1
  52. data/vendor/libgit2/src/rebase.c +139 -119
  53. data/vendor/libgit2/src/reflog.c +1 -1
  54. data/vendor/libgit2/src/refs.c +3 -5
  55. data/vendor/libgit2/src/remote.c +6 -5
  56. data/vendor/libgit2/src/repository.c +7 -3
  57. data/vendor/libgit2/src/reset.c +3 -3
  58. data/vendor/libgit2/src/revwalk.c +26 -2
  59. data/vendor/libgit2/src/settings.c +3 -3
  60. data/vendor/libgit2/src/stransport_stream.c +249 -0
  61. data/vendor/libgit2/src/stransport_stream.h +14 -0
  62. data/vendor/libgit2/src/submodule.c +26 -2
  63. data/vendor/libgit2/src/tls_stream.c +28 -0
  64. data/vendor/libgit2/src/tls_stream.h +21 -0
  65. data/vendor/libgit2/src/transport.c +4 -4
  66. data/vendor/libgit2/src/transports/git.c +4 -1
  67. data/vendor/libgit2/src/transports/http.c +6 -4
  68. data/vendor/libgit2/src/transports/local.c +2 -1
  69. data/vendor/libgit2/src/transports/smart.c +1 -1
  70. data/vendor/libgit2/src/transports/ssh.c +5 -1
  71. data/vendor/libgit2/src/transports/winhttp.c +30 -23
  72. data/vendor/libgit2/src/tree.c +2 -2
  73. data/vendor/libgit2/src/unix/posix.h +1 -0
  74. data/vendor/libgit2/src/util.h +117 -0
  75. data/vendor/libgit2/src/win32/buffer.c +55 -0
  76. data/vendor/libgit2/src/win32/buffer.h +18 -0
  77. data/vendor/libgit2/src/win32/path_w32.c +75 -0
  78. data/vendor/libgit2/src/win32/path_w32.h +3 -0
  79. data/vendor/libgit2/src/win32/posix.h +2 -2
  80. data/vendor/libgit2/src/win32/posix_w32.c +2 -118
  81. data/vendor/libgit2/src/win32/pthread.c +2 -0
  82. data/vendor/libgit2/src/win32/utf-conv.c +0 -4
  83. data/vendor/libgit2/src/win32/utf-conv.h +4 -0
  84. data/vendor/libgit2/src/win32/w32_util.h +72 -0
  85. metadata +14 -2
@@ -388,7 +388,7 @@ cleanup:
388
388
  return error;
389
389
  }
390
390
 
391
- static int note_get_default_ref(const char **out, git_repository *repo)
391
+ static int note_get_default_ref(char **out, git_repository *repo)
392
392
  {
393
393
  git_config *cfg;
394
394
  int ret = git_repository_config__weakptr(&cfg, repo);
@@ -399,27 +399,31 @@ static int note_get_default_ref(const char **out, git_repository *repo)
399
399
  return ret;
400
400
  }
401
401
 
402
- static int normalize_namespace(const char **notes_ref, git_repository *repo)
402
+ static int normalize_namespace(char **out, git_repository *repo, const char *notes_ref)
403
403
  {
404
- if (*notes_ref)
404
+ if (notes_ref) {
405
+ *out = git__strdup(notes_ref);
406
+ GITERR_CHECK_ALLOC(*out);
405
407
  return 0;
408
+ }
406
409
 
407
- return note_get_default_ref(notes_ref, repo);
410
+ return note_get_default_ref(out, repo);
408
411
  }
409
412
 
410
413
  static int retrieve_note_tree_and_commit(
411
414
  git_tree **tree_out,
412
415
  git_commit **commit_out,
416
+ char **notes_ref_out,
413
417
  git_repository *repo,
414
- const char **notes_ref)
418
+ const char *notes_ref)
415
419
  {
416
420
  int error;
417
421
  git_oid oid;
418
422
 
419
- if ((error = normalize_namespace(notes_ref, repo)) < 0)
423
+ if ((error = normalize_namespace(notes_ref_out, repo, notes_ref)) < 0)
420
424
  return error;
421
425
 
422
- if ((error = git_reference_name_to_id(&oid, repo, *notes_ref)) < 0)
426
+ if ((error = git_reference_name_to_id(&oid, repo, *notes_ref_out)) < 0)
423
427
  return error;
424
428
 
425
429
  if (git_commit_lookup(commit_out, repo, &oid) < 0)
@@ -432,10 +436,10 @@ static int retrieve_note_tree_and_commit(
432
436
  }
433
437
 
434
438
  int git_note_read(git_note **out, git_repository *repo,
435
- const char *notes_ref, const git_oid *oid)
439
+ const char *notes_ref_in, const git_oid *oid)
436
440
  {
437
441
  int error;
438
- char *target = NULL;
442
+ char *target = NULL, *notes_ref = NULL;
439
443
  git_tree *tree = NULL;
440
444
  git_commit *commit = NULL;
441
445
 
@@ -443,9 +447,10 @@ int git_note_read(git_note **out, git_repository *repo,
443
447
  GITERR_CHECK_ALLOC(target);
444
448
 
445
449
  if (!(error = retrieve_note_tree_and_commit(
446
- &tree, &commit, repo, &notes_ref)))
450
+ &tree, &commit, &notes_ref, repo, notes_ref_in)))
447
451
  error = note_lookup(out, repo, commit, tree, target);
448
452
 
453
+ git__free(notes_ref);
449
454
  git__free(target);
450
455
  git_tree_free(tree);
451
456
  git_commit_free(commit);
@@ -455,7 +460,7 @@ int git_note_read(git_note **out, git_repository *repo,
455
460
  int git_note_create(
456
461
  git_oid *out,
457
462
  git_repository *repo,
458
- const char *notes_ref,
463
+ const char *notes_ref_in,
459
464
  const git_signature *author,
460
465
  const git_signature *committer,
461
466
  const git_oid *oid,
@@ -463,14 +468,14 @@ int git_note_create(
463
468
  int allow_note_overwrite)
464
469
  {
465
470
  int error;
466
- char *target = NULL;
471
+ char *target = NULL, *notes_ref = NULL;
467
472
  git_commit *commit = NULL;
468
473
  git_tree *tree = NULL;
469
474
 
470
475
  target = git_oid_allocfmt(oid);
471
476
  GITERR_CHECK_ALLOC(target);
472
477
 
473
- error = retrieve_note_tree_and_commit(&tree, &commit, repo, &notes_ref);
478
+ error = retrieve_note_tree_and_commit(&tree, &commit, &notes_ref, repo, notes_ref_in);
474
479
 
475
480
  if (error < 0 && error != GIT_ENOTFOUND)
476
481
  goto cleanup;
@@ -479,18 +484,19 @@ int git_note_create(
479
484
  note, tree, target, &commit, allow_note_overwrite);
480
485
 
481
486
  cleanup:
487
+ git__free(notes_ref);
482
488
  git__free(target);
483
489
  git_commit_free(commit);
484
490
  git_tree_free(tree);
485
491
  return error;
486
492
  }
487
493
 
488
- int git_note_remove(git_repository *repo, const char *notes_ref,
494
+ int git_note_remove(git_repository *repo, const char *notes_ref_in,
489
495
  const git_signature *author, const git_signature *committer,
490
496
  const git_oid *oid)
491
497
  {
492
498
  int error;
493
- char *target = NULL;
499
+ char *target = NULL, *notes_ref;
494
500
  git_commit *commit = NULL;
495
501
  git_tree *tree = NULL;
496
502
 
@@ -498,20 +504,31 @@ int git_note_remove(git_repository *repo, const char *notes_ref,
498
504
  GITERR_CHECK_ALLOC(target);
499
505
 
500
506
  if (!(error = retrieve_note_tree_and_commit(
501
- &tree, &commit, repo, &notes_ref)))
507
+ &tree, &commit, &notes_ref, repo, notes_ref_in)))
502
508
  error = note_remove(
503
509
  repo, author, committer, notes_ref, tree, target, &commit);
504
510
 
511
+ git__free(notes_ref);
505
512
  git__free(target);
506
513
  git_commit_free(commit);
507
514
  git_tree_free(tree);
508
515
  return error;
509
516
  }
510
517
 
511
- int git_note_default_ref(const char **out, git_repository *repo)
518
+ int git_note_default_ref(git_buf *out, git_repository *repo)
512
519
  {
513
- assert(repo);
514
- return note_get_default_ref(out, repo);
520
+ char *default_ref;
521
+ int error;
522
+
523
+ assert(out && repo);
524
+
525
+ git_buf_sanitize(out);
526
+
527
+ if ((error = note_get_default_ref(&default_ref, repo)) < 0)
528
+ return error;
529
+
530
+ git_buf_attach(out, default_ref, strlen(default_ref));
531
+ return 0;
515
532
  }
516
533
 
517
534
  const git_signature *git_note_committer(const git_note *note)
@@ -635,13 +652,14 @@ void git_note_iterator_free(git_note_iterator *it)
635
652
  int git_note_iterator_new(
636
653
  git_note_iterator **it,
637
654
  git_repository *repo,
638
- const char *notes_ref)
655
+ const char *notes_ref_in)
639
656
  {
640
657
  int error;
641
658
  git_commit *commit = NULL;
642
659
  git_tree *tree = NULL;
660
+ char *notes_ref;
643
661
 
644
- error = retrieve_note_tree_and_commit(&tree, &commit, repo, &notes_ref);
662
+ error = retrieve_note_tree_and_commit(&tree, &commit, &notes_ref, repo, notes_ref_in);
645
663
  if (error < 0)
646
664
  goto cleanup;
647
665
 
@@ -649,6 +667,7 @@ int git_note_iterator_new(
649
667
  git_iterator_free(*it);
650
668
 
651
669
  cleanup:
670
+ git__free(notes_ref);
652
671
  git_tree_free(tree);
653
672
  git_commit_free(commit);
654
673
 
@@ -5,7 +5,7 @@
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
7
 
8
- #ifdef GIT_SSL
8
+ #ifdef GIT_OPENSSL
9
9
 
10
10
  #include <ctype.h>
11
11
 
@@ -374,6 +374,10 @@ int git_openssl_stream_new(git_stream **out, const char *host, const char *port)
374
374
 
375
375
  int git_openssl_stream_new(git_stream **out, const char *host, const char *port)
376
376
  {
377
+ GIT_UNUSED(out);
378
+ GIT_UNUSED(host);
379
+ GIT_UNUSED(port);
380
+
377
381
  giterr_set(GITERR_SSL, "openssl is not supported in this version");
378
382
  return -1;
379
383
  }
@@ -1404,6 +1404,42 @@ int git_packbuilder_insert_tree(git_packbuilder *pb, const git_oid *oid)
1404
1404
  return error;
1405
1405
  }
1406
1406
 
1407
+ int git_packbuilder_insert_recur(git_packbuilder *pb, const git_oid *id, const char *name)
1408
+ {
1409
+ git_object *obj;
1410
+ int error;
1411
+
1412
+ assert(pb && id);
1413
+
1414
+ if ((error = git_object_lookup(&obj, pb->repo, id, GIT_OBJ_ANY)) < 0)
1415
+ return error;
1416
+
1417
+ switch (git_object_type(obj)) {
1418
+ case GIT_OBJ_BLOB:
1419
+ error = git_packbuilder_insert(pb, id, name);
1420
+ break;
1421
+ case GIT_OBJ_TREE:
1422
+ error = git_packbuilder_insert_tree(pb, id);
1423
+ break;
1424
+ case GIT_OBJ_COMMIT:
1425
+ error = git_packbuilder_insert_commit(pb, id);
1426
+ break;
1427
+ case GIT_OBJ_TAG:
1428
+ if ((error = git_packbuilder_insert(pb, id, name)) < 0)
1429
+ goto cleanup;
1430
+ error = git_packbuilder_insert_recur(pb, git_tag_target_id((git_tag *) obj), NULL);
1431
+ break;
1432
+
1433
+ default:
1434
+ giterr_set(GITERR_INVALID, "unknown object type");
1435
+ error = -1;
1436
+ }
1437
+
1438
+ cleanup:
1439
+ git_object_free(obj);
1440
+ return error;
1441
+ }
1442
+
1407
1443
  uint32_t git_packbuilder_object_count(git_packbuilder *pb)
1408
1444
  {
1409
1445
  return pb->nr_objects;