rugged 0.28.4.1 → 0.28.5
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 +4 -4
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/AUTHORS +1 -0
- data/vendor/libgit2/include/git2/version.h +2 -2
- data/vendor/libgit2/src/apply.c +29 -15
- data/vendor/libgit2/src/attrcache.c +1 -1
- data/vendor/libgit2/src/blame.c +1 -1
- data/vendor/libgit2/src/buffer.c +14 -7
- data/vendor/libgit2/src/cherrypick.c +2 -2
- data/vendor/libgit2/src/diff.c +10 -2
- data/vendor/libgit2/src/diff_generate.c +122 -72
- data/vendor/libgit2/src/fetchhead.c +35 -3
- data/vendor/libgit2/src/filebuf.c +5 -9
- data/vendor/libgit2/src/filebuf.h +1 -1
- data/vendor/libgit2/src/fileops.c +1 -0
- data/vendor/libgit2/src/global.c +12 -40
- data/vendor/libgit2/src/global.h +0 -2
- data/vendor/libgit2/src/ignore.c +6 -3
- data/vendor/libgit2/src/integer.h +28 -0
- data/vendor/libgit2/src/iterator.c +8 -7
- data/vendor/libgit2/src/merge.c +3 -3
- data/vendor/libgit2/src/netops.c +29 -0
- data/vendor/libgit2/src/netops.h +3 -0
- data/vendor/libgit2/src/patch_generate.c +1 -1
- data/vendor/libgit2/src/patch_parse.c +100 -24
- data/vendor/libgit2/src/refdb_fs.c +4 -1
- data/vendor/libgit2/src/refs.c +5 -0
- data/vendor/libgit2/src/repository.c +7 -4
- data/vendor/libgit2/src/revert.c +2 -2
- data/vendor/libgit2/src/sysdir.c +11 -1
- data/vendor/libgit2/src/transaction.c +7 -1
- data/vendor/libgit2/src/transports/smart_pkt.c +1 -1
- data/vendor/libgit2/src/transports/winhttp.c +6 -1
- data/vendor/libgit2/src/unix/posix.h +1 -1
- data/vendor/libgit2/src/win32/thread.c +0 -5
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a520ac9fb1ac94fe6c890408004acaca2aacc597ae9b1ba5be720c09ef7aa65
|
4
|
+
data.tar.gz: 208ae60e1ad7b01bcfb2317a81267b5139e8874496c9a46f5410e1b87b2801f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b9ec4638789d9cccab65aba6208c6fe713dd289a228b050f4fc1887897930247f43daa64f43adcdf5955b77095b60b95d3bd70b846c69df119a7a1be46bab92
|
7
|
+
data.tar.gz: 10fb00b82a494e72e704eb1e2ab2eae9545ba972c98f5dfabcb523d5c7fdb523d7cb16d8c97dfb2bc428100c47e98a76a52ce366e1fb6a0a842b571b68c37e65
|
data/lib/rugged/version.rb
CHANGED
data/vendor/libgit2/AUTHORS
CHANGED
@@ -7,10 +7,10 @@
|
|
7
7
|
#ifndef INCLUDE_git_version_h__
|
8
8
|
#define INCLUDE_git_version_h__
|
9
9
|
|
10
|
-
#define LIBGIT2_VERSION "0.28.
|
10
|
+
#define LIBGIT2_VERSION "0.28.5"
|
11
11
|
#define LIBGIT2_VER_MAJOR 0
|
12
12
|
#define LIBGIT2_VER_MINOR 28
|
13
|
-
#define LIBGIT2_VER_REVISION
|
13
|
+
#define LIBGIT2_VER_REVISION 5
|
14
14
|
#define LIBGIT2_VER_PATCH 0
|
15
15
|
|
16
16
|
#define LIBGIT2_SOVERSION 28
|
data/vendor/libgit2/src/apply.c
CHANGED
@@ -59,7 +59,7 @@ static int patch_image_init_fromstr(
|
|
59
59
|
git_pool_init(&out->pool, sizeof(git_diff_line));
|
60
60
|
|
61
61
|
for (start = in; start < in + in_len; start = end) {
|
62
|
-
end = memchr(start, '\n', in_len);
|
62
|
+
end = memchr(start, '\n', in_len - (start - in));
|
63
63
|
|
64
64
|
if (end == NULL)
|
65
65
|
end = in + in_len;
|
@@ -199,23 +199,34 @@ static int apply_hunk(
|
|
199
199
|
|
200
200
|
for (i = 0; i < hunk->line_count; i++) {
|
201
201
|
size_t linenum = hunk->line_start + i;
|
202
|
-
git_diff_line *line = git_array_get(patch->lines, linenum);
|
202
|
+
git_diff_line *line = git_array_get(patch->lines, linenum), *prev;
|
203
203
|
|
204
204
|
if (!line) {
|
205
205
|
error = apply_err("preimage does not contain line %"PRIuZ, linenum);
|
206
206
|
goto done;
|
207
207
|
}
|
208
208
|
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
209
|
+
switch (line->origin) {
|
210
|
+
case GIT_DIFF_LINE_CONTEXT_EOFNL:
|
211
|
+
case GIT_DIFF_LINE_DEL_EOFNL:
|
212
|
+
case GIT_DIFF_LINE_ADD_EOFNL:
|
213
|
+
prev = i ? git_array_get(patch->lines, linenum - 1) : NULL;
|
214
|
+
if (prev && prev->content[prev->content_len - 1] == '\n')
|
215
|
+
prev->content_len -= 1;
|
216
|
+
break;
|
217
|
+
case GIT_DIFF_LINE_CONTEXT:
|
218
|
+
if ((error = git_vector_insert(&preimage.lines, line)) < 0 ||
|
219
|
+
(error = git_vector_insert(&postimage.lines, line)) < 0)
|
220
|
+
goto done;
|
221
|
+
break;
|
222
|
+
case GIT_DIFF_LINE_DELETION:
|
223
|
+
if ((error = git_vector_insert(&preimage.lines, line)) < 0)
|
224
|
+
goto done;
|
225
|
+
break;
|
226
|
+
case GIT_DIFF_LINE_ADDITION:
|
227
|
+
if ((error = git_vector_insert(&postimage.lines, line)) < 0)
|
228
|
+
goto done;
|
229
|
+
break;
|
219
230
|
}
|
220
231
|
}
|
221
232
|
|
@@ -631,9 +642,12 @@ int git_apply_to_tree(
|
|
631
642
|
for (i = 0; i < git_diff_num_deltas(diff); i++) {
|
632
643
|
delta = git_diff_get_delta(diff, i);
|
633
644
|
|
634
|
-
if (
|
635
|
-
|
636
|
-
|
645
|
+
if (delta->status == GIT_DELTA_DELETED ||
|
646
|
+
delta->status == GIT_DELTA_RENAMED) {
|
647
|
+
if ((error = git_index_remove(postimage,
|
648
|
+
delta->old_file.path, 0)) < 0)
|
649
|
+
goto done;
|
650
|
+
}
|
637
651
|
}
|
638
652
|
|
639
653
|
if ((error = apply_deltas(repo, pre_reader, NULL, post_reader, postimage, diff, &opts)) < 0)
|
@@ -413,7 +413,7 @@ int git_attr_cache__init(git_repository *repo)
|
|
413
413
|
git_config_free(cfg);
|
414
414
|
|
415
415
|
/* insert default macros */
|
416
|
-
return git_attr_add_macro(repo, "binary", "-diff -
|
416
|
+
return git_attr_add_macro(repo, "binary", "-diff -merge -text -crlf");
|
417
417
|
|
418
418
|
cancel:
|
419
419
|
attr_cache__free(cache);
|
data/vendor/libgit2/src/blame.c
CHANGED
data/vendor/libgit2/src/buffer.c
CHANGED
@@ -18,7 +18,8 @@ char git_buf__initbuf[1];
|
|
18
18
|
char git_buf__oom[1];
|
19
19
|
|
20
20
|
#define ENSURE_SIZE(b, d) \
|
21
|
-
if ((
|
21
|
+
if ((b)->ptr == git_buf__oom || \
|
22
|
+
((d) > (b)->asize && git_buf_grow((b), (d)) < 0))\
|
22
23
|
return -1;
|
23
24
|
|
24
25
|
|
@@ -58,20 +59,26 @@ int git_buf_try_grow(
|
|
58
59
|
new_ptr = NULL;
|
59
60
|
} else {
|
60
61
|
new_size = buf->asize;
|
62
|
+
/*
|
63
|
+
* Grow the allocated buffer by 1.5 to allow
|
64
|
+
* re-use of memory holes resulting from the
|
65
|
+
* realloc. If this is still too small, then just
|
66
|
+
* use the target size.
|
67
|
+
*/
|
68
|
+
if ((new_size = (new_size << 1) - (new_size >> 1)) < target_size)
|
69
|
+
new_size = target_size;
|
61
70
|
new_ptr = buf->ptr;
|
62
71
|
}
|
63
72
|
|
64
|
-
/* grow the buffer size by 1.5, until it's big enough
|
65
|
-
* to fit our target size */
|
66
|
-
while (new_size < target_size)
|
67
|
-
new_size = (new_size << 1) - (new_size >> 1);
|
68
|
-
|
69
73
|
/* round allocation up to multiple of 8 */
|
70
74
|
new_size = (new_size + 7) & ~7;
|
71
75
|
|
72
76
|
if (new_size < buf->size) {
|
73
|
-
if (mark_oom)
|
77
|
+
if (mark_oom) {
|
78
|
+
if (buf->ptr && buf->ptr != git_buf__initbuf)
|
79
|
+
git__free(buf->ptr);
|
74
80
|
buf->ptr = git_buf__oom;
|
81
|
+
}
|
75
82
|
|
76
83
|
git_error_set_oom();
|
77
84
|
return -1;
|
@@ -30,7 +30,7 @@ static int write_cherrypick_head(
|
|
30
30
|
int error = 0;
|
31
31
|
|
32
32
|
if ((error = git_buf_joinpath(&file_path, repo->gitdir, GIT_CHERRYPICK_HEAD_FILE)) >= 0 &&
|
33
|
-
(error = git_filebuf_open(&file, file_path.ptr,
|
33
|
+
(error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_CREATE_LEADING_DIRS, GIT_CHERRYPICK_FILE_MODE)) >= 0 &&
|
34
34
|
(error = git_filebuf_printf(&file, "%s\n", commit_oidstr)) >= 0)
|
35
35
|
error = git_filebuf_commit(&file);
|
36
36
|
|
@@ -51,7 +51,7 @@ static int write_merge_msg(
|
|
51
51
|
int error = 0;
|
52
52
|
|
53
53
|
if ((error = git_buf_joinpath(&file_path, repo->gitdir, GIT_MERGE_MSG_FILE)) < 0 ||
|
54
|
-
(error = git_filebuf_open(&file, file_path.ptr,
|
54
|
+
(error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_CREATE_LEADING_DIRS, GIT_CHERRYPICK_FILE_MODE)) < 0 ||
|
55
55
|
(error = git_filebuf_printf(&file, "%s", commit_msg)) < 0)
|
56
56
|
goto cleanup;
|
57
57
|
|
data/vendor/libgit2/src/diff.c
CHANGED
@@ -443,7 +443,7 @@ out:
|
|
443
443
|
return error;
|
444
444
|
}
|
445
445
|
|
446
|
-
static int
|
446
|
+
static int patchid_line_cb(
|
447
447
|
const git_diff_delta *delta,
|
448
448
|
const git_diff_hunk *hunk,
|
449
449
|
const git_diff_line *line,
|
@@ -465,6 +465,14 @@ static int line_cb(
|
|
465
465
|
break;
|
466
466
|
case GIT_DIFF_LINE_CONTEXT:
|
467
467
|
break;
|
468
|
+
case GIT_DIFF_LINE_CONTEXT_EOFNL:
|
469
|
+
case GIT_DIFF_LINE_ADD_EOFNL:
|
470
|
+
case GIT_DIFF_LINE_DEL_EOFNL:
|
471
|
+
/*
|
472
|
+
* Ignore EOF without newlines for patch IDs as whitespace is
|
473
|
+
* not supposed to be significant.
|
474
|
+
*/
|
475
|
+
return 0;
|
468
476
|
default:
|
469
477
|
git_error_set(GIT_ERROR_PATCH, "invalid line origin for patch");
|
470
478
|
return -1;
|
@@ -501,7 +509,7 @@ int git_diff_patchid(git_oid *out, git_diff *diff, git_diff_patchid_options *opt
|
|
501
509
|
if ((error = git_hash_ctx_init(&args.ctx)) < 0)
|
502
510
|
goto out;
|
503
511
|
|
504
|
-
if ((error = git_diff_foreach(diff, file_cb, NULL, NULL,
|
512
|
+
if ((error = git_diff_foreach(diff, file_cb, NULL, NULL, patchid_line_cb, &args)) < 0)
|
505
513
|
goto out;
|
506
514
|
|
507
515
|
if ((error = (flush_hunk(&args.result, &args.ctx))) < 0)
|
@@ -1262,29 +1262,31 @@ cleanup:
|
|
1262
1262
|
return error;
|
1263
1263
|
}
|
1264
1264
|
|
1265
|
-
|
1266
|
-
|
1267
|
-
|
1268
|
-
|
1269
|
-
|
1270
|
-
|
1271
|
-
|
1272
|
-
|
1273
|
-
|
1274
|
-
|
1275
|
-
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1287
|
-
|
1265
|
+
static int diff_prepare_iterator_opts(char **prefix, git_iterator_options *a, int aflags,
|
1266
|
+
git_iterator_options *b, int bflags,
|
1267
|
+
const git_diff_options *opts)
|
1268
|
+
{
|
1269
|
+
GIT_ERROR_CHECK_VERSION(opts, GIT_DIFF_OPTIONS_VERSION, "git_diff_options");
|
1270
|
+
|
1271
|
+
*prefix = NULL;
|
1272
|
+
|
1273
|
+
if (opts && (opts->flags & GIT_DIFF_DISABLE_PATHSPEC_MATCH)) {
|
1274
|
+
a->pathlist.strings = opts->pathspec.strings;
|
1275
|
+
a->pathlist.count = opts->pathspec.count;
|
1276
|
+
b->pathlist.strings = opts->pathspec.strings;
|
1277
|
+
b->pathlist.count = opts->pathspec.count;
|
1278
|
+
} else if (opts) {
|
1279
|
+
*prefix = git_pathspec_prefix(&opts->pathspec);
|
1280
|
+
GIT_ERROR_CHECK_ALLOC(prefix);
|
1281
|
+
}
|
1282
|
+
|
1283
|
+
a->flags = aflags;
|
1284
|
+
b->flags = bflags;
|
1285
|
+
a->start = b->start = *prefix;
|
1286
|
+
a->end = b->end = *prefix;
|
1287
|
+
|
1288
|
+
return 0;
|
1289
|
+
}
|
1288
1290
|
|
1289
1291
|
int git_diff_tree_to_tree(
|
1290
1292
|
git_diff **out,
|
@@ -1293,8 +1295,12 @@ int git_diff_tree_to_tree(
|
|
1293
1295
|
git_tree *new_tree,
|
1294
1296
|
const git_diff_options *opts)
|
1295
1297
|
{
|
1296
|
-
git_diff *diff = NULL;
|
1297
1298
|
git_iterator_flag_t iflag = GIT_ITERATOR_DONT_IGNORE_CASE;
|
1299
|
+
git_iterator_options a_opts = GIT_ITERATOR_OPTIONS_INIT,
|
1300
|
+
b_opts = GIT_ITERATOR_OPTIONS_INIT;
|
1301
|
+
git_iterator *a = NULL, *b = NULL;
|
1302
|
+
git_diff *diff = NULL;
|
1303
|
+
char *prefix = NULL;
|
1298
1304
|
int error = 0;
|
1299
1305
|
|
1300
1306
|
assert(out && repo);
|
@@ -1308,13 +1314,19 @@ int git_diff_tree_to_tree(
|
|
1308
1314
|
if (opts && (opts->flags & GIT_DIFF_IGNORE_CASE) != 0)
|
1309
1315
|
iflag = GIT_ITERATOR_IGNORE_CASE;
|
1310
1316
|
|
1311
|
-
|
1312
|
-
|
1313
|
-
|
1314
|
-
|
1317
|
+
if ((error = diff_prepare_iterator_opts(&prefix, &a_opts, iflag, &b_opts, iflag, opts)) < 0 ||
|
1318
|
+
(error = git_iterator_for_tree(&a, old_tree, &a_opts)) < 0 ||
|
1319
|
+
(error = git_iterator_for_tree(&b, new_tree, &b_opts)) < 0 ||
|
1320
|
+
(error = git_diff__from_iterators(&diff, repo, a, b, opts)) < 0)
|
1321
|
+
goto out;
|
1315
1322
|
|
1316
|
-
|
1317
|
-
|
1323
|
+
*out = diff;
|
1324
|
+
diff = NULL;
|
1325
|
+
out:
|
1326
|
+
git_iterator_free(a);
|
1327
|
+
git_iterator_free(b);
|
1328
|
+
git_diff_free(diff);
|
1329
|
+
git__free(prefix);
|
1318
1330
|
|
1319
1331
|
return error;
|
1320
1332
|
}
|
@@ -1337,9 +1349,13 @@ int git_diff_tree_to_index(
|
|
1337
1349
|
git_index *index,
|
1338
1350
|
const git_diff_options *opts)
|
1339
1351
|
{
|
1340
|
-
git_diff *diff = NULL;
|
1341
1352
|
git_iterator_flag_t iflag = GIT_ITERATOR_DONT_IGNORE_CASE |
|
1342
1353
|
GIT_ITERATOR_INCLUDE_CONFLICTS;
|
1354
|
+
git_iterator_options a_opts = GIT_ITERATOR_OPTIONS_INIT,
|
1355
|
+
b_opts = GIT_ITERATOR_OPTIONS_INIT;
|
1356
|
+
git_iterator *a = NULL, *b = NULL;
|
1357
|
+
git_diff *diff = NULL;
|
1358
|
+
char *prefix = NULL;
|
1343
1359
|
bool index_ignore_case = false;
|
1344
1360
|
int error = 0;
|
1345
1361
|
|
@@ -1352,17 +1368,23 @@ int git_diff_tree_to_index(
|
|
1352
1368
|
|
1353
1369
|
index_ignore_case = index->ignore_case;
|
1354
1370
|
|
1355
|
-
|
1356
|
-
|
1357
|
-
|
1358
|
-
|
1371
|
+
if ((error = diff_prepare_iterator_opts(&prefix, &a_opts, iflag, &b_opts, iflag, opts)) < 0 ||
|
1372
|
+
(error = git_iterator_for_tree(&a, old_tree, &a_opts)) < 0 ||
|
1373
|
+
(error = git_iterator_for_index(&b, repo, index, &b_opts)) < 0 ||
|
1374
|
+
(error = git_diff__from_iterators(&diff, repo, a, b, opts)) < 0)
|
1375
|
+
goto out;
|
1359
1376
|
|
1360
1377
|
/* if index is in case-insensitive order, re-sort deltas to match */
|
1361
|
-
if (
|
1378
|
+
if (index_ignore_case)
|
1362
1379
|
git_diff__set_ignore_case(diff, true);
|
1363
1380
|
|
1364
|
-
|
1365
|
-
|
1381
|
+
*out = diff;
|
1382
|
+
diff = NULL;
|
1383
|
+
out:
|
1384
|
+
git_iterator_free(a);
|
1385
|
+
git_iterator_free(b);
|
1386
|
+
git_diff_free(diff);
|
1387
|
+
git__free(prefix);
|
1366
1388
|
|
1367
1389
|
return error;
|
1368
1390
|
}
|
@@ -1373,7 +1395,11 @@ int git_diff_index_to_workdir(
|
|
1373
1395
|
git_index *index,
|
1374
1396
|
const git_diff_options *opts)
|
1375
1397
|
{
|
1398
|
+
git_iterator_options a_opts = GIT_ITERATOR_OPTIONS_INIT,
|
1399
|
+
b_opts = GIT_ITERATOR_OPTIONS_INIT;
|
1400
|
+
git_iterator *a = NULL, *b = NULL;
|
1376
1401
|
git_diff *diff = NULL;
|
1402
|
+
char *prefix = NULL;
|
1377
1403
|
int error = 0;
|
1378
1404
|
|
1379
1405
|
assert(out && repo);
|
@@ -1383,20 +1409,24 @@ int git_diff_index_to_workdir(
|
|
1383
1409
|
if (!index && (error = diff_load_index(&index, repo)) < 0)
|
1384
1410
|
return error;
|
1385
1411
|
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1389
|
-
|
1390
|
-
|
1391
|
-
|
1392
|
-
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
|
1412
|
+
if ((error = diff_prepare_iterator_opts(&prefix, &a_opts, GIT_ITERATOR_INCLUDE_CONFLICTS,
|
1413
|
+
&b_opts, GIT_ITERATOR_DONT_AUTOEXPAND, opts)) < 0 ||
|
1414
|
+
(error = git_iterator_for_index(&a, repo, index, &a_opts)) < 0 ||
|
1415
|
+
(error = git_iterator_for_workdir(&b, repo, index, NULL, &b_opts)) < 0 ||
|
1416
|
+
(error = git_diff__from_iterators(&diff, repo, a, b, opts)) < 0)
|
1417
|
+
goto out;
|
1418
|
+
|
1419
|
+
if ((diff->opts.flags & GIT_DIFF_UPDATE_INDEX) && ((git_diff_generated *)diff)->index_updated)
|
1420
|
+
if ((error = git_index_write(index)) < 0)
|
1421
|
+
goto out;
|
1422
|
+
|
1423
|
+
*out = diff;
|
1424
|
+
diff = NULL;
|
1425
|
+
out:
|
1426
|
+
git_iterator_free(a);
|
1427
|
+
git_iterator_free(b);
|
1428
|
+
git_diff_free(diff);
|
1429
|
+
git__free(prefix);
|
1400
1430
|
|
1401
1431
|
return error;
|
1402
1432
|
}
|
@@ -1407,24 +1437,33 @@ int git_diff_tree_to_workdir(
|
|
1407
1437
|
git_tree *old_tree,
|
1408
1438
|
const git_diff_options *opts)
|
1409
1439
|
{
|
1440
|
+
git_iterator_options a_opts = GIT_ITERATOR_OPTIONS_INIT,
|
1441
|
+
b_opts = GIT_ITERATOR_OPTIONS_INIT;
|
1442
|
+
git_iterator *a = NULL, *b = NULL;
|
1410
1443
|
git_diff *diff = NULL;
|
1444
|
+
char *prefix = NULL;
|
1411
1445
|
git_index *index;
|
1412
|
-
int error
|
1446
|
+
int error;
|
1413
1447
|
|
1414
1448
|
assert(out && repo);
|
1415
1449
|
|
1416
1450
|
*out = NULL;
|
1417
1451
|
|
1418
|
-
if ((error =
|
1419
|
-
|
1420
|
-
|
1421
|
-
|
1422
|
-
|
1423
|
-
|
1424
|
-
|
1425
|
-
|
1426
|
-
|
1427
|
-
|
1452
|
+
if ((error = diff_prepare_iterator_opts(&prefix, &a_opts, 0,
|
1453
|
+
&b_opts, GIT_ITERATOR_DONT_AUTOEXPAND, opts) < 0) ||
|
1454
|
+
(error = git_repository_index__weakptr(&index, repo)) < 0 ||
|
1455
|
+
(error = git_iterator_for_tree(&a, old_tree, &a_opts)) < 0 ||
|
1456
|
+
(error = git_iterator_for_workdir(&b, repo, index, old_tree, &b_opts)) < 0 ||
|
1457
|
+
(error = git_diff__from_iterators(&diff, repo, a, b, opts)) < 0)
|
1458
|
+
goto out;
|
1459
|
+
|
1460
|
+
*out = diff;
|
1461
|
+
diff = NULL;
|
1462
|
+
out:
|
1463
|
+
git_iterator_free(a);
|
1464
|
+
git_iterator_free(b);
|
1465
|
+
git_diff_free(diff);
|
1466
|
+
git__free(prefix);
|
1428
1467
|
|
1429
1468
|
return error;
|
1430
1469
|
}
|
@@ -1468,24 +1507,35 @@ int git_diff_index_to_index(
|
|
1468
1507
|
git_index *new_index,
|
1469
1508
|
const git_diff_options *opts)
|
1470
1509
|
{
|
1471
|
-
|
1472
|
-
|
1510
|
+
git_iterator_options a_opts = GIT_ITERATOR_OPTIONS_INIT,
|
1511
|
+
b_opts = GIT_ITERATOR_OPTIONS_INIT;
|
1512
|
+
git_iterator *a = NULL, *b = NULL;
|
1513
|
+
git_diff *diff = NULL;
|
1514
|
+
char *prefix = NULL;
|
1515
|
+
int error;
|
1473
1516
|
|
1474
1517
|
assert(out && old_index && new_index);
|
1475
1518
|
|
1476
1519
|
*out = NULL;
|
1477
1520
|
|
1478
|
-
|
1479
|
-
|
1480
|
-
|
1481
|
-
|
1521
|
+
if ((error = diff_prepare_iterator_opts(&prefix, &a_opts, GIT_ITERATOR_DONT_IGNORE_CASE,
|
1522
|
+
&b_opts, GIT_ITERATOR_DONT_IGNORE_CASE, opts) < 0) ||
|
1523
|
+
(error = git_iterator_for_index(&a, repo, old_index, &a_opts)) < 0 ||
|
1524
|
+
(error = git_iterator_for_index(&b, repo, new_index, &b_opts)) < 0 ||
|
1525
|
+
(error = git_diff__from_iterators(&diff, repo, a, b, opts)) < 0)
|
1526
|
+
goto out;
|
1482
1527
|
|
1483
1528
|
/* if index is in case-insensitive order, re-sort deltas to match */
|
1484
|
-
if (
|
1529
|
+
if (old_index->ignore_case || new_index->ignore_case)
|
1485
1530
|
git_diff__set_ignore_case(diff, true);
|
1486
1531
|
|
1487
|
-
|
1488
|
-
|
1532
|
+
*out = diff;
|
1533
|
+
diff = NULL;
|
1534
|
+
out:
|
1535
|
+
git_iterator_free(a);
|
1536
|
+
git_iterator_free(b);
|
1537
|
+
git_diff_free(diff);
|
1538
|
+
git__free(prefix);
|
1489
1539
|
|
1490
1540
|
return error;
|
1491
1541
|
}
|