rugged 0.24.0b9 → 0.24.0b11

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5974c78d60b9c20faf50ac2b55194b33642a0645
4
- data.tar.gz: 1bd653d666e62f551e46cdad7973c9bf7942dd3f
3
+ metadata.gz: 35c31e3f98a02a4d6608d6ef7f8b6456e4cccd50
4
+ data.tar.gz: 80737d111cc76ea74882b0c65ee2eac6e01bbf44
5
5
  SHA512:
6
- metadata.gz: c14940177eeeafd9371ed0eefe67369d06fe7fa50b39359aa375d08210d4b8ffe7a7c3e646b8f363f940ecd1dd6d969324338e45a190f38ff5a3653d8b8d7406
7
- data.tar.gz: 61a47e6c4e1fd99338244e814fef4c84cc6eda651d2e8ae96698738fd2961c7f20597f0d20e66bed74cddc23d5c5714a5b89a246cd9793ac36d5baa98a29cf74
6
+ metadata.gz: 5f804e4bdc3a71f54c4b0dd7aa73adf2e9fdb9e5ca4d01b167a338a171496c2b06ceacf4b9f99092cea3d9e175ec081bd22a0703335822545f329db0d16c5f47
7
+ data.tar.gz: 330afdcb7d42082175e3d174aabbc41743156e535a97358d312e1ebbbcb2cb5822dde0e6641bba7c938edc89907ab500ca83ebb441414e4c93772394105ae95f
@@ -1,3 +1,3 @@
1
1
  module Rugged
2
- Version = VERSION = '0.24.0b9'
2
+ Version = VERSION = '0.24.0b11'
3
3
  end
@@ -74,8 +74,8 @@ typedef struct git_blame_options {
74
74
  uint16_t min_match_characters;
75
75
  git_oid newest_commit;
76
76
  git_oid oldest_commit;
77
- uint32_t min_line;
78
- uint32_t max_line;
77
+ size_t min_line;
78
+ size_t max_line;
79
79
  } git_blame_options;
80
80
 
81
81
  #define GIT_BLAME_OPTIONS_VERSION 1
@@ -113,15 +113,15 @@ GIT_EXTERN(int) git_blame_init_options(
113
113
  * root, or the commit specified in git_blame_options.oldest_commit)
114
114
  */
115
115
  typedef struct git_blame_hunk {
116
- uint16_t lines_in_hunk;
116
+ size_t lines_in_hunk;
117
117
 
118
118
  git_oid final_commit_id;
119
- uint16_t final_start_line_number;
119
+ size_t final_start_line_number;
120
120
  git_signature *final_signature;
121
121
 
122
122
  git_oid orig_commit_id;
123
123
  const char *orig_path;
124
- uint16_t orig_start_line_number;
124
+ size_t orig_start_line_number;
125
125
  git_signature *orig_signature;
126
126
 
127
127
  char boundary;
@@ -156,7 +156,7 @@ GIT_EXTERN(const git_blame_hunk*) git_blame_get_hunk_byindex(
156
156
  */
157
157
  GIT_EXTERN(const git_blame_hunk*) git_blame_get_hunk_byline(
158
158
  git_blame *blame,
159
- uint32_t lineno);
159
+ size_t lineno);
160
160
 
161
161
  /**
162
162
  * Get the blame for a single file.
@@ -171,8 +171,8 @@ typedef int (*git_blob_chunk_cb)(char *content, size_t max_length, void *payload
171
171
  * - The `callback` must return the number of bytes that have been
172
172
  * written to the `content` buffer.
173
173
  *
174
- * - When there is no more data to stream, `callback` should return
175
- * 0. This will prevent it from being invoked anymore.
174
+ * - When there is no more data to stream, `callback` should return 0.
175
+ * This will prevent it from being invoked anymore.
176
176
  *
177
177
  * - If an error occurs, the callback should return a negative value.
178
178
  * This value will be returned to the caller.
@@ -127,6 +127,19 @@ GIT_EXTERN(const char *) git_commit_message_raw(const git_commit *commit);
127
127
  */
128
128
  GIT_EXTERN(const char *) git_commit_summary(git_commit *commit);
129
129
 
130
+ /**
131
+ * Get the long "body" of the git commit message.
132
+ *
133
+ * The returned message is the body of the commit, comprising
134
+ * everything but the first paragraph of the message. Leading and
135
+ * trailing whitespaces are trimmed.
136
+ *
137
+ * @param commit a previously loaded commit.
138
+ * @return the body of a commit or NULL when no the message only
139
+ * consists of a summary
140
+ */
141
+ GIT_EXTERN(const char *) git_commit_body(git_commit *commit);
142
+
130
143
  /**
131
144
  * Get the commit time (i.e. committer time) of a commit.
132
145
  *
@@ -1286,12 +1286,15 @@ typedef struct {
1286
1286
  /** Summary of the change */
1287
1287
  const char *summary;
1288
1288
 
1289
+ /** Commit message's body */
1290
+ const char *body;
1291
+
1289
1292
  /** Author of the change */
1290
1293
  const git_signature *author;
1291
1294
  } git_diff_format_email_options;
1292
1295
 
1293
1296
  #define GIT_DIFF_FORMAT_EMAIL_OPTIONS_VERSION 1
1294
- #define GIT_DIFF_FORMAT_EMAIL_OPTIONS_INIT {GIT_DIFF_FORMAT_EMAIL_OPTIONS_VERSION, 0, 1, 1, NULL, NULL, NULL}
1297
+ #define GIT_DIFF_FORMAT_EMAIL_OPTIONS_INIT {GIT_DIFF_FORMAT_EMAIL_OPTIONS_VERSION, 0, 1, 1, NULL, NULL, NULL, NULL}
1295
1298
 
1296
1299
  /**
1297
1300
  * Create an e-mail ready patch from a diff.
@@ -23,8 +23,8 @@ static int hunk_byfinalline_search_cmp(const void *key, const void *entry)
23
23
  git_blame_hunk *hunk = (git_blame_hunk*)entry;
24
24
 
25
25
  size_t lineno = *(size_t*)key;
26
- size_t lines_in_hunk = (size_t)hunk->lines_in_hunk;
27
- size_t final_start_line_number = (size_t)hunk->final_start_line_number;
26
+ size_t lines_in_hunk = hunk->lines_in_hunk;
27
+ size_t final_start_line_number = hunk->final_start_line_number;
28
28
 
29
29
  if (lineno < final_start_line_number)
30
30
  return -1;
@@ -44,7 +44,7 @@ static int hunk_cmp(const void *_a, const void *_b)
44
44
 
45
45
  static bool hunk_ends_at_or_before_line(git_blame_hunk *hunk, size_t line)
46
46
  {
47
- return line >= (size_t)(hunk->final_start_line_number + hunk->lines_in_hunk - 1);
47
+ return line >= (hunk->final_start_line_number + hunk->lines_in_hunk - 1);
48
48
  }
49
49
 
50
50
  static bool hunk_starts_at_or_after_line(git_blame_hunk *hunk, size_t line)
@@ -53,9 +53,9 @@ static bool hunk_starts_at_or_after_line(git_blame_hunk *hunk, size_t line)
53
53
  }
54
54
 
55
55
  static git_blame_hunk* new_hunk(
56
- uint16_t start,
57
- uint16_t lines,
58
- uint16_t orig_start,
56
+ size_t start,
57
+ size_t lines,
58
+ size_t orig_start,
59
59
  const char *path)
60
60
  {
61
61
  git_blame_hunk *hunk = git__calloc(1, sizeof(git_blame_hunk));
@@ -166,9 +166,9 @@ const git_blame_hunk *git_blame_get_hunk_byindex(git_blame *blame, uint32_t inde
166
166
  return (git_blame_hunk*)git_vector_get(&blame->hunks, index);
167
167
  }
168
168
 
169
- const git_blame_hunk *git_blame_get_hunk_byline(git_blame *blame, uint32_t lineno)
169
+ const git_blame_hunk *git_blame_get_hunk_byline(git_blame *blame, size_t lineno)
170
170
  {
171
- size_t i, new_lineno = (size_t)lineno;
171
+ size_t i, new_lineno = lineno;
172
172
  assert(blame);
173
173
 
174
174
  if (!git_vector_bsearch2(&i, &blame->hunks, hunk_byfinalline_search_cmp, &new_lineno)) {
@@ -223,8 +223,8 @@ static git_blame_hunk *split_hunk_in_vector(
223
223
  }
224
224
 
225
225
  new_line_count = hunk->lines_in_hunk - rel_line;
226
- nh = new_hunk((uint16_t)(hunk->final_start_line_number+rel_line), (uint16_t)new_line_count,
227
- (uint16_t)(hunk->orig_start_line_number+rel_line), hunk->orig_path);
226
+ nh = new_hunk(hunk->final_start_line_number + rel_line, new_line_count,
227
+ hunk->orig_start_line_number + rel_line, hunk->orig_path);
228
228
 
229
229
  if (!nh)
230
230
  return NULL;
@@ -233,7 +233,7 @@ static git_blame_hunk *split_hunk_in_vector(
233
233
  git_oid_cpy(&nh->orig_commit_id, &hunk->orig_commit_id);
234
234
 
235
235
  /* Adjust hunk that was split */
236
- hunk->lines_in_hunk -= (uint16_t)new_line_count;
236
+ hunk->lines_in_hunk -= new_line_count;
237
237
  git_vector_insert_sorted(vec, nh, NULL);
238
238
  {
239
239
  git_blame_hunk *ret = return_new ? nh : hunk;
@@ -442,7 +442,7 @@ static int buffer_line_cb(
442
442
  } else {
443
443
  /* Create a new buffer-blame hunk with this line */
444
444
  shift_hunks_by(&blame->hunks, blame->current_diff_line, 1);
445
- blame->current_hunk = new_hunk((uint16_t)blame->current_diff_line, 1, 0, blame->path);
445
+ blame->current_hunk = new_hunk(blame->current_diff_line, 1, 0, blame->path);
446
446
  GITERR_CHECK_ALLOC(blame->current_hunk);
447
447
 
448
448
  git_vector_insert_sorted(&blame->hunks, blame->current_hunk, NULL);
@@ -31,10 +31,10 @@ typedef struct git_blame__entry {
31
31
  /* the first line of this group in the final image;
32
32
  * internally all line numbers are 0 based.
33
33
  */
34
- int lno;
34
+ size_t lno;
35
35
 
36
36
  /* how many lines this group has */
37
- int num_lines;
37
+ size_t num_lines;
38
38
 
39
39
  /* the commit that introduced this group into the final image */
40
40
  git_blame__origin *suspect;
@@ -51,7 +51,7 @@ typedef struct git_blame__entry {
51
51
  /* the line number of the first line of this group in the
52
52
  * suspect's file; internally all line numbers are 0 based.
53
53
  */
54
- int s_lno;
54
+ size_t s_lno;
55
55
 
56
56
  /* how significant this entry is -- cached to avoid
57
57
  * scanning the lines over and over.
@@ -93,18 +93,25 @@ static bool same_suspect(git_blame__origin *a, git_blame__origin *b)
93
93
  }
94
94
 
95
95
  /* find the line number of the last line the target is suspected for */
96
- static int find_last_in_target(git_blame *blame, git_blame__origin *target)
96
+ static bool find_last_in_target(size_t *out, git_blame *blame, git_blame__origin *target)
97
97
  {
98
98
  git_blame__entry *e;
99
- int last_in_target = -1;
99
+ size_t last_in_target = 0;
100
+ bool found = false;
101
+
102
+ *out = 0;
100
103
 
101
104
  for (e=blame->ent; e; e=e->next) {
102
105
  if (e->guilty || !same_suspect(e->suspect, target))
103
106
  continue;
104
- if (last_in_target < e->s_lno + e->num_lines)
107
+ if (last_in_target < e->s_lno + e->num_lines) {
108
+ found = true;
105
109
  last_in_target = e->s_lno + e->num_lines;
110
+ }
106
111
  }
107
- return last_in_target;
112
+
113
+ *out = last_in_target;
114
+ return found;
108
115
  }
109
116
 
110
117
  /*
@@ -122,9 +129,9 @@ static int find_last_in_target(git_blame *blame, git_blame__origin *target)
122
129
  * to be blamed for the parent, and after that portion.
123
130
  */
124
131
  static void split_overlap(git_blame__entry *split, git_blame__entry *e,
125
- int tlno, int plno, int same, git_blame__origin *parent)
132
+ size_t tlno, size_t plno, size_t same, git_blame__origin *parent)
126
133
  {
127
- int chunk_end_lno;
134
+ size_t chunk_end_lno;
128
135
 
129
136
  if (e->s_lno < tlno) {
130
137
  /* there is a pre-chunk part not blamed on the parent */
@@ -265,9 +272,9 @@ static void decref_split(git_blame__entry *split)
265
272
  static void blame_overlap(
266
273
  git_blame *blame,
267
274
  git_blame__entry *e,
268
- int tlno,
269
- int plno,
270
- int same,
275
+ size_t tlno,
276
+ size_t plno,
277
+ size_t same,
271
278
  git_blame__origin *parent)
272
279
  {
273
280
  git_blame__entry split[3] = {{0}};
@@ -285,9 +292,9 @@ static void blame_overlap(
285
292
  */
286
293
  static void blame_chunk(
287
294
  git_blame *blame,
288
- int tlno,
289
- int plno,
290
- int same,
295
+ size_t tlno,
296
+ size_t plno,
297
+ size_t same,
291
298
  git_blame__origin *target,
292
299
  git_blame__origin *parent)
293
300
  {
@@ -314,7 +321,7 @@ static int my_emit(
314
321
  blame_chunk(d->blame, d->tlno, d->plno, start_b, d->target, d->parent);
315
322
  d->plno = start_a + count_a;
316
323
  d->tlno = start_b + count_b;
317
-
324
+
318
325
  return 0;
319
326
  }
320
327
 
@@ -376,12 +383,11 @@ static int pass_blame_to_parent(
376
383
  git_blame__origin *target,
377
384
  git_blame__origin *parent)
378
385
  {
379
- int last_in_target;
386
+ size_t last_in_target;
380
387
  mmfile_t file_p, file_o;
381
388
  blame_chunk_cb_data d = { blame, target, parent, 0, 0 };
382
389
 
383
- last_in_target = find_last_in_target(blame, target);
384
- if (last_in_target < 0)
390
+ if (!find_last_in_target(&last_in_target, blame, target))
385
391
  return 1; /* nothing remains for this target */
386
392
 
387
393
  fill_origin_blob(parent, &file_p);
@@ -31,6 +31,7 @@ void git_commit__free(void *_commit)
31
31
  git__free(commit->raw_message);
32
32
  git__free(commit->message_encoding);
33
33
  git__free(commit->summary);
34
+ git__free(commit->body);
34
35
 
35
36
  git__free(commit);
36
37
  }
@@ -472,6 +473,33 @@ const char *git_commit_summary(git_commit *commit)
472
473
  return commit->summary;
473
474
  }
474
475
 
476
+ const char *git_commit_body(git_commit *commit)
477
+ {
478
+ const char *msg, *end;
479
+
480
+ assert(commit);
481
+
482
+ if (!commit->body) {
483
+ /* search for end of summary */
484
+ for (msg = git_commit_message(commit); *msg; ++msg)
485
+ if (msg[0] == '\n' && (!msg[1] || msg[1] == '\n'))
486
+ break;
487
+
488
+ /* trim leading and trailing whitespace */
489
+ for (; *msg; ++msg)
490
+ if (!git__isspace(*msg))
491
+ break;
492
+ for (end = msg + strlen(msg) - 1; msg <= end; --end)
493
+ if (!git__isspace(*end))
494
+ break;
495
+
496
+ if (*msg)
497
+ commit->body = git__strndup(msg, end - msg + 1);
498
+ }
499
+
500
+ return commit->body;
501
+ }
502
+
475
503
  int git_commit_tree(git_tree **tree_out, const git_commit *commit)
476
504
  {
477
505
  assert(commit);
@@ -28,6 +28,7 @@ struct git_commit {
28
28
  char *raw_header;
29
29
 
30
30
  char *summary;
31
+ char *body;
31
32
  };
32
33
 
33
34
  void git_commit__free(void *commit);
@@ -1659,6 +1659,7 @@ int git_diff_format_email__append_header_tobuf(
1659
1659
  const git_oid *id,
1660
1660
  const git_signature *author,
1661
1661
  const char *summary,
1662
+ const char *body,
1662
1663
  size_t patch_no,
1663
1664
  size_t total_patches,
1664
1665
  bool exclude_patchno_marker)
@@ -1698,6 +1699,13 @@ int git_diff_format_email__append_header_tobuf(
1698
1699
 
1699
1700
  error = git_buf_printf(out, "%s\n\n", summary);
1700
1701
 
1702
+ if (body) {
1703
+ git_buf_puts(out, body);
1704
+
1705
+ if (out->ptr[out->size - 1] != '\n')
1706
+ git_buf_putc(out, '\n');
1707
+ }
1708
+
1701
1709
  return error;
1702
1710
  }
1703
1711
 
@@ -1775,7 +1783,7 @@ int git_diff_format_email(
1775
1783
 
1776
1784
  error = git_diff_format_email__append_header_tobuf(out,
1777
1785
  opts->id, opts->author, summary == NULL ? opts->summary : summary,
1778
- opts->patch_no, opts->total_patches, ignore_marker);
1786
+ opts->body, opts->patch_no, opts->total_patches, ignore_marker);
1779
1787
 
1780
1788
  if (error < 0)
1781
1789
  goto on_error;
@@ -1818,6 +1826,7 @@ int git_diff_commit_as_email(
1818
1826
  opts.total_patches = total_patches;
1819
1827
  opts.id = git_commit_id(commit);
1820
1828
  opts.summary = git_commit_summary(commit);
1829
+ opts.body = git_commit_body(commit);
1821
1830
  opts.author = git_commit_author(commit);
1822
1831
 
1823
1832
  if ((error = git_diff__commit(&diff, repo, commit, diff_opts)) < 0)
@@ -70,6 +70,7 @@ static kh_inline khint_t idxentry_hash(const git_index_entry *e)
70
70
  #define git_idxmap_valid_index(h, idx) (idx != kh_end(h))
71
71
  #define git_idxmap_has_data(h, idx) kh_exist(h, idx)
72
72
 
73
+ #define git_idxmap_resize(h,s) kh_resize(idx, h, s)
73
74
  #define git_idxmap_free(h) kh_destroy(idx, h), h = NULL
74
75
  #define git_idxmap_clear(h) kh_clear(idx, h)
75
76
 
@@ -879,6 +879,18 @@ void git_index_entry__init_from_stat(
879
879
  entry->file_size = st->st_size;
880
880
  }
881
881
 
882
+ static void index_entry_adjust_namemask(
883
+ git_index_entry *entry,
884
+ size_t path_length)
885
+ {
886
+ entry->flags &= ~GIT_IDXENTRY_NAMEMASK;
887
+
888
+ if (path_length < GIT_IDXENTRY_NAMEMASK)
889
+ entry->flags |= path_length & GIT_IDXENTRY_NAMEMASK;
890
+ else
891
+ entry->flags |= GIT_IDXENTRY_NAMEMASK;
892
+ }
893
+
882
894
  static int index_entry_create(
883
895
  git_index_entry **out,
884
896
  git_repository *repo,
@@ -1279,13 +1291,7 @@ static int index_insert(
1279
1291
 
1280
1292
  /* make sure that the path length flag is correct */
1281
1293
  path_length = ((struct entry_internal *)entry)->pathlen;
1282
-
1283
- entry->flags &= ~GIT_IDXENTRY_NAMEMASK;
1284
-
1285
- if (path_length < GIT_IDXENTRY_NAMEMASK)
1286
- entry->flags |= path_length & GIT_IDXENTRY_NAMEMASK;
1287
- else
1288
- entry->flags |= GIT_IDXENTRY_NAMEMASK;
1294
+ index_entry_adjust_namemask(entry, path_length);
1289
1295
 
1290
1296
  /* this entry is now up-to-date and should not be checked for raciness */
1291
1297
  entry->flags_extended |= GIT_IDXENTRY_UPTODATE;
@@ -1542,6 +1548,50 @@ int git_index_remove_bypath(git_index *index, const char *path)
1542
1548
  return 0;
1543
1549
  }
1544
1550
 
1551
+ int git_index__fill(git_index *index, const git_vector *source_entries)
1552
+ {
1553
+ const git_index_entry *source_entry = NULL;
1554
+ size_t i;
1555
+ int ret = 0;
1556
+
1557
+ assert(index);
1558
+
1559
+ if (!source_entries->length)
1560
+ return 0;
1561
+
1562
+ if (git_mutex_lock(&index->lock) < 0) {
1563
+ giterr_set(GITERR_OS, "Unable to acquire index lock");
1564
+ return -1;
1565
+ }
1566
+
1567
+ git_vector_size_hint(&index->entries, source_entries->length);
1568
+ git_idxmap_resize(index->entries_map, source_entries->length * 1.3);
1569
+
1570
+ git_vector_foreach(source_entries, i, source_entry) {
1571
+ git_index_entry *entry = NULL;
1572
+
1573
+ if ((ret = index_entry_dup(&entry, index, source_entry)) < 0)
1574
+ break;
1575
+
1576
+ index_entry_adjust_namemask(entry, ((struct entry_internal *)entry)->pathlen);
1577
+ entry->flags_extended |= GIT_IDXENTRY_UPTODATE;
1578
+ entry->mode = git_index__create_mode(entry->mode);
1579
+
1580
+ if ((ret = git_vector_insert(&index->entries, entry)) < 0)
1581
+ break;
1582
+
1583
+ INSERT_IN_MAP(index, entry, ret);
1584
+ if (ret < 0)
1585
+ break;
1586
+ }
1587
+
1588
+ if (!ret)
1589
+ git_vector_sort(&index->entries);
1590
+
1591
+ git_mutex_unlock(&index->lock);
1592
+ return ret;
1593
+ }
1594
+
1545
1595
 
1546
1596
  int git_index_add(git_index *index, const git_index_entry *source_entry)
1547
1597
  {
@@ -2852,11 +2902,7 @@ static int read_tree_cb(
2852
2902
  entry->flags_extended = 0;
2853
2903
  }
2854
2904
 
2855
- if (path.size < GIT_IDXENTRY_NAMEMASK)
2856
- entry->flags = path.size & GIT_IDXENTRY_NAMEMASK;
2857
- else
2858
- entry->flags = GIT_IDXENTRY_NAMEMASK;
2859
-
2905
+ index_entry_adjust_namemask(entry, path.size);
2860
2906
  git_buf_free(&path);
2861
2907
 
2862
2908
  if (git_vector_insert(data->new_entries, entry) < 0) {
@@ -3014,7 +3060,7 @@ int git_index_read_index(
3014
3060
  INSERT_IN_MAP_EX(index, new_entries_map, add_entry, error);
3015
3061
  }
3016
3062
 
3017
- if (remove_entry && !error)
3063
+ if (remove_entry && error >= 0)
3018
3064
  error = git_vector_insert(&remove_entries, remove_entry);
3019
3065
 
3020
3066
  if (error < 0) {
@@ -113,6 +113,8 @@ GIT_INLINE(bool) git_index_entry_newer_than_index(
113
113
  extern int git_index__find_pos(
114
114
  size_t *at_pos, git_index *index, const char *path, size_t path_len, int stage);
115
115
 
116
+ extern int git_index__fill(git_index *index, const git_vector *source_entries);
117
+
116
118
  extern void git_index__set_ignore_case(git_index *index, bool ignore_case);
117
119
 
118
120
  extern unsigned int git_index__create_mode(unsigned int mode);
@@ -1739,7 +1739,6 @@ static int index_from_diff_list(git_index **out,
1739
1739
  {
1740
1740
  git_index *index;
1741
1741
  size_t i;
1742
- git_index_entry *entry;
1743
1742
  git_merge_diff *conflict;
1744
1743
  int error = 0;
1745
1744
 
@@ -1748,10 +1747,8 @@ static int index_from_diff_list(git_index **out,
1748
1747
  if ((error = git_index_new(&index)) < 0)
1749
1748
  return error;
1750
1749
 
1751
- git_vector_foreach(&diff_list->staged, i, entry) {
1752
- if ((error = git_index_add(index, entry)) < 0)
1753
- goto on_error;
1754
- }
1750
+ if ((error = git_index__fill(index, &diff_list->staged)) < 0)
1751
+ goto on_error;
1755
1752
 
1756
1753
  git_vector_foreach(&diff_list->conflicts, i, conflict) {
1757
1754
  const git_index_entry *ancestor =
@@ -930,7 +930,10 @@ replay:
930
930
  cred_error = t->owner->cred_acquire_cb(&t->cred, t->owner->url,
931
931
  t->connection_data.user, allowed_types, t->owner->cred_acquire_payload);
932
932
 
933
- if (cred_error < 0)
933
+ /* Treat GIT_PASSTHROUGH as though git_cred_acquire_cb isn't set */
934
+ if (cred_error == GIT_PASSTHROUGH)
935
+ cred_error = 1;
936
+ else if (cred_error < 0)
934
937
  return cred_error;
935
938
  }
936
939
 
@@ -40,6 +40,13 @@ GIT_INLINE(int) resize_vector(git_vector *v, size_t new_size)
40
40
  return 0;
41
41
  }
42
42
 
43
+ int git_vector_size_hint(git_vector *v, size_t size_hint)
44
+ {
45
+ if (v->_alloc_size >= size_hint)
46
+ return 0;
47
+ return resize_vector(v, size_hint);
48
+ }
49
+
43
50
  int git_vector_dup(git_vector *v, const git_vector *src, git_vector_cmp cmp)
44
51
  {
45
52
  size_t bytes;
@@ -32,6 +32,7 @@ void git_vector_free_deep(git_vector *v); /* free each entry and self */
32
32
  void git_vector_clear(git_vector *v);
33
33
  int git_vector_dup(git_vector *v, const git_vector *src, git_vector_cmp cmp);
34
34
  void git_vector_swap(git_vector *a, git_vector *b);
35
+ int git_vector_size_hint(git_vector *v, size_t size_hint);
35
36
 
36
37
  void **git_vector_detach(size_t *size, size_t *asize, git_vector *v);
37
38
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rugged
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.24.0b9
4
+ version: 0.24.0b11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Chacon
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-12-10 00:00:00.000000000 Z
12
+ date: 2015-12-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake-compiler