rugged 0.24.6.1 → 0.25.0b1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/ext/rugged/rugged_repo.c +44 -36
  3. data/lib/rugged/version.rb +1 -1
  4. data/vendor/libgit2/CMakeLists.txt +10 -21
  5. data/vendor/libgit2/include/git2/checkout.h +0 -7
  6. data/vendor/libgit2/include/git2/commit.h +46 -0
  7. data/vendor/libgit2/include/git2/common.h +1 -16
  8. data/vendor/libgit2/include/git2/odb.h +47 -1
  9. data/vendor/libgit2/include/git2/version.h +2 -2
  10. data/vendor/libgit2/src/array.h +0 -40
  11. data/vendor/libgit2/src/blame.c +3 -8
  12. data/vendor/libgit2/src/blame_git.c +9 -20
  13. data/vendor/libgit2/src/checkout.c +5 -13
  14. data/vendor/libgit2/src/commit.c +132 -52
  15. data/vendor/libgit2/src/common.h +1 -1
  16. data/vendor/libgit2/src/config_cache.c +1 -2
  17. data/vendor/libgit2/src/config_file.c +20 -14
  18. data/vendor/libgit2/src/delta-apply.c +5 -36
  19. data/vendor/libgit2/src/delta-apply.h +0 -12
  20. data/vendor/libgit2/src/describe.c +1 -2
  21. data/vendor/libgit2/src/diff_tform.c +3 -5
  22. data/vendor/libgit2/src/filebuf.c +1 -6
  23. data/vendor/libgit2/src/global.c +8 -28
  24. data/vendor/libgit2/src/global.h +0 -1
  25. data/vendor/libgit2/src/ignore.c +19 -56
  26. data/vendor/libgit2/src/index.c +8 -27
  27. data/vendor/libgit2/src/indexer.c +7 -11
  28. data/vendor/libgit2/src/iterator.c +2 -2
  29. data/vendor/libgit2/src/merge.c +0 -1
  30. data/vendor/libgit2/src/mwindow.c +19 -8
  31. data/vendor/libgit2/src/mwindow.h +2 -1
  32. data/vendor/libgit2/src/object.c +6 -3
  33. data/vendor/libgit2/src/odb.c +188 -48
  34. data/vendor/libgit2/src/odb_loose.c +1 -1
  35. data/vendor/libgit2/src/odb_pack.c +3 -0
  36. data/vendor/libgit2/src/openssl_stream.c +27 -60
  37. data/vendor/libgit2/src/openssl_stream.h +0 -106
  38. data/vendor/libgit2/src/pack-objects.c +2 -4
  39. data/vendor/libgit2/src/pack.c +9 -5
  40. data/vendor/libgit2/src/posix.c +0 -7
  41. data/vendor/libgit2/src/posix.h +0 -1
  42. data/vendor/libgit2/src/push.c +6 -6
  43. data/vendor/libgit2/src/refdb_fs.c +0 -1
  44. data/vendor/libgit2/src/refs.c +0 -3
  45. data/vendor/libgit2/src/refspec.c +2 -4
  46. data/vendor/libgit2/src/remote.c +5 -15
  47. data/vendor/libgit2/src/repository.c +21 -29
  48. data/vendor/libgit2/src/settings.c +1 -23
  49. data/vendor/libgit2/src/stransport_stream.c +9 -15
  50. data/vendor/libgit2/src/submodule.c +2 -3
  51. data/vendor/libgit2/src/sysdir.c +47 -41
  52. data/vendor/libgit2/src/sysdir.h +5 -0
  53. data/vendor/libgit2/src/tag.c +2 -8
  54. data/vendor/libgit2/src/thread-utils.h +51 -5
  55. data/vendor/libgit2/src/transports/http.c +3 -3
  56. data/vendor/libgit2/src/transports/smart_pkt.c +4 -13
  57. data/vendor/libgit2/src/transports/smart_protocol.c +17 -61
  58. data/vendor/libgit2/src/tree.c +100 -83
  59. data/vendor/libgit2/src/tree.h +5 -4
  60. data/vendor/libgit2/src/unix/map.c +0 -5
  61. data/vendor/libgit2/src/util.c +3 -3
  62. data/vendor/libgit2/src/win32/map.c +5 -24
  63. data/vendor/libgit2/src/win32/precompiled.h +1 -1
  64. data/vendor/libgit2/src/win32/{thread.c → pthread.c} +80 -50
  65. data/vendor/libgit2/src/win32/pthread.h +92 -0
  66. data/vendor/libgit2/src/xdiff/xprepare.c +1 -2
  67. metadata +7 -8
  68. data/vendor/libgit2/src/unix/pthread.h +0 -54
  69. data/vendor/libgit2/src/win32/thread.h +0 -62
@@ -13,7 +13,6 @@
13
13
  #include "posix.h"
14
14
  #include "stream.h"
15
15
  #include "socket_stream.h"
16
- #include "openssl_stream.h"
17
16
  #include "netops.h"
18
17
  #include "git2/transport.h"
19
18
  #include "git2/sys/openssl.h"
@@ -35,8 +34,6 @@
35
34
 
36
35
  SSL_CTX *git__ssl_ctx;
37
36
 
38
- #define GIT_SSL_DEFAULT_CIPHERS "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-DSS-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA:DHE-DSS-AES128-SHA256:DHE-DSS-AES256-SHA256:DHE-DSS-AES128-SHA:DHE-DSS-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA"
39
-
40
37
  #ifdef GIT_THREADS
41
38
 
42
39
  static git_mutex *openssl_locks;
@@ -72,20 +69,12 @@ static void shutdown_ssl_locking(void)
72
69
 
73
70
  #endif /* GIT_THREADS */
74
71
 
75
- static BIO_METHOD *git_stream_bio_method;
76
- static int init_bio_method(void);
77
-
78
72
  /**
79
73
  * This function aims to clean-up the SSL context which
80
74
  * we allocated.
81
75
  */
82
76
  static void shutdown_ssl(void)
83
77
  {
84
- if (git_stream_bio_method) {
85
- BIO_meth_free(git_stream_bio_method);
86
- git_stream_bio_method = NULL;
87
- }
88
-
89
78
  if (git__ssl_ctx) {
90
79
  SSL_CTX_free(git__ssl_ctx);
91
80
  git__ssl_ctx = NULL;
@@ -96,7 +85,6 @@ int git_openssl_stream_global_init(void)
96
85
  {
97
86
  #ifdef GIT_OPENSSL
98
87
  long ssl_opts = SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3;
99
- const char *ciphers = git_libgit2__ssl_ciphers();
100
88
 
101
89
  /* Older OpenSSL and MacOS OpenSSL doesn't have this */
102
90
  #ifdef SSL_OP_NO_COMPRESSION
@@ -120,23 +108,6 @@ int git_openssl_stream_global_init(void)
120
108
  git__ssl_ctx = NULL;
121
109
  return -1;
122
110
  }
123
-
124
- if (!ciphers) {
125
- ciphers = GIT_SSL_DEFAULT_CIPHERS;
126
- }
127
-
128
- if(!SSL_CTX_set_cipher_list(git__ssl_ctx, ciphers)) {
129
- SSL_CTX_free(git__ssl_ctx);
130
- git__ssl_ctx = NULL;
131
- return -1;
132
- }
133
-
134
- if (init_bio_method() < 0) {
135
- SSL_CTX_free(git__ssl_ctx);
136
- git__ssl_ctx = NULL;
137
- return -1;
138
- }
139
-
140
111
  #endif
141
112
 
142
113
  git__on_shutdown(shutdown_ssl);
@@ -172,8 +143,10 @@ int git_openssl_set_locking(void)
172
143
 
173
144
  static int bio_create(BIO *b)
174
145
  {
175
- BIO_set_init(b, 1);
176
- BIO_set_data(b, NULL);
146
+ b->init = 1;
147
+ b->num = 0;
148
+ b->ptr = NULL;
149
+ b->flags = 0;
177
150
 
178
151
  return 1;
179
152
  }
@@ -183,22 +156,23 @@ static int bio_destroy(BIO *b)
183
156
  if (!b)
184
157
  return 0;
185
158
 
186
- BIO_set_data(b, NULL);
159
+ b->init = 0;
160
+ b->num = 0;
161
+ b->ptr = NULL;
162
+ b->flags = 0;
187
163
 
188
164
  return 1;
189
165
  }
190
166
 
191
167
  static int bio_read(BIO *b, char *buf, int len)
192
168
  {
193
- git_stream *io = (git_stream *) BIO_get_data(b);
194
-
169
+ git_stream *io = (git_stream *) b->ptr;
195
170
  return (int) git_stream_read(io, buf, len);
196
171
  }
197
172
 
198
173
  static int bio_write(BIO *b, const char *buf, int len)
199
174
  {
200
- git_stream *io = (git_stream *) BIO_get_data(b);
201
-
175
+ git_stream *io = (git_stream *) b->ptr;
202
176
  return (int) git_stream_write(io, buf, len, 0);
203
177
  }
204
178
 
@@ -227,22 +201,17 @@ static int bio_puts(BIO *b, const char *str)
227
201
  return bio_write(b, str, strlen(str));
228
202
  }
229
203
 
230
- static int init_bio_method(void)
231
- {
232
- /* Set up the BIO_METHOD we use for wrapping our own stream implementations */
233
- git_stream_bio_method = BIO_meth_new(BIO_TYPE_SOURCE_SINK | BIO_get_new_index(), "git_stream");
234
- GITERR_CHECK_ALLOC(git_stream_bio_method);
235
-
236
- BIO_meth_set_write(git_stream_bio_method, bio_write);
237
- BIO_meth_set_read(git_stream_bio_method, bio_read);
238
- BIO_meth_set_puts(git_stream_bio_method, bio_puts);
239
- BIO_meth_set_gets(git_stream_bio_method, bio_gets);
240
- BIO_meth_set_ctrl(git_stream_bio_method, bio_ctrl);
241
- BIO_meth_set_create(git_stream_bio_method, bio_create);
242
- BIO_meth_set_destroy(git_stream_bio_method, bio_destroy);
243
-
244
- return 0;
245
- }
204
+ static BIO_METHOD git_stream_bio_method = {
205
+ BIO_TYPE_SOURCE_SINK,
206
+ "git_stream",
207
+ bio_write,
208
+ bio_read,
209
+ bio_puts,
210
+ bio_gets,
211
+ bio_ctrl,
212
+ bio_create,
213
+ bio_destroy
214
+ };
246
215
 
247
216
  static int ssl_set_error(SSL *ssl, int error)
248
217
  {
@@ -357,7 +326,7 @@ static int verify_server_cert(SSL *ssl, const char *host)
357
326
  num = sk_GENERAL_NAME_num(alts);
358
327
  for (i = 0; i < num && matched != 1; i++) {
359
328
  const GENERAL_NAME *gn = sk_GENERAL_NAME_value(alts, i);
360
- const char *name = (char *) ASN1_STRING_get0_data(gn->d.ia5);
329
+ const char *name = (char *) ASN1_STRING_data(gn->d.ia5);
361
330
  size_t namelen = (size_t) ASN1_STRING_length(gn->d.ia5);
362
331
 
363
332
  /* Skip any names of a type we're not looking for */
@@ -412,7 +381,7 @@ static int verify_server_cert(SSL *ssl, const char *host)
412
381
  if (size > 0) {
413
382
  peer_cn = OPENSSL_malloc(size + 1);
414
383
  GITERR_CHECK_ALLOC(peer_cn);
415
- memcpy(peer_cn, ASN1_STRING_get0_data(str), size);
384
+ memcpy(peer_cn, ASN1_STRING_data(str), size);
416
385
  peer_cn[size] = '\0';
417
386
  } else {
418
387
  goto cert_fail_name;
@@ -463,12 +432,11 @@ int openssl_connect(git_stream *stream)
463
432
 
464
433
  st->connected = true;
465
434
 
466
- bio = BIO_new(git_stream_bio_method);
435
+ bio = BIO_new(&git_stream_bio_method);
467
436
  GITERR_CHECK_ALLOC(bio);
437
+ bio->ptr = st->io;
468
438
 
469
- BIO_set_data(bio, st->io);
470
439
  SSL_set_bio(st->ssl, bio, bio);
471
-
472
440
  /* specify the host in case SNI is needed */
473
441
  #ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
474
442
  SSL_set_tlsext_host_name(st->ssl, st->host);
@@ -541,9 +509,8 @@ ssize_t openssl_read(git_stream *stream, void *data, size_t len)
541
509
  openssl_stream *st = (openssl_stream *) stream;
542
510
  int ret;
543
511
 
544
- if ((ret = SSL_read(st->ssl, data, len)) <= 0) {
545
- return ssl_set_error(st->ssl, ret);
546
- }
512
+ if ((ret = SSL_read(st->ssl, data, len)) <= 0)
513
+ ssl_set_error(st->ssl, ret);
547
514
 
548
515
  return ret;
549
516
  }
@@ -13,110 +13,4 @@ extern int git_openssl_stream_global_init(void);
13
13
 
14
14
  extern int git_openssl_stream_new(git_stream **out, const char *host, const char *port);
15
15
 
16
- /*
17
- * OpenSSL 1.1 made BIO opaque so we have to use functions to interact with it
18
- * which do not exist in previous versions. We define these inline functions so
19
- * we can program against the interface instead of littering the implementation
20
- * with ifdefs.
21
- */
22
- #ifdef GIT_OPENSSL
23
- # include <openssl/ssl.h>
24
- # include <openssl/err.h>
25
- # include <openssl/x509v3.h>
26
- # include <openssl/bio.h>
27
-
28
-
29
-
30
- # if OPENSSL_VERSION_NUMBER < 0x10100000L
31
-
32
- GIT_INLINE(BIO_METHOD*) BIO_meth_new(int type, const char *name)
33
- {
34
- BIO_METHOD *meth = git__calloc(1, sizeof(BIO_METHOD));
35
- if (!meth) {
36
- return NULL;
37
- }
38
-
39
- meth->type = type;
40
- meth->name = name;
41
-
42
- return meth;
43
- }
44
-
45
- GIT_INLINE(void) BIO_meth_free(BIO_METHOD *biom)
46
- {
47
- git__free(biom);
48
- }
49
-
50
- GIT_INLINE(int) BIO_meth_set_write(BIO_METHOD *biom, int (*write) (BIO *, const char *, int))
51
- {
52
- biom->bwrite = write;
53
- return 1;
54
- }
55
-
56
- GIT_INLINE(int) BIO_meth_set_read(BIO_METHOD *biom, int (*read) (BIO *, char *, int))
57
- {
58
- biom->bread = read;
59
- return 1;
60
- }
61
-
62
- GIT_INLINE(int) BIO_meth_set_puts(BIO_METHOD *biom, int (*puts) (BIO *, const char *))
63
- {
64
- biom->bputs = puts;
65
- return 1;
66
- }
67
-
68
- GIT_INLINE(int) BIO_meth_set_gets(BIO_METHOD *biom, int (*gets) (BIO *, char *, int))
69
-
70
- {
71
- biom->bgets = gets;
72
- return 1;
73
- }
74
-
75
- GIT_INLINE(int) BIO_meth_set_ctrl(BIO_METHOD *biom, long (*ctrl) (BIO *, int, long, void *))
76
- {
77
- biom->ctrl = ctrl;
78
- return 1;
79
- }
80
-
81
- GIT_INLINE(int) BIO_meth_set_create(BIO_METHOD *biom, int (*create) (BIO *))
82
- {
83
- biom->create = create;
84
- return 1;
85
- }
86
-
87
- GIT_INLINE(int) BIO_meth_set_destroy(BIO_METHOD *biom, int (*destroy) (BIO *))
88
- {
89
- biom->destroy = destroy;
90
- return 1;
91
- }
92
-
93
- GIT_INLINE(int) BIO_get_new_index(void)
94
- {
95
- /* This exists as of 1.1 so before we'd just have 0 */
96
- return 0;
97
- }
98
-
99
- GIT_INLINE(void) BIO_set_init(BIO *b, int init)
100
- {
101
- b->init = init;
102
- }
103
-
104
- GIT_INLINE(void) BIO_set_data(BIO *a, void *ptr)
105
- {
106
- a->ptr = ptr;
107
- }
108
-
109
- GIT_INLINE(void*) BIO_get_data(BIO *a)
110
- {
111
- return a->ptr;
112
- }
113
-
114
- GIT_INLINE(const unsigned char *) ASN1_STRING_get0_data(const ASN1_STRING *x)
115
- {
116
- return ASN1_STRING_data((ASN1_STRING *)x);
117
- }
118
-
119
- # endif // OpenSSL < 1.1
120
- #endif // GIT_OPENSSL
121
-
122
16
  #endif
@@ -848,10 +848,8 @@ static int try_delta(git_packbuilder *pb, struct unpacked *trg,
848
848
 
849
849
  git_packbuilder__cache_unlock(pb);
850
850
 
851
- if (overflow) {
852
- git__free(delta_buf);
851
+ if (overflow)
853
852
  return -1;
854
- }
855
853
 
856
854
  trg_object->delta_data = git__realloc(delta_buf, delta_size);
857
855
  GITERR_CHECK_ALLOC(trg_object->delta_data);
@@ -1186,7 +1184,7 @@ static int ll_find_deltas(git_packbuilder *pb, git_pobject **list,
1186
1184
  git_mutex_init(&p[i].mutex);
1187
1185
  git_cond_init(&p[i].cond);
1188
1186
 
1189
- ret = git_thread_create(&p[i].thread,
1187
+ ret = git_thread_create(&p[i].thread, NULL,
1190
1188
  threaded_find_deltas, &p[i]);
1191
1189
  if (ret) {
1192
1190
  giterr_set(GITERR_THREAD, "unable to create thread");
@@ -494,19 +494,21 @@ int git_packfile_resolve_header(
494
494
  int error;
495
495
 
496
496
  error = git_packfile_unpack_header(&size, &type, &p->mwf, &w_curs, &curpos);
497
+ git_mwindow_close(&w_curs);
497
498
  if (error < 0)
498
499
  return error;
499
500
 
500
501
  if (type == GIT_OBJ_OFS_DELTA || type == GIT_OBJ_REF_DELTA) {
501
502
  size_t base_size;
502
- git_packfile_stream stream;
503
-
503
+ git_rawobj delta;
504
504
  base_offset = get_delta_base(p, &w_curs, &curpos, type, offset);
505
505
  git_mwindow_close(&w_curs);
506
- if ((error = git_packfile_stream_open(&stream, p, curpos)) < 0)
506
+ error = packfile_unpack_compressed(&delta, p, &w_curs, &curpos, size, type);
507
+ git_mwindow_close(&w_curs);
508
+ if (error < 0)
507
509
  return error;
508
- error = git__delta_read_header_fromstream(&base_size, size_p, &stream);
509
- git_packfile_stream_free(&stream);
510
+ error = git__delta_read_header(delta.data, delta.len, &base_size, size_p);
511
+ git__free(delta.data);
510
512
  if (error < 0)
511
513
  return error;
512
514
  } else
@@ -515,6 +517,7 @@ int git_packfile_resolve_header(
515
517
  while (type == GIT_OBJ_OFS_DELTA || type == GIT_OBJ_REF_DELTA) {
516
518
  curpos = base_offset;
517
519
  error = git_packfile_unpack_header(&size, &type, &p->mwf, &w_curs, &curpos);
520
+ git_mwindow_close(&w_curs);
518
521
  if (error < 0)
519
522
  return error;
520
523
  if (type != GIT_OBJ_OFS_DELTA && type != GIT_OBJ_REF_DELTA)
@@ -582,6 +585,7 @@ static int pack_dependency_chain(git_dependency_chain *chain_out,
582
585
  elem->base_key = obj_offset;
583
586
 
584
587
  error = git_packfile_unpack_header(&size, &type, &p->mwf, &w_curs, &curpos);
588
+ git_mwindow_close(&w_curs);
585
589
 
586
590
  if (error < 0)
587
591
  goto on_error;
@@ -224,13 +224,6 @@ int git__page_size(size_t *page_size)
224
224
  return 0;
225
225
  }
226
226
 
227
- int git__mmap_alignment(size_t *alignment)
228
- {
229
- /* dummy; here we don't need any alignment anyway */
230
- *alignment = 4096;
231
- return 0;
232
- }
233
-
234
227
 
235
228
  int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offset)
236
229
  {
@@ -109,7 +109,6 @@ extern int p_getcwd(char *buffer_out, size_t size);
109
109
  extern int p_rename(const char *from, const char *to);
110
110
 
111
111
  extern int git__page_size(size_t *page_size);
112
- extern int git__mmap_alignment(size_t *page_size);
113
112
 
114
113
  /**
115
114
  * Platform-dependent methods
@@ -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
 
@@ -962,7 +962,6 @@ 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);
966
965
 
967
966
  if (packed_find_peel(backend, ref) < 0)
968
967
  goto fail;
@@ -289,9 +289,6 @@ cleanup:
289
289
  "Could not use '%s' as valid reference name", git_buf_cstr(&name));
290
290
  }
291
291
 
292
- if (error == GIT_ENOTFOUND)
293
- giterr_set(GITERR_REFERENCE, "no reference found for shorthand '%s'", refname);
294
-
295
292
  git_buf_free(&name);
296
293
  git_buf_free(&refnamebuf);
297
294
  return error;
@@ -53,10 +53,8 @@ int git_refspec__parse(git_refspec *refspec, const char *input, bool is_fetch)
53
53
 
54
54
  if (rhs) {
55
55
  size_t rlen = strlen(++rhs);
56
- if (rlen || !is_fetch) {
57
- is_glob = (1 <= rlen && strchr(rhs, '*'));
58
- refspec->dst = git__strndup(rhs, rlen);
59
- }
56
+ is_glob = (1 <= rlen && strchr(rhs, '*'));
57
+ refspec->dst = git__strndup(rhs, rlen);
60
58
  }
61
59
 
62
60
  llen = (rhs ? (size_t)(rhs - lhs - 1) : strlen(lhs));