rugged 0.25.0b2 → 0.25.0b3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/ext/rugged/extconf.rb +3 -1
  4. data/ext/rugged/rugged.c +1 -1
  5. data/ext/rugged/rugged.h +1 -1
  6. data/ext/rugged/rugged_blob.c +29 -38
  7. data/ext/rugged/rugged_commit.c +215 -78
  8. data/ext/rugged/rugged_rebase.c +18 -11
  9. data/ext/rugged/rugged_remote.c +2 -2
  10. data/ext/rugged/rugged_tree.c +132 -0
  11. data/lib/rugged/version.rb +1 -1
  12. data/vendor/libgit2/CMakeLists.txt +11 -3
  13. data/vendor/libgit2/include/git2.h +1 -0
  14. data/vendor/libgit2/include/git2/blob.h +39 -28
  15. data/vendor/libgit2/include/git2/commit.h +30 -0
  16. data/vendor/libgit2/include/git2/common.h +16 -1
  17. data/vendor/libgit2/include/git2/merge.h +10 -1
  18. data/vendor/libgit2/include/git2/proxy.h +92 -0
  19. data/vendor/libgit2/include/git2/refs.h +11 -0
  20. data/vendor/libgit2/include/git2/remote.h +17 -4
  21. data/vendor/libgit2/include/git2/signature.h +13 -0
  22. data/vendor/libgit2/include/git2/sys/merge.h +177 -0
  23. data/vendor/libgit2/include/git2/sys/remote.h +16 -0
  24. data/vendor/libgit2/include/git2/sys/stream.h +2 -1
  25. data/vendor/libgit2/include/git2/sys/transport.h +3 -1
  26. data/vendor/libgit2/include/git2/tag.h +9 -0
  27. data/vendor/libgit2/include/git2/tree.h +55 -0
  28. data/vendor/libgit2/src/annotated_commit.c +99 -80
  29. data/vendor/libgit2/src/annotated_commit.h +5 -2
  30. data/vendor/libgit2/src/array.h +40 -0
  31. data/vendor/libgit2/src/blame.c +8 -3
  32. data/vendor/libgit2/src/blame_git.c +2 -1
  33. data/vendor/libgit2/src/blob.c +71 -39
  34. data/vendor/libgit2/src/branch.c +2 -1
  35. data/vendor/libgit2/src/checkout.c +66 -42
  36. data/vendor/libgit2/src/commit.c +67 -3
  37. data/vendor/libgit2/src/config_cache.c +2 -1
  38. data/vendor/libgit2/src/config_file.c +32 -27
  39. data/vendor/libgit2/src/curl_stream.c +89 -6
  40. data/vendor/libgit2/src/delta-apply.c +36 -5
  41. data/vendor/libgit2/src/delta-apply.h +12 -0
  42. data/vendor/libgit2/src/describe.c +3 -2
  43. data/vendor/libgit2/src/diff.c +13 -20
  44. data/vendor/libgit2/src/diff_tform.c +5 -3
  45. data/vendor/libgit2/src/filebuf.c +12 -2
  46. data/vendor/libgit2/src/filebuf.h +1 -0
  47. data/vendor/libgit2/src/fnmatch.c +18 -5
  48. data/vendor/libgit2/src/global.c +18 -0
  49. data/vendor/libgit2/src/global.h +1 -0
  50. data/vendor/libgit2/src/ignore.c +11 -3
  51. data/vendor/libgit2/src/index.c +11 -5
  52. data/vendor/libgit2/src/indexer.c +11 -7
  53. data/vendor/libgit2/src/iterator.c +1575 -1468
  54. data/vendor/libgit2/src/iterator.h +52 -69
  55. data/vendor/libgit2/src/merge.c +160 -63
  56. data/vendor/libgit2/src/merge.h +61 -2
  57. data/vendor/libgit2/src/merge_driver.c +397 -0
  58. data/vendor/libgit2/src/merge_driver.h +60 -0
  59. data/vendor/libgit2/src/merge_file.c +11 -49
  60. data/vendor/libgit2/src/netops.c +12 -10
  61. data/vendor/libgit2/src/object.c +3 -6
  62. data/vendor/libgit2/src/object_api.c +19 -1
  63. data/vendor/libgit2/src/odb_loose.c +1 -1
  64. data/vendor/libgit2/src/openssl_stream.c +16 -3
  65. data/vendor/libgit2/src/pack-objects.c +3 -1
  66. data/vendor/libgit2/src/pack.c +5 -9
  67. data/vendor/libgit2/src/path.c +14 -0
  68. data/vendor/libgit2/src/path.h +12 -0
  69. data/vendor/libgit2/src/pathspec.c +1 -1
  70. data/vendor/libgit2/src/posix.c +7 -0
  71. data/vendor/libgit2/src/posix.h +1 -0
  72. data/vendor/libgit2/src/proxy.c +32 -0
  73. data/vendor/libgit2/src/proxy.h +14 -0
  74. data/vendor/libgit2/src/push.c +7 -7
  75. data/vendor/libgit2/src/rebase.c +61 -31
  76. data/vendor/libgit2/src/refdb_fs.c +1 -0
  77. data/vendor/libgit2/src/refs.c +16 -1
  78. data/vendor/libgit2/src/remote.c +20 -6
  79. data/vendor/libgit2/src/repository.c +1 -1
  80. data/vendor/libgit2/src/reset.c +1 -1
  81. data/vendor/libgit2/src/settings.c +23 -1
  82. data/vendor/libgit2/src/signature.c +26 -1
  83. data/vendor/libgit2/src/stransport_stream.c +5 -2
  84. data/vendor/libgit2/src/stream.h +2 -2
  85. data/vendor/libgit2/src/submodule.c +3 -2
  86. data/vendor/libgit2/src/tag.c +8 -2
  87. data/vendor/libgit2/src/transports/http.c +32 -9
  88. data/vendor/libgit2/src/transports/local.c +4 -1
  89. data/vendor/libgit2/src/transports/smart.c +6 -0
  90. data/vendor/libgit2/src/transports/smart.h +1 -0
  91. data/vendor/libgit2/src/transports/smart_protocol.c +61 -17
  92. data/vendor/libgit2/src/transports/winhttp.c +130 -11
  93. data/vendor/libgit2/src/tree.c +329 -98
  94. data/vendor/libgit2/src/tree.h +4 -5
  95. data/vendor/libgit2/src/unix/map.c +5 -0
  96. data/vendor/libgit2/src/win32/map.c +24 -5
  97. data/vendor/libgit2/src/xdiff/xprepare.c +2 -1
  98. metadata +10 -4
  99. data/vendor/libgit2/Makefile.embed +0 -60
@@ -0,0 +1,32 @@
1
+ /*
2
+ * Copyright (C) the libgit2 contributors. All rights reserved.
3
+ *
4
+ * This file is part of libgit2, distributed under the GNU GPL v2 with
5
+ * a Linking Exception. For full terms see the included COPYING file.
6
+ */
7
+
8
+ #include "common.h"
9
+ #include "git2/proxy.h"
10
+
11
+ int git_proxy_init_options(git_proxy_options *opts, unsigned int version)
12
+ {
13
+ GIT_INIT_STRUCTURE_FROM_TEMPLATE(
14
+ opts, version, git_proxy_options, GIT_PROXY_OPTIONS_INIT);
15
+ return 0;
16
+ }
17
+
18
+ int git_proxy_options_dup(git_proxy_options *tgt, const git_proxy_options *src)
19
+ {
20
+ if (!src) {
21
+ git_proxy_init_options(tgt, GIT_PROXY_OPTIONS_VERSION);
22
+ return 0;
23
+ }
24
+
25
+ memcpy(tgt, src, sizeof(git_proxy_options));
26
+ if (src->url) {
27
+ tgt->url = git__strdup(src->url);
28
+ GITERR_CHECK_ALLOC(tgt->url);
29
+ }
30
+
31
+ return 0;
32
+ }
@@ -0,0 +1,14 @@
1
+ /*
2
+ * Copyright (C) the libgit2 contributors. All rights reserved.
3
+ *
4
+ * This file is part of libgit2, distributed under the GNU GPL v2 with
5
+ * a Linking Exception. For full terms see the included COPYING file.
6
+ */
7
+ #ifndef INCLUDE_proxy_h__
8
+ #define INCLUDE_proxy_h__
9
+
10
+ #include "git2/proxy.h"
11
+
12
+ extern int git_proxy_options_dup(git_proxy_options *tgt, const git_proxy_options *src);
13
+
14
+ #endif
@@ -374,9 +374,9 @@ static int enqueue_object(
374
374
  case GIT_OBJ_COMMIT:
375
375
  return 0;
376
376
  case GIT_OBJ_TREE:
377
- return git_packbuilder_insert_tree(pb, &entry->oid);
377
+ return git_packbuilder_insert_tree(pb, entry->oid);
378
378
  default:
379
- return git_packbuilder_insert(pb, &entry->oid, entry->filename);
379
+ return git_packbuilder_insert(pb, entry->oid, entry->filename);
380
380
  }
381
381
  }
382
382
 
@@ -396,7 +396,7 @@ static int queue_differences(
396
396
  const git_tree_entry *d_entry = git_tree_entry_byindex(delta, j);
397
397
  int cmp = 0;
398
398
 
399
- if (!git_oid__cmp(&b_entry->oid, &d_entry->oid))
399
+ if (!git_oid__cmp(b_entry->oid, d_entry->oid))
400
400
  goto loop;
401
401
 
402
402
  cmp = strcmp(b_entry->filename, d_entry->filename);
@@ -407,15 +407,15 @@ static int queue_differences(
407
407
  git_tree_entry__is_tree(b_entry) &&
408
408
  git_tree_entry__is_tree(d_entry)) {
409
409
  /* Add the right-hand entry */
410
- if ((error = git_packbuilder_insert(pb, &d_entry->oid,
410
+ if ((error = git_packbuilder_insert(pb, d_entry->oid,
411
411
  d_entry->filename)) < 0)
412
412
  goto on_error;
413
413
 
414
414
  /* Acquire the subtrees and recurse */
415
415
  if ((error = git_tree_lookup(&b_child,
416
- git_tree_owner(base), &b_entry->oid)) < 0 ||
416
+ git_tree_owner(base), b_entry->oid)) < 0 ||
417
417
  (error = git_tree_lookup(&d_child,
418
- git_tree_owner(delta), &d_entry->oid)) < 0 ||
418
+ git_tree_owner(delta), d_entry->oid)) < 0 ||
419
419
  (error = queue_differences(b_child, d_child, pb)) < 0)
420
420
  goto on_error;
421
421
 
@@ -639,7 +639,7 @@ int git_push_finish(git_push *push, const git_remote_callbacks *callbacks)
639
639
  int error;
640
640
 
641
641
  if (!git_remote_connected(push->remote) &&
642
- (error = git_remote_connect(push->remote, GIT_DIRECTION_PUSH, callbacks, push->custom_headers)) < 0)
642
+ (error = git_remote_connect(push->remote, GIT_DIRECTION_PUSH, callbacks, NULL, push->custom_headers)) < 0)
643
643
  return error;
644
644
 
645
645
  if ((error = filter_refs(push->remote)) < 0 ||
@@ -472,6 +472,7 @@ done:
472
472
  static int rebase_setupfiles(git_rebase *rebase)
473
473
  {
474
474
  char onto[GIT_OID_HEXSZ], orig_head[GIT_OID_HEXSZ];
475
+ const char *orig_head_name;
475
476
 
476
477
  git_oid_fmt(onto, &rebase->onto_id);
477
478
  git_oid_fmt(orig_head, &rebase->orig_head_id);
@@ -481,8 +482,11 @@ static int rebase_setupfiles(git_rebase *rebase)
481
482
  return -1;
482
483
  }
483
484
 
485
+ orig_head_name = rebase->head_detached ? ORIG_DETACHED_HEAD :
486
+ rebase->orig_head_name;
487
+
484
488
  if (git_repository__set_orig_head(rebase->repo, &rebase->orig_head_id) < 0 ||
485
- rebase_setupfile(rebase, HEAD_NAME_FILE, -1, "%s\n", rebase->orig_head_name) < 0 ||
489
+ rebase_setupfile(rebase, HEAD_NAME_FILE, -1, "%s\n", orig_head_name) < 0 ||
486
490
  rebase_setupfile(rebase, ONTO_FILE, -1, "%.*s\n", GIT_OID_HEXSZ, onto) < 0 ||
487
491
  rebase_setupfile(rebase, ORIG_HEAD_FILE, -1, "%.*s\n", GIT_OID_HEXSZ, orig_head) < 0 ||
488
492
  rebase_setupfile(rebase, QUIET_FILE, -1, rebase->quiet ? "t\n" : "\n") < 0)
@@ -626,8 +630,12 @@ static int rebase_init_merge(
626
630
  rebase->state_path = git_buf_detach(&state_path);
627
631
  GITERR_CHECK_ALLOC(rebase->state_path);
628
632
 
629
- rebase->orig_head_name = git__strdup(branch->ref_name ? branch->ref_name : ORIG_DETACHED_HEAD);
630
- GITERR_CHECK_ALLOC(rebase->orig_head_name);
633
+ if (branch->ref_name) {
634
+ rebase->orig_head_name = git__strdup(branch->ref_name);
635
+ GITERR_CHECK_ALLOC(rebase->orig_head_name);
636
+ } else {
637
+ rebase->head_detached = 1;
638
+ }
631
639
 
632
640
  rebase->onto_name = git__strdup(rebase_onto_name(onto));
633
641
  GITERR_CHECK_ALLOC(rebase->onto_name);
@@ -844,6 +852,7 @@ static int rebase_next_inmemory(
844
852
  git_tree *current_tree = NULL, *head_tree = NULL, *parent_tree = NULL;
845
853
  git_rebase_operation *operation;
846
854
  git_index *index = NULL;
855
+ unsigned int parent_count;
847
856
  int error;
848
857
 
849
858
  *out = NULL;
@@ -851,10 +860,20 @@ static int rebase_next_inmemory(
851
860
  operation = git_array_get(rebase->operations, rebase->current);
852
861
 
853
862
  if ((error = git_commit_lookup(&current_commit, rebase->repo, &operation->id)) < 0 ||
854
- (error = git_commit_tree(&current_tree, current_commit)) < 0 ||
855
- (error = git_commit_parent(&parent_commit, current_commit, 0)) < 0 ||
856
- (error = git_commit_tree(&parent_tree, parent_commit)) < 0 ||
857
- (error = git_commit_tree(&head_tree, rebase->last_commit)) < 0 ||
863
+ (error = git_commit_tree(&current_tree, current_commit)) < 0)
864
+ goto done;
865
+
866
+ if ((parent_count = git_commit_parentcount(current_commit)) > 1) {
867
+ giterr_set(GITERR_REBASE, "Cannot rebase a merge commit");
868
+ error = -1;
869
+ goto done;
870
+ } else if (parent_count) {
871
+ if ((error = git_commit_parent(&parent_commit, current_commit, 0)) < 0 ||
872
+ (error = git_commit_tree(&parent_tree, parent_commit)) < 0)
873
+ goto done;
874
+ }
875
+
876
+ if ((error = git_commit_tree(&head_tree, rebase->last_commit)) < 0 ||
858
877
  (error = git_merge_trees(&index, rebase->repo, parent_tree, head_tree, current_tree, &rebase->options.merge_options)) < 0)
859
878
  goto done;
860
879
 
@@ -1254,42 +1273,33 @@ done:
1254
1273
  return error;
1255
1274
  }
1256
1275
 
1257
- int git_rebase_finish(
1258
- git_rebase *rebase,
1259
- const git_signature *signature)
1276
+ static int return_to_orig_head(git_rebase *rebase)
1260
1277
  {
1261
1278
  git_reference *terminal_ref = NULL, *branch_ref = NULL, *head_ref = NULL;
1262
1279
  git_commit *terminal_commit = NULL;
1263
1280
  git_buf branch_msg = GIT_BUF_INIT, head_msg = GIT_BUF_INIT;
1264
1281
  char onto[GIT_OID_HEXSZ];
1265
- int error;
1266
-
1267
- assert(rebase);
1268
-
1269
- if (rebase->inmemory)
1270
- return 0;
1282
+ int error = 0;
1271
1283
 
1272
1284
  git_oid_fmt(onto, &rebase->onto_id);
1273
1285
 
1274
- if ((error = git_buf_printf(&branch_msg, "rebase finished: %s onto %.*s",
1275
- rebase->orig_head_name, GIT_OID_HEXSZ, onto)) < 0 ||
1276
- (error = git_buf_printf(&head_msg, "rebase finished: returning to %s",
1277
- rebase->orig_head_name)) < 0 ||
1278
- (error = git_repository_head(&terminal_ref, rebase->repo)) < 0 ||
1286
+ if ((error = git_buf_printf(&branch_msg,
1287
+ "rebase finished: %s onto %.*s",
1288
+ rebase->orig_head_name, GIT_OID_HEXSZ, onto)) == 0 &&
1289
+ (error = git_buf_printf(&head_msg,
1290
+ "rebase finished: returning to %s",
1291
+ rebase->orig_head_name)) == 0 &&
1292
+ (error = git_repository_head(&terminal_ref, rebase->repo)) == 0 &&
1279
1293
  (error = git_reference_peel((git_object **)&terminal_commit,
1280
- terminal_ref, GIT_OBJ_COMMIT)) < 0 ||
1294
+ terminal_ref, GIT_OBJ_COMMIT)) == 0 &&
1281
1295
  (error = git_reference_create_matching(&branch_ref,
1282
- rebase->repo, rebase->orig_head_name, git_commit_id(terminal_commit), 1,
1283
- &rebase->orig_head_id, branch_msg.ptr)) < 0 ||
1284
- (error = git_reference_symbolic_create(&head_ref,
1296
+ rebase->repo, rebase->orig_head_name,
1297
+ git_commit_id(terminal_commit), 1,
1298
+ &rebase->orig_head_id, branch_msg.ptr)) == 0)
1299
+ error = git_reference_symbolic_create(&head_ref,
1285
1300
  rebase->repo, GIT_HEAD_FILE, rebase->orig_head_name, 1,
1286
- head_msg.ptr)) < 0 ||
1287
- (error = rebase_copy_notes(rebase, signature)) < 0)
1288
- goto done;
1289
-
1290
- error = rebase_cleanup(rebase);
1301
+ head_msg.ptr);
1291
1302
 
1292
- done:
1293
1303
  git_buf_free(&head_msg);
1294
1304
  git_buf_free(&branch_msg);
1295
1305
  git_commit_free(terminal_commit);
@@ -1300,6 +1310,26 @@ done:
1300
1310
  return error;
1301
1311
  }
1302
1312
 
1313
+ int git_rebase_finish(
1314
+ git_rebase *rebase,
1315
+ const git_signature *signature)
1316
+ {
1317
+ int error = 0;
1318
+
1319
+ assert(rebase);
1320
+
1321
+ if (rebase->inmemory)
1322
+ return 0;
1323
+
1324
+ if (!rebase->head_detached)
1325
+ error = return_to_orig_head(rebase);
1326
+
1327
+ if (error == 0 && (error = rebase_copy_notes(rebase, signature)) == 0)
1328
+ error = rebase_cleanup(rebase);
1329
+
1330
+ return error;
1331
+ }
1332
+
1303
1333
  size_t git_rebase_operation_entrycount(git_rebase *rebase)
1304
1334
  {
1305
1335
  assert(rebase);
@@ -962,6 +962,7 @@ static int packed_write(refdb_fs_backend *backend)
962
962
 
963
963
  for (i = 0; i < git_sortedcache_entrycount(refcache); ++i) {
964
964
  struct packref *ref = git_sortedcache_entry(refcache, i);
965
+ assert(ref);
965
966
 
966
967
  if (packed_find_peel(backend, ref) < 0)
967
968
  goto fail;
@@ -105,6 +105,18 @@ git_reference *git_reference__set_name(
105
105
  return rewrite;
106
106
  }
107
107
 
108
+ int git_reference_dup(git_reference **dest, git_reference *source)
109
+ {
110
+ if (source->type == GIT_REF_SYMBOLIC)
111
+ *dest = git_reference__alloc_symbolic(source->name, source->target.symbolic);
112
+ else
113
+ *dest = git_reference__alloc(source->name, &source->target.oid, &source->peel);
114
+
115
+ GITERR_CHECK_ALLOC(*dest);
116
+
117
+ return 0;
118
+ }
119
+
108
120
  void git_reference_free(git_reference *reference)
109
121
  {
110
122
  if (reference == NULL)
@@ -289,6 +301,9 @@ cleanup:
289
301
  "Could not use '%s' as valid reference name", git_buf_cstr(&name));
290
302
  }
291
303
 
304
+ if (error == GIT_ENOTFOUND)
305
+ giterr_set(GITERR_REFERENCE, "no reference found for shorthand '%s'", refname);
306
+
292
307
  git_buf_free(&name);
293
308
  git_buf_free(&refnamebuf);
294
309
  return error;
@@ -445,7 +460,7 @@ int git_reference_create_matching(
445
460
  {
446
461
  int error;
447
462
  git_signature *who = NULL;
448
-
463
+
449
464
  assert(id);
450
465
 
451
466
  if ((error = git_reference__log_signature(&who, repo)) < 0)
@@ -695,7 +695,7 @@ static int set_transport_custom_headers(git_transport *t, const git_strarray *cu
695
695
  return t->set_custom_headers(t, custom_headers);
696
696
  }
697
697
 
698
- int git_remote_connect(git_remote *remote, git_direction direction, const git_remote_callbacks *callbacks, const git_strarray *custom_headers)
698
+ int git_remote_connect(git_remote *remote, git_direction direction, const git_remote_callbacks *callbacks, const git_proxy_options *proxy, const git_strarray *custom_headers)
699
699
  {
700
700
  git_transport *t;
701
701
  const char *url;
@@ -714,6 +714,9 @@ int git_remote_connect(git_remote *remote, git_direction direction, const git_re
714
714
  payload = callbacks->payload;
715
715
  }
716
716
 
717
+ if (proxy)
718
+ GITERR_CHECK_VERSION(proxy, GIT_PROXY_OPTIONS_VERSION, "git_proxy_options");
719
+
717
720
  t = remote->transport;
718
721
 
719
722
  url = git_remote__urlfordirection(remote, direction);
@@ -738,7 +741,7 @@ int git_remote_connect(git_remote *remote, git_direction direction, const git_re
738
741
  goto on_error;
739
742
 
740
743
  if ((error = set_transport_callbacks(t, callbacks)) < 0 ||
741
- (error = t->connect(t, url, credentials, payload, direction, flags)) != 0)
744
+ (error = t->connect(t, url, credentials, payload, proxy, direction, flags)) != 0)
742
745
  goto on_error;
743
746
 
744
747
  remote->transport = t;
@@ -896,6 +899,7 @@ int git_remote_download(git_remote *remote, const git_strarray *refspecs, const
896
899
  git_vector *to_active, specs = GIT_VECTOR_INIT, refs = GIT_VECTOR_INIT;
897
900
  const git_remote_callbacks *cbs = NULL;
898
901
  const git_strarray *custom_headers = NULL;
902
+ const git_proxy_options *proxy = NULL;
899
903
 
900
904
  assert(remote);
901
905
 
@@ -903,10 +907,12 @@ int git_remote_download(git_remote *remote, const git_strarray *refspecs, const
903
907
  GITERR_CHECK_VERSION(&opts->callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
904
908
  cbs = &opts->callbacks;
905
909
  custom_headers = &opts->custom_headers;
910
+ GITERR_CHECK_VERSION(&opts->proxy_opts, GIT_PROXY_OPTIONS_VERSION, "git_proxy_options");
911
+ proxy = &opts->proxy_opts;
906
912
  }
907
913
 
908
914
  if (!git_remote_connected(remote) &&
909
- (error = git_remote_connect(remote, GIT_DIRECTION_FETCH, cbs, custom_headers)) < 0)
915
+ (error = git_remote_connect(remote, GIT_DIRECTION_FETCH, cbs, proxy, custom_headers)) < 0)
910
916
  goto on_error;
911
917
 
912
918
  if (ls_to_vector(&refs, remote) < 0)
@@ -971,6 +977,7 @@ int git_remote_fetch(
971
977
  git_buf reflog_msg_buf = GIT_BUF_INIT;
972
978
  const git_remote_callbacks *cbs = NULL;
973
979
  const git_strarray *custom_headers = NULL;
980
+ const git_proxy_options *proxy = NULL;
974
981
 
975
982
  if (opts) {
976
983
  GITERR_CHECK_VERSION(&opts->callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
@@ -978,10 +985,12 @@ int git_remote_fetch(
978
985
  custom_headers = &opts->custom_headers;
979
986
  update_fetchhead = opts->update_fetchhead;
980
987
  tagopt = opts->download_tags;
988
+ GITERR_CHECK_VERSION(&opts->proxy_opts, GIT_PROXY_OPTIONS_VERSION, "git_proxy_options");
989
+ proxy = &opts->proxy_opts;
981
990
  }
982
991
 
983
992
  /* Connect and download everything */
984
- if ((error = git_remote_connect(remote, GIT_DIRECTION_FETCH, cbs, custom_headers)) != 0)
993
+ if ((error = git_remote_connect(remote, GIT_DIRECTION_FETCH, cbs, proxy, custom_headers)) != 0)
985
994
  return error;
986
995
 
987
996
  error = git_remote_download(remote, refspecs, opts);
@@ -2393,16 +2402,18 @@ int git_remote_upload(git_remote *remote, const git_strarray *refspecs, const gi
2393
2402
  git_refspec *spec;
2394
2403
  const git_remote_callbacks *cbs = NULL;
2395
2404
  const git_strarray *custom_headers = NULL;
2405
+ const git_proxy_options *proxy = NULL;
2396
2406
 
2397
2407
  assert(remote);
2398
2408
 
2399
2409
  if (opts) {
2400
2410
  cbs = &opts->callbacks;
2401
2411
  custom_headers = &opts->custom_headers;
2412
+ proxy = &opts->proxy_opts;
2402
2413
  }
2403
2414
 
2404
2415
  if (!git_remote_connected(remote) &&
2405
- (error = git_remote_connect(remote, GIT_DIRECTION_PUSH, cbs, custom_headers)) < 0)
2416
+ (error = git_remote_connect(remote, GIT_DIRECTION_PUSH, cbs, proxy, custom_headers)) < 0)
2406
2417
  goto cleanup;
2407
2418
 
2408
2419
  free_refspecs(&remote->active_refspecs);
@@ -2452,16 +2463,19 @@ int git_remote_push(git_remote *remote, const git_strarray *refspecs, const git_
2452
2463
  int error;
2453
2464
  const git_remote_callbacks *cbs = NULL;
2454
2465
  const git_strarray *custom_headers = NULL;
2466
+ const git_proxy_options *proxy = NULL;
2455
2467
 
2456
2468
  if (opts) {
2457
2469
  GITERR_CHECK_VERSION(&opts->callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
2458
2470
  cbs = &opts->callbacks;
2459
2471
  custom_headers = &opts->custom_headers;
2472
+ GITERR_CHECK_VERSION(&opts->proxy_opts, GIT_PROXY_OPTIONS_VERSION, "git_proxy_options");
2473
+ proxy = &opts->proxy_opts;
2460
2474
  }
2461
2475
 
2462
2476
  assert(remote && refspecs);
2463
2477
 
2464
- if ((error = git_remote_connect(remote, GIT_DIRECTION_PUSH, cbs, custom_headers)) < 0)
2478
+ if ((error = git_remote_connect(remote, GIT_DIRECTION_PUSH, cbs, proxy, custom_headers)) < 0)
2465
2479
  return error;
2466
2480
 
2467
2481
  if ((error = git_remote_upload(remote, refspecs, opts)) < 0)
@@ -2162,7 +2162,7 @@ int git_repository_set_head_detached_from_annotated(
2162
2162
  {
2163
2163
  assert(repo && commitish);
2164
2164
 
2165
- return detach(repo, git_annotated_commit_id(commitish), commitish->ref_name);
2165
+ return detach(repo, git_annotated_commit_id(commitish), commitish->description);
2166
2166
  }
2167
2167
 
2168
2168
  int git_repository_detach_head(git_repository* repo)
@@ -195,5 +195,5 @@ int git_reset_from_annotated(
195
195
  git_reset_t reset_type,
196
196
  const git_checkout_options *checkout_opts)
197
197
  {
198
- return reset(repo, (git_object *) commit->commit, commit->ref_name, reset_type, checkout_opts);
198
+ return reset(repo, (git_object *) commit->commit, commit->description, reset_type, checkout_opts);
199
199
  }
@@ -71,12 +71,18 @@ static int config_level_to_sysdir(int config_level)
71
71
  }
72
72
 
73
73
  extern char *git__user_agent;
74
+ extern char *git__ssl_ciphers;
74
75
 
75
76
  const char *git_libgit2__user_agent()
76
77
  {
77
78
  return git__user_agent;
78
79
  }
79
80
 
81
+ const char *git_libgit2__ssl_ciphers()
82
+ {
83
+ return git__ssl_ciphers;
84
+ }
85
+
80
86
  int git_libgit2_opts(int key, ...)
81
87
  {
82
88
  int error = 0;
@@ -169,7 +175,7 @@ int git_libgit2_opts(int key, ...)
169
175
  }
170
176
  }
171
177
  #else
172
- giterr_set(GITERR_NET, "Cannot set certificate locations: OpenSSL is not enabled");
178
+ giterr_set(GITERR_NET, "cannot set certificate locations: OpenSSL is not enabled");
173
179
  error = -1;
174
180
  #endif
175
181
  break;
@@ -187,6 +193,22 @@ int git_libgit2_opts(int key, ...)
187
193
  git_object__strict_input_validation = (va_arg(ap, int) != 0);
188
194
  break;
189
195
 
196
+ case GIT_OPT_SET_SSL_CIPHERS:
197
+ #ifdef GIT_OPENSSL
198
+ {
199
+ git__free(git__ssl_ciphers);
200
+ git__ssl_ciphers = git__strdup(va_arg(ap, const char *));
201
+ if (!git__ssl_ciphers) {
202
+ giterr_set_oom();
203
+ error = -1;
204
+ }
205
+ }
206
+ #else
207
+ giterr_set(GITERR_NET, "cannot set custom ciphers: OpenSSL is not enabled");
208
+ error = -1;
209
+ #endif
210
+ break;
211
+
190
212
  default:
191
213
  giterr_set(GITERR_INVALID, "invalid option key");
192
214
  error = -1;