rugged 0.23.0b2 → 0.23.0b4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/ext/rugged/rugged_blob.c +39 -0
  3. data/ext/rugged/rugged_diff.c +7 -3
  4. data/ext/rugged/rugged_index.c +2 -2
  5. data/ext/rugged/rugged_remote.c +27 -148
  6. data/ext/rugged/rugged_remote_collection.c +134 -12
  7. data/ext/rugged/rugged_repo.c +74 -5
  8. data/ext/rugged/rugged_submodule.c +18 -208
  9. data/ext/rugged/rugged_submodule_collection.c +148 -0
  10. data/lib/rugged/version.rb +1 -1
  11. data/vendor/libgit2/AUTHORS +1 -0
  12. data/vendor/libgit2/CMakeLists.txt +33 -25
  13. data/vendor/libgit2/deps/winhttp/winhttp.def +29 -29
  14. data/vendor/libgit2/include/git2.h +1 -1
  15. data/vendor/libgit2/include/git2/blob.h +4 -6
  16. data/vendor/libgit2/include/git2/checkout.h +10 -1
  17. data/vendor/libgit2/include/git2/clone.h +6 -7
  18. data/vendor/libgit2/include/git2/commit.h +11 -0
  19. data/vendor/libgit2/include/git2/cred_helpers.h +2 -2
  20. data/vendor/libgit2/include/git2/describe.h +1 -1
  21. data/vendor/libgit2/include/git2/diff.h +68 -11
  22. data/vendor/libgit2/include/git2/errors.h +4 -1
  23. data/vendor/libgit2/include/git2/filter.h +16 -0
  24. data/vendor/libgit2/include/git2/index.h +38 -11
  25. data/vendor/libgit2/include/git2/odb.h +1 -1
  26. data/vendor/libgit2/include/git2/odb_backend.h +2 -2
  27. data/vendor/libgit2/include/git2/remote.h +300 -207
  28. data/vendor/libgit2/include/git2/reset.h +1 -0
  29. data/vendor/libgit2/include/git2/stash.h +135 -4
  30. data/vendor/libgit2/include/git2/status.h +1 -0
  31. data/vendor/libgit2/include/git2/submodule.h +46 -75
  32. data/vendor/libgit2/include/git2/sys/odb_backend.h +1 -1
  33. data/vendor/libgit2/include/git2/sys/stream.h +2 -0
  34. data/vendor/libgit2/include/git2/sys/transport.h +1 -21
  35. data/vendor/libgit2/include/git2/transport.h +27 -0
  36. data/vendor/libgit2/include/git2/types.h +20 -10
  37. data/vendor/libgit2/include/git2/version.h +3 -3
  38. data/vendor/libgit2/libgit2.pc.in +4 -2
  39. data/vendor/libgit2/src/attr.c +2 -1
  40. data/vendor/libgit2/src/attr_file.c +18 -37
  41. data/vendor/libgit2/src/blame.c +2 -2
  42. data/vendor/libgit2/src/blob.c +4 -3
  43. data/vendor/libgit2/src/branch.c +6 -3
  44. data/vendor/libgit2/src/buf_text.c +4 -6
  45. data/vendor/libgit2/src/buf_text.h +1 -2
  46. data/vendor/libgit2/src/buffer.c +8 -6
  47. data/vendor/libgit2/src/buffer.h +1 -1
  48. data/vendor/libgit2/src/cache.c +1 -0
  49. data/vendor/libgit2/src/checkout.c +34 -20
  50. data/vendor/libgit2/src/clone.c +29 -29
  51. data/vendor/libgit2/src/commit.c +65 -0
  52. data/vendor/libgit2/src/common.h +5 -0
  53. data/vendor/libgit2/src/config.c +20 -0
  54. data/vendor/libgit2/src/config.h +6 -0
  55. data/vendor/libgit2/src/config_file.c +2 -2
  56. data/vendor/libgit2/src/crlf.c +39 -17
  57. data/vendor/libgit2/src/curl_stream.c +257 -0
  58. data/vendor/libgit2/src/curl_stream.h +14 -0
  59. data/vendor/libgit2/src/diff.c +223 -88
  60. data/vendor/libgit2/src/diff.h +21 -1
  61. data/vendor/libgit2/src/diff_file.c +23 -13
  62. data/vendor/libgit2/src/diff_file.h +4 -2
  63. data/vendor/libgit2/src/diff_patch.c +266 -71
  64. data/vendor/libgit2/src/diff_patch.h +36 -0
  65. data/vendor/libgit2/src/diff_print.c +156 -126
  66. data/vendor/libgit2/src/diff_tform.c +32 -54
  67. data/vendor/libgit2/src/fetch.c +27 -10
  68. data/vendor/libgit2/src/fetch.h +2 -2
  69. data/vendor/libgit2/src/filebuf.c +1 -1
  70. data/vendor/libgit2/src/fileops.c +6 -2
  71. data/vendor/libgit2/src/filter.c +28 -7
  72. data/vendor/libgit2/src/fnmatch.c +5 -5
  73. data/vendor/libgit2/src/global.c +16 -0
  74. data/vendor/libgit2/src/ident.c +2 -2
  75. data/vendor/libgit2/src/ignore.c +1 -0
  76. data/vendor/libgit2/src/index.c +338 -80
  77. data/vendor/libgit2/src/index.h +4 -1
  78. data/vendor/libgit2/src/indexer.c +19 -5
  79. data/vendor/libgit2/src/iterator.c +118 -11
  80. data/vendor/libgit2/src/iterator.h +25 -0
  81. data/vendor/libgit2/src/merge.c +96 -106
  82. data/vendor/libgit2/src/merge.h +14 -4
  83. data/vendor/libgit2/src/netops.c +3 -3
  84. data/vendor/libgit2/src/odb.c +17 -9
  85. data/vendor/libgit2/src/odb.h +1 -1
  86. data/vendor/libgit2/src/odb_loose.c +2 -2
  87. data/vendor/libgit2/src/odb_pack.c +1 -1
  88. data/vendor/libgit2/src/openssl_stream.c +118 -27
  89. data/vendor/libgit2/src/pack-objects.c +28 -0
  90. data/vendor/libgit2/src/pack-objects.h +1 -0
  91. data/vendor/libgit2/src/pack.c +18 -10
  92. data/vendor/libgit2/src/path.c +16 -11
  93. data/vendor/libgit2/src/path.h +1 -1
  94. data/vendor/libgit2/src/push.c +26 -42
  95. data/vendor/libgit2/src/push.h +2 -34
  96. data/vendor/libgit2/src/rebase.c +1 -1
  97. data/vendor/libgit2/src/refs.c +1 -1
  98. data/vendor/libgit2/src/refspec.c +6 -0
  99. data/vendor/libgit2/src/remote.c +381 -274
  100. data/vendor/libgit2/src/remote.h +0 -4
  101. data/vendor/libgit2/src/repository.c +33 -12
  102. data/vendor/libgit2/src/repository.h +0 -1
  103. data/vendor/libgit2/src/reset.c +1 -0
  104. data/vendor/libgit2/src/stash.c +439 -17
  105. data/vendor/libgit2/src/status.c +6 -0
  106. data/vendor/libgit2/src/stransport_stream.c +58 -21
  107. data/vendor/libgit2/src/stream.h +15 -0
  108. data/vendor/libgit2/src/submodule.c +410 -664
  109. data/vendor/libgit2/src/submodule.h +0 -24
  110. data/vendor/libgit2/src/transaction.c +1 -0
  111. data/vendor/libgit2/src/transports/cred.c +55 -1
  112. data/vendor/libgit2/src/transports/http.c +18 -2
  113. data/vendor/libgit2/src/transports/local.c +60 -59
  114. data/vendor/libgit2/src/transports/smart.h +1 -1
  115. data/vendor/libgit2/src/transports/smart_protocol.c +11 -11
  116. data/vendor/libgit2/src/transports/ssh.c +46 -7
  117. data/vendor/libgit2/src/unix/posix.h +4 -0
  118. data/vendor/libgit2/src/util.c +9 -9
  119. data/vendor/libgit2/src/util.h +9 -0
  120. data/vendor/libgit2/src/win32/posix.h +3 -0
  121. data/vendor/libgit2/src/win32/posix_w32.c +38 -0
  122. data/vendor/libgit2/src/win32/w32_util.h +10 -0
  123. metadata +4 -3
  124. data/vendor/libgit2/include/git2/push.h +0 -94
@@ -10,6 +10,7 @@
10
10
  #include "vector.h"
11
11
  #include "commit_list.h"
12
12
  #include "pool.h"
13
+ #include "iterator.h"
13
14
 
14
15
  #include "git2/merge.h"
15
16
  #include "git2/types.h"
@@ -121,10 +122,11 @@ int git_merge__bases_many(
121
122
 
122
123
  git_merge_diff_list *git_merge_diff_list__alloc(git_repository *repo);
123
124
 
124
- int git_merge_diff_list__find_differences(git_merge_diff_list *merge_diff_list,
125
- const git_tree *ancestor_tree,
126
- const git_tree *ours_tree,
127
- const git_tree *theirs_tree);
125
+ int git_merge_diff_list__find_differences(
126
+ git_merge_diff_list *merge_diff_list,
127
+ git_iterator *ancestor_iterator,
128
+ git_iterator *ours_iter,
129
+ git_iterator *theirs_iter);
128
130
 
129
131
  int git_merge_diff_list__find_renames(git_repository *repo, git_merge_diff_list *merge_diff_list, const git_merge_options *opts);
130
132
 
@@ -138,6 +140,14 @@ int git_merge__setup(
138
140
  const git_annotated_commit *heads[],
139
141
  size_t heads_len);
140
142
 
143
+ int git_merge__iterators(
144
+ git_index **out,
145
+ git_repository *repo,
146
+ git_iterator *ancestor_iter,
147
+ git_iterator *our_iter,
148
+ git_iterator *their_iter,
149
+ const git_merge_options *given_opts);
150
+
141
151
  int git_merge__check_result(git_repository *repo, git_index *index_new);
142
152
 
143
153
  int git_merge__append_conflicts_to_merge_msg(git_repository *repo, git_index *index);
@@ -84,7 +84,7 @@ void gitno_consume_n(gitno_buffer *buf, size_t cons)
84
84
  int gitno__match_host(const char *pattern, const char *host)
85
85
  {
86
86
  for (;;) {
87
- char c = tolower(*pattern++);
87
+ char c = git__tolower(*pattern++);
88
88
 
89
89
  if (c == '\0')
90
90
  return *host ? -1 : 0;
@@ -102,7 +102,7 @@ int gitno__match_host(const char *pattern, const char *host)
102
102
  */
103
103
 
104
104
  while(*host) {
105
- char h = tolower(*host);
105
+ char h = git__tolower(*host);
106
106
  if (c == h)
107
107
  return gitno__match_host(pattern, host++);
108
108
  if (h == '.')
@@ -112,7 +112,7 @@ int gitno__match_host(const char *pattern, const char *host)
112
112
  return -1;
113
113
  }
114
114
 
115
- if (c != tolower(*host++))
115
+ if (c != git__tolower(*host++))
116
116
  return -1;
117
117
  }
118
118
 
@@ -21,9 +21,12 @@
21
21
 
22
22
  #define GIT_ALTERNATES_FILE "info/alternates"
23
23
 
24
- /* TODO: is this correct? */
25
- #define GIT_LOOSE_PRIORITY 2
26
- #define GIT_PACKED_PRIORITY 1
24
+ /*
25
+ * We work under the assumption that most objects for long-running
26
+ * operations will be packed
27
+ */
28
+ #define GIT_LOOSE_PRIORITY 1
29
+ #define GIT_PACKED_PRIORITY 2
27
30
 
28
31
  #define GIT_ALTERNATES_MAX_DEPTH 5
29
32
 
@@ -47,10 +50,10 @@ static git_cache *odb_cache(git_odb *odb)
47
50
 
48
51
  static int load_alternates(git_odb *odb, const char *objects_dir, int alternate_depth);
49
52
 
50
- int git_odb__format_object_header(char *hdr, size_t n, size_t obj_len, git_otype obj_type)
53
+ int git_odb__format_object_header(char *hdr, size_t n, git_off_t obj_len, git_otype obj_type)
51
54
  {
52
55
  const char *type_str = git_object_type2string(obj_type);
53
- int len = p_snprintf(hdr, n, "%s %"PRIuZ, type_str, obj_len);
56
+ int len = p_snprintf(hdr, n, "%s %lld", type_str, obj_len);
54
57
  assert(len > 0 && len <= (int)n);
55
58
  return len+1;
56
59
  }
@@ -142,7 +145,7 @@ void git_odb_object_free(git_odb_object *object)
142
145
  int git_odb__hashfd(git_oid *out, git_file fd, size_t size, git_otype type)
143
146
  {
144
147
  int hdr_len;
145
- char hdr[64], buffer[2048];
148
+ char hdr[64], buffer[FILEIO_BUFSIZE];
146
149
  git_hash_ctx ctx;
147
150
  ssize_t read_len = 0;
148
151
  int error = 0;
@@ -327,10 +330,15 @@ static void fake_wstream__free(git_odb_stream *_stream)
327
330
  git__free(stream);
328
331
  }
329
332
 
330
- static int init_fake_wstream(git_odb_stream **stream_p, git_odb_backend *backend, size_t size, git_otype type)
333
+ static int init_fake_wstream(git_odb_stream **stream_p, git_odb_backend *backend, git_off_t size, git_otype type)
331
334
  {
332
335
  fake_wstream *stream;
333
336
 
337
+ if (!git__is_ssizet(size)) {
338
+ giterr_set(GITERR_ODB, "object size too large to keep in memory");
339
+ return -1;
340
+ }
341
+
334
342
  stream = git__calloc(1, sizeof(fake_wstream));
335
343
  GITERR_CHECK_ALLOC(stream);
336
344
 
@@ -937,7 +945,7 @@ int git_odb_write(
937
945
  return error;
938
946
  }
939
947
 
940
- static void hash_header(git_hash_ctx *ctx, size_t size, git_otype type)
948
+ static void hash_header(git_hash_ctx *ctx, git_off_t size, git_otype type)
941
949
  {
942
950
  char header[64];
943
951
  int hdrlen;
@@ -947,7 +955,7 @@ static void hash_header(git_hash_ctx *ctx, size_t size, git_otype type)
947
955
  }
948
956
 
949
957
  int git_odb_open_wstream(
950
- git_odb_stream **stream, git_odb *db, size_t size, git_otype type)
958
+ git_odb_stream **stream, git_odb *db, git_off_t size, git_otype type)
951
959
  {
952
960
  size_t i, writes = 0;
953
961
  int error = GIT_ERROR;
@@ -49,7 +49,7 @@ int git_odb__hashobj(git_oid *id, git_rawobj *obj);
49
49
  /*
50
50
  * Format the object header such as it would appear in the on-disk object
51
51
  */
52
- int git_odb__format_object_header(char *hdr, size_t n, size_t obj_len, git_otype obj_type);
52
+ int git_odb__format_object_header(char *hdr, size_t n, git_off_t obj_len, git_otype obj_type);
53
53
  /*
54
54
  * Hash an open file descriptor.
55
55
  * This is a performance call when the contents of a fd need to be hashed,
@@ -834,7 +834,7 @@ static void loose_backend__stream_free(git_odb_stream *_stream)
834
834
  git__free(stream);
835
835
  }
836
836
 
837
- static int loose_backend__stream(git_odb_stream **stream_out, git_odb_backend *_backend, size_t length, git_otype type)
837
+ static int loose_backend__stream(git_odb_stream **stream_out, git_odb_backend *_backend, git_off_t length, git_otype type)
838
838
  {
839
839
  loose_backend *backend;
840
840
  loose_writestream *stream = NULL;
@@ -842,7 +842,7 @@ static int loose_backend__stream(git_odb_stream **stream_out, git_odb_backend *_
842
842
  git_buf tmp_path = GIT_BUF_INIT;
843
843
  int hdrlen;
844
844
 
845
- assert(_backend);
845
+ assert(_backend && length >= 0);
846
846
 
847
847
  backend = (loose_backend *)_backend;
848
848
  *stream_out = NULL;
@@ -383,7 +383,7 @@ static int pack_backend__read_internal(
383
383
  git_odb_backend *backend, const git_oid *oid)
384
384
  {
385
385
  struct git_pack_entry e;
386
- git_rawobj raw;
386
+ git_rawobj raw = {NULL};
387
387
  int error;
388
388
 
389
389
  if ((error = pack_entry_find(&e, (struct pack_backend *)backend, oid)) < 0 ||
@@ -16,6 +16,10 @@
16
16
  #include "netops.h"
17
17
  #include "git2/transport.h"
18
18
 
19
+ #ifdef GIT_CURL
20
+ # include "curl_stream.h"
21
+ #endif
22
+
19
23
  #ifndef GIT_WIN32
20
24
  # include <sys/types.h>
21
25
  # include <sys/socket.h>
@@ -25,6 +29,79 @@
25
29
  #include <openssl/ssl.h>
26
30
  #include <openssl/err.h>
27
31
  #include <openssl/x509v3.h>
32
+ #include <openssl/bio.h>
33
+
34
+ static int bio_create(BIO *b)
35
+ {
36
+ b->init = 1;
37
+ b->num = 0;
38
+ b->ptr = NULL;
39
+ b->flags = 0;
40
+
41
+ return 1;
42
+ }
43
+
44
+ static int bio_destroy(BIO *b)
45
+ {
46
+ if (!b)
47
+ return 0;
48
+
49
+ b->init = 0;
50
+ b->num = 0;
51
+ b->ptr = NULL;
52
+ b->flags = 0;
53
+
54
+ return 1;
55
+ }
56
+
57
+ static int bio_read(BIO *b, char *buf, int len)
58
+ {
59
+ git_stream *io = (git_stream *) b->ptr;
60
+ return (int) git_stream_read(io, buf, len);
61
+ }
62
+
63
+ static int bio_write(BIO *b, const char *buf, int len)
64
+ {
65
+ git_stream *io = (git_stream *) b->ptr;
66
+ return (int) git_stream_write(io, buf, len, 0);
67
+ }
68
+
69
+ static long bio_ctrl(BIO *b, int cmd, long num, void *ptr)
70
+ {
71
+ GIT_UNUSED(b);
72
+ GIT_UNUSED(num);
73
+ GIT_UNUSED(ptr);
74
+
75
+ if (cmd == BIO_CTRL_FLUSH)
76
+ return 1;
77
+
78
+ return 0;
79
+ }
80
+
81
+ static int bio_gets(BIO *b, char *buf, int len)
82
+ {
83
+ GIT_UNUSED(b);
84
+ GIT_UNUSED(buf);
85
+ GIT_UNUSED(len);
86
+ return -1;
87
+ }
88
+
89
+ static int bio_puts(BIO *b, const char *str)
90
+ {
91
+ return bio_write(b, str, strlen(str));
92
+ }
93
+
94
+ static BIO_METHOD git_stream_bio_method = {
95
+ BIO_TYPE_SOURCE_SINK,
96
+ "git_stream",
97
+ bio_write,
98
+ bio_read,
99
+ bio_puts,
100
+ bio_gets,
101
+ bio_ctrl,
102
+ bio_create,
103
+ bio_destroy
104
+ };
28
105
 
29
106
  static int ssl_set_error(SSL *ssl, int error)
30
107
  {
@@ -55,6 +132,7 @@ static int ssl_set_error(SSL *ssl, int error)
55
132
  break;
56
133
  }
57
134
  giterr_set(GITERR_NET, "SSL error: received early EOF");
135
+ return GIT_EEOF;
58
136
  break;
59
137
  case SSL_ERROR_SSL:
60
138
  e = ERR_get_error();
@@ -223,7 +301,8 @@ cert_fail_name:
223
301
 
224
302
  typedef struct {
225
303
  git_stream parent;
226
- git_socket_stream *socket;
304
+ git_stream *io;
305
+ char *host;
227
306
  SSL *ssl;
228
307
  git_cert_x509 cert_info;
229
308
  } openssl_stream;
@@ -233,20 +312,24 @@ int openssl_close(git_stream *stream);
233
312
  int openssl_connect(git_stream *stream)
234
313
  {
235
314
  int ret;
315
+ BIO *bio;
236
316
  openssl_stream *st = (openssl_stream *) stream;
237
317
 
238
- if ((ret = git_stream_connect((git_stream *)st->socket)) < 0)
318
+ if ((ret = git_stream_connect(st->io)) < 0)
239
319
  return ret;
240
320
 
241
- if ((ret = SSL_set_fd(st->ssl, st->socket->s)) <= 0) {
242
- openssl_close((git_stream *) st);
243
- return ssl_set_error(st->ssl, ret);
244
- }
321
+ bio = BIO_new(&git_stream_bio_method);
322
+ GITERR_CHECK_ALLOC(bio);
323
+ bio->ptr = st->io;
324
+
325
+ SSL_set_bio(st->ssl, bio, bio);
326
+ /* specify the host in case SNI is needed */
327
+ SSL_set_tlsext_host_name(st->ssl, st->host);
245
328
 
246
329
  if ((ret = SSL_connect(st->ssl)) <= 0)
247
330
  return ssl_set_error(st->ssl, ret);
248
331
 
249
- return verify_server_cert(st->ssl, st->socket->host);
332
+ return verify_server_cert(st->ssl, st->host);
250
333
  }
251
334
 
252
335
  int openssl_certificate(git_cert **out, git_stream *stream)
@@ -283,23 +366,25 @@ int openssl_certificate(git_cert **out, git_stream *stream)
283
366
  return 0;
284
367
  }
285
368
 
369
+ static int openssl_set_proxy(git_stream *stream, const char *proxy_url)
370
+ {
371
+ openssl_stream *st = (openssl_stream *) stream;
372
+
373
+ return git_stream_set_proxy(st->io, proxy_url);
374
+ }
375
+
286
376
  ssize_t openssl_write(git_stream *stream, const char *data, size_t len, int flags)
287
377
  {
288
378
  openssl_stream *st = (openssl_stream *) stream;
289
379
  int ret;
290
- size_t off = 0;
291
380
 
292
381
  GIT_UNUSED(flags);
293
382
 
294
- while (off < len) {
295
- ret = SSL_write(st->ssl, data + off, len - off);
296
- if (ret <= 0 && ret != SSL_ERROR_WANT_WRITE)
297
- return ssl_set_error(st->ssl, ret);
298
-
299
- off += ret;
300
- }
383
+ if ((ret = SSL_write(st->ssl, data, len)) <= 0) {
384
+ return ssl_set_error(st->ssl, ret);
385
+ }
301
386
 
302
- return off;
387
+ return ret;
303
388
  }
304
389
 
305
390
  ssize_t openssl_read(git_stream *stream, void *data, size_t len)
@@ -307,14 +392,8 @@ ssize_t openssl_read(git_stream *stream, void *data, size_t len)
307
392
  openssl_stream *st = (openssl_stream *) stream;
308
393
  int ret;
309
394
 
310
- do {
311
- ret = SSL_read(st->ssl, data, len);
312
- } while (SSL_get_error(st->ssl, ret) == SSL_ERROR_WANT_READ);
313
-
314
- if (ret < 0) {
395
+ if ((ret = SSL_read(st->ssl, data, len)) <= 0)
315
396
  ssl_set_error(st->ssl, ret);
316
- return -1;
317
- }
318
397
 
319
398
  return ret;
320
399
  }
@@ -327,7 +406,7 @@ int openssl_close(git_stream *stream)
327
406
  if ((ret = ssl_teardown(st->ssl)) < 0)
328
407
  return -1;
329
408
 
330
- return git_stream_close((git_stream *)st->socket);
409
+ return git_stream_close(st->io);
331
410
  }
332
411
 
333
412
  void openssl_free(git_stream *stream)
@@ -335,19 +414,26 @@ void openssl_free(git_stream *stream)
335
414
  openssl_stream *st = (openssl_stream *) stream;
336
415
 
337
416
  git__free(st->cert_info.data);
338
- git_stream_free((git_stream *) st->socket);
417
+ git_stream_free(st->io);
339
418
  git__free(st);
340
419
  }
341
420
 
342
421
  int git_openssl_stream_new(git_stream **out, const char *host, const char *port)
343
422
  {
423
+ int error;
344
424
  openssl_stream *st;
345
425
 
346
426
  st = git__calloc(1, sizeof(openssl_stream));
347
427
  GITERR_CHECK_ALLOC(st);
348
428
 
349
- if (git_socket_stream_new((git_stream **) &st->socket, host, port))
350
- return -1;
429
+ #ifdef GIT_CURL
430
+ error = git_curl_stream_new(&st->io, host, port);
431
+ #else
432
+ error = git_socket_stream_new(&st->io, host, port);
433
+ #endif
434
+
435
+ if (error < 0)
436
+ return error;
351
437
 
352
438
  st->ssl = SSL_new(git__ssl_ctx);
353
439
  if (st->ssl == NULL) {
@@ -355,10 +441,15 @@ int git_openssl_stream_new(git_stream **out, const char *host, const char *port)
355
441
  return -1;
356
442
  }
357
443
 
444
+ st->host = git__strdup(host);
445
+ GITERR_CHECK_ALLOC(st->host);
446
+
358
447
  st->parent.version = GIT_STREAM_VERSION;
359
448
  st->parent.encrypted = 1;
449
+ st->parent.proxy_support = git_stream_supports_proxy(st->io);
360
450
  st->parent.connect = openssl_connect;
361
451
  st->parent.certificate = openssl_certificate;
452
+ st->parent.set_proxy = openssl_set_proxy;
362
453
  st->parent.read = openssl_read;
363
454
  st->parent.write = openssl_write;
364
455
  st->parent.close = openssl_close;
@@ -893,6 +893,29 @@ static unsigned long free_unpacked(struct unpacked *n)
893
893
  return freed_mem;
894
894
  }
895
895
 
896
+ static int report_delta_progress(git_packbuilder *pb, uint32_t count, bool force)
897
+ {
898
+ int ret;
899
+
900
+ if (pb->progress_cb) {
901
+ double current_time = git__timer();
902
+ double elapsed = current_time - pb->last_progress_report_time;
903
+
904
+ if (force || elapsed >= MIN_PROGRESS_UPDATE_INTERVAL) {
905
+ pb->last_progress_report_time = current_time;
906
+
907
+ ret = pb->progress_cb(
908
+ GIT_PACKBUILDER_DELTAFICATION,
909
+ count, pb->nr_objects, pb->progress_cb_payload);
910
+
911
+ if (ret)
912
+ return giterr_set_after_callback(ret);
913
+ }
914
+ }
915
+
916
+ return 0;
917
+ }
918
+
896
919
  static int find_deltas(git_packbuilder *pb, git_pobject **list,
897
920
  unsigned int *list_size, unsigned int window,
898
921
  int depth)
@@ -918,6 +941,9 @@ static int find_deltas(git_packbuilder *pb, git_pobject **list,
918
941
  break;
919
942
  }
920
943
 
944
+ pb->nr_deltified += 1;
945
+ report_delta_progress(pb, pb->nr_deltified, false);
946
+
921
947
  po = *list++;
922
948
  (*list_size)--;
923
949
  git_packbuilder__progress_unlock(pb);
@@ -1290,6 +1316,8 @@ static int prepare_pack(git_packbuilder *pb)
1290
1316
  }
1291
1317
  }
1292
1318
 
1319
+ report_delta_progress(pb, pb->nr_objects, true);
1320
+
1293
1321
  pb->done = true;
1294
1322
  git__free(delta_list);
1295
1323
  return 0;