rugged 0.25.0b2 → 0.25.0b3
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/LICENSE +1 -1
- data/ext/rugged/extconf.rb +3 -1
- data/ext/rugged/rugged.c +1 -1
- data/ext/rugged/rugged.h +1 -1
- data/ext/rugged/rugged_blob.c +29 -38
- data/ext/rugged/rugged_commit.c +215 -78
- data/ext/rugged/rugged_rebase.c +18 -11
- data/ext/rugged/rugged_remote.c +2 -2
- data/ext/rugged/rugged_tree.c +132 -0
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +11 -3
- data/vendor/libgit2/include/git2.h +1 -0
- data/vendor/libgit2/include/git2/blob.h +39 -28
- data/vendor/libgit2/include/git2/commit.h +30 -0
- data/vendor/libgit2/include/git2/common.h +16 -1
- data/vendor/libgit2/include/git2/merge.h +10 -1
- data/vendor/libgit2/include/git2/proxy.h +92 -0
- data/vendor/libgit2/include/git2/refs.h +11 -0
- data/vendor/libgit2/include/git2/remote.h +17 -4
- data/vendor/libgit2/include/git2/signature.h +13 -0
- data/vendor/libgit2/include/git2/sys/merge.h +177 -0
- data/vendor/libgit2/include/git2/sys/remote.h +16 -0
- data/vendor/libgit2/include/git2/sys/stream.h +2 -1
- data/vendor/libgit2/include/git2/sys/transport.h +3 -1
- data/vendor/libgit2/include/git2/tag.h +9 -0
- data/vendor/libgit2/include/git2/tree.h +55 -0
- data/vendor/libgit2/src/annotated_commit.c +99 -80
- data/vendor/libgit2/src/annotated_commit.h +5 -2
- data/vendor/libgit2/src/array.h +40 -0
- data/vendor/libgit2/src/blame.c +8 -3
- data/vendor/libgit2/src/blame_git.c +2 -1
- data/vendor/libgit2/src/blob.c +71 -39
- data/vendor/libgit2/src/branch.c +2 -1
- data/vendor/libgit2/src/checkout.c +66 -42
- data/vendor/libgit2/src/commit.c +67 -3
- data/vendor/libgit2/src/config_cache.c +2 -1
- data/vendor/libgit2/src/config_file.c +32 -27
- data/vendor/libgit2/src/curl_stream.c +89 -6
- data/vendor/libgit2/src/delta-apply.c +36 -5
- data/vendor/libgit2/src/delta-apply.h +12 -0
- data/vendor/libgit2/src/describe.c +3 -2
- data/vendor/libgit2/src/diff.c +13 -20
- data/vendor/libgit2/src/diff_tform.c +5 -3
- data/vendor/libgit2/src/filebuf.c +12 -2
- data/vendor/libgit2/src/filebuf.h +1 -0
- data/vendor/libgit2/src/fnmatch.c +18 -5
- data/vendor/libgit2/src/global.c +18 -0
- data/vendor/libgit2/src/global.h +1 -0
- data/vendor/libgit2/src/ignore.c +11 -3
- data/vendor/libgit2/src/index.c +11 -5
- data/vendor/libgit2/src/indexer.c +11 -7
- data/vendor/libgit2/src/iterator.c +1575 -1468
- data/vendor/libgit2/src/iterator.h +52 -69
- data/vendor/libgit2/src/merge.c +160 -63
- data/vendor/libgit2/src/merge.h +61 -2
- data/vendor/libgit2/src/merge_driver.c +397 -0
- data/vendor/libgit2/src/merge_driver.h +60 -0
- data/vendor/libgit2/src/merge_file.c +11 -49
- data/vendor/libgit2/src/netops.c +12 -10
- data/vendor/libgit2/src/object.c +3 -6
- data/vendor/libgit2/src/object_api.c +19 -1
- data/vendor/libgit2/src/odb_loose.c +1 -1
- data/vendor/libgit2/src/openssl_stream.c +16 -3
- data/vendor/libgit2/src/pack-objects.c +3 -1
- data/vendor/libgit2/src/pack.c +5 -9
- data/vendor/libgit2/src/path.c +14 -0
- data/vendor/libgit2/src/path.h +12 -0
- data/vendor/libgit2/src/pathspec.c +1 -1
- data/vendor/libgit2/src/posix.c +7 -0
- data/vendor/libgit2/src/posix.h +1 -0
- data/vendor/libgit2/src/proxy.c +32 -0
- data/vendor/libgit2/src/proxy.h +14 -0
- data/vendor/libgit2/src/push.c +7 -7
- data/vendor/libgit2/src/rebase.c +61 -31
- data/vendor/libgit2/src/refdb_fs.c +1 -0
- data/vendor/libgit2/src/refs.c +16 -1
- data/vendor/libgit2/src/remote.c +20 -6
- data/vendor/libgit2/src/repository.c +1 -1
- data/vendor/libgit2/src/reset.c +1 -1
- data/vendor/libgit2/src/settings.c +23 -1
- data/vendor/libgit2/src/signature.c +26 -1
- data/vendor/libgit2/src/stransport_stream.c +5 -2
- data/vendor/libgit2/src/stream.h +2 -2
- data/vendor/libgit2/src/submodule.c +3 -2
- data/vendor/libgit2/src/tag.c +8 -2
- data/vendor/libgit2/src/transports/http.c +32 -9
- data/vendor/libgit2/src/transports/local.c +4 -1
- data/vendor/libgit2/src/transports/smart.c +6 -0
- data/vendor/libgit2/src/transports/smart.h +1 -0
- data/vendor/libgit2/src/transports/smart_protocol.c +61 -17
- data/vendor/libgit2/src/transports/winhttp.c +130 -11
- data/vendor/libgit2/src/tree.c +329 -98
- data/vendor/libgit2/src/tree.h +4 -5
- data/vendor/libgit2/src/unix/map.c +5 -0
- data/vendor/libgit2/src/win32/map.c +24 -5
- data/vendor/libgit2/src/xdiff/xprepare.c +2 -1
- metadata +10 -4
- data/vendor/libgit2/Makefile.embed +0 -60
|
@@ -525,7 +525,8 @@ static int pass_blame(git_blame *blame, git_blame__origin *origin, uint32_t opt)
|
|
|
525
525
|
if (sg_origin[i])
|
|
526
526
|
continue;
|
|
527
527
|
|
|
528
|
-
git_commit_parent(&p, origin->commit, i)
|
|
528
|
+
if ((error = git_commit_parent(&p, origin->commit, i)) < 0)
|
|
529
|
+
goto finish;
|
|
529
530
|
porigin = find_origin(blame, p, origin);
|
|
530
531
|
|
|
531
532
|
if (!porigin)
|
data/vendor/libgit2/src/blob.c
CHANGED
|
@@ -274,64 +274,96 @@ int git_blob_create_fromdisk(
|
|
|
274
274
|
return error;
|
|
275
275
|
}
|
|
276
276
|
|
|
277
|
-
|
|
277
|
+
typedef struct {
|
|
278
|
+
git_writestream parent;
|
|
279
|
+
git_filebuf fbuf;
|
|
280
|
+
git_repository *repo;
|
|
281
|
+
char *hintpath;
|
|
282
|
+
} blob_writestream;
|
|
283
|
+
|
|
284
|
+
static int blob_writestream_close(git_writestream *_stream)
|
|
285
|
+
{
|
|
286
|
+
blob_writestream *stream = (blob_writestream *) _stream;
|
|
278
287
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
288
|
+
git_filebuf_cleanup(&stream->fbuf);
|
|
289
|
+
return 0;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
static void blob_writestream_free(git_writestream *_stream)
|
|
293
|
+
{
|
|
294
|
+
blob_writestream *stream = (blob_writestream *) _stream;
|
|
295
|
+
|
|
296
|
+
git_filebuf_cleanup(&stream->fbuf);
|
|
297
|
+
git__free(stream->hintpath);
|
|
298
|
+
git__free(stream);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
static int blob_writestream_write(git_writestream *_stream, const char *buffer, size_t len)
|
|
302
|
+
{
|
|
303
|
+
blob_writestream *stream = (blob_writestream *) _stream;
|
|
304
|
+
|
|
305
|
+
return git_filebuf_write(&stream->fbuf, buffer, len);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
int git_blob_create_fromstream(git_writestream **out, git_repository *repo, const char *hintpath)
|
|
285
309
|
{
|
|
286
310
|
int error;
|
|
287
|
-
char *content = NULL;
|
|
288
|
-
git_filebuf file = GIT_FILEBUF_INIT;
|
|
289
311
|
git_buf path = GIT_BUF_INIT;
|
|
312
|
+
blob_writestream *stream;
|
|
290
313
|
|
|
291
|
-
assert(
|
|
314
|
+
assert(out && repo);
|
|
292
315
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
goto cleanup;
|
|
316
|
+
stream = git__calloc(1, sizeof(blob_writestream));
|
|
317
|
+
GITERR_CHECK_ALLOC(stream);
|
|
296
318
|
|
|
297
|
-
|
|
298
|
-
|
|
319
|
+
if (hintpath) {
|
|
320
|
+
stream->hintpath = git__strdup(hintpath);
|
|
321
|
+
GITERR_CHECK_ALLOC(stream->hintpath);
|
|
322
|
+
}
|
|
299
323
|
|
|
300
|
-
|
|
301
|
-
|
|
324
|
+
stream->repo = repo;
|
|
325
|
+
stream->parent.write = blob_writestream_write;
|
|
326
|
+
stream->parent.close = blob_writestream_close;
|
|
327
|
+
stream->parent.free = blob_writestream_free;
|
|
328
|
+
|
|
329
|
+
if ((error = git_buf_joinpath(&path,
|
|
330
|
+
git_repository_path(repo), GIT_OBJECTS_DIR "streamed")) < 0)
|
|
302
331
|
goto cleanup;
|
|
303
332
|
|
|
304
|
-
|
|
305
|
-
|
|
333
|
+
if ((error = git_filebuf_open_withsize(&stream->fbuf, git_buf_cstr(&path), GIT_FILEBUF_TEMPORARY,
|
|
334
|
+
0666, 2 * 1024 * 1024)) < 0)
|
|
335
|
+
goto cleanup;
|
|
306
336
|
|
|
307
|
-
|
|
308
|
-
break;
|
|
337
|
+
*out = (git_writestream *) stream;
|
|
309
338
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
} else if (read_bytes < 0) {
|
|
314
|
-
error = giterr_set_after_callback(read_bytes);
|
|
315
|
-
} else {
|
|
316
|
-
error = git_filebuf_write(&file, content, read_bytes);
|
|
317
|
-
}
|
|
339
|
+
cleanup:
|
|
340
|
+
if (error < 0)
|
|
341
|
+
blob_writestream_free((git_writestream *) stream);
|
|
318
342
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
343
|
+
git_buf_free(&path);
|
|
344
|
+
return error;
|
|
345
|
+
}
|
|
322
346
|
|
|
323
|
-
|
|
347
|
+
int git_blob_create_fromstream_commit(git_oid *out, git_writestream *_stream)
|
|
348
|
+
{
|
|
349
|
+
int error;
|
|
350
|
+
blob_writestream *stream = (blob_writestream *) _stream;
|
|
351
|
+
|
|
352
|
+
/*
|
|
353
|
+
* We can make this more officient by avoiding writing to
|
|
354
|
+
* disk, but for now let's re-use the helper functions we
|
|
355
|
+
* have.
|
|
356
|
+
*/
|
|
357
|
+
if ((error = git_filebuf_flush(&stream->fbuf)) < 0)
|
|
324
358
|
goto cleanup;
|
|
325
359
|
|
|
326
|
-
error = git_blob__create_from_paths(
|
|
327
|
-
|
|
360
|
+
error = git_blob__create_from_paths(out, NULL, stream->repo, stream->fbuf.path_lock,
|
|
361
|
+
stream->hintpath, 0, !!stream->hintpath);
|
|
328
362
|
|
|
329
363
|
cleanup:
|
|
330
|
-
|
|
331
|
-
git_filebuf_cleanup(&file);
|
|
332
|
-
git__free(content);
|
|
333
|
-
|
|
364
|
+
blob_writestream_free(_stream);
|
|
334
365
|
return error;
|
|
366
|
+
|
|
335
367
|
}
|
|
336
368
|
|
|
337
369
|
int git_blob_is_binary(const git_blob *blob)
|
data/vendor/libgit2/src/branch.c
CHANGED
|
@@ -121,7 +121,8 @@ int git_branch_create_from_annotated(
|
|
|
121
121
|
const git_annotated_commit *commit,
|
|
122
122
|
int force)
|
|
123
123
|
{
|
|
124
|
-
return create_branch(ref_out,
|
|
124
|
+
return create_branch(ref_out,
|
|
125
|
+
repository, branch_name, commit->commit, commit->description, force);
|
|
125
126
|
}
|
|
126
127
|
|
|
127
128
|
int git_branch_delete(git_reference *branch)
|
|
@@ -66,8 +66,8 @@ typedef struct {
|
|
|
66
66
|
git_vector update_conflicts;
|
|
67
67
|
git_vector *update_reuc;
|
|
68
68
|
git_vector *update_names;
|
|
69
|
-
git_buf
|
|
70
|
-
size_t
|
|
69
|
+
git_buf target_path;
|
|
70
|
+
size_t target_len;
|
|
71
71
|
git_buf tmp;
|
|
72
72
|
unsigned int strategy;
|
|
73
73
|
int can_symlink;
|
|
@@ -294,14 +294,30 @@ static int checkout_action_no_wd(
|
|
|
294
294
|
return checkout_action_common(action, data, delta, NULL);
|
|
295
295
|
}
|
|
296
296
|
|
|
297
|
-
static
|
|
297
|
+
static int checkout_target_fullpath(
|
|
298
|
+
git_buf **out, checkout_data *data, const char *path)
|
|
298
299
|
{
|
|
299
|
-
|
|
300
|
+
git_buf_truncate(&data->target_path, data->target_len);
|
|
301
|
+
|
|
302
|
+
if (path && git_buf_puts(&data->target_path, path) < 0)
|
|
303
|
+
return -1;
|
|
304
|
+
|
|
305
|
+
*out = &data->target_path;
|
|
306
|
+
|
|
307
|
+
return 0;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
static bool wd_item_is_removable(
|
|
311
|
+
checkout_data *data, const git_index_entry *wd)
|
|
312
|
+
{
|
|
313
|
+
git_buf *full;
|
|
300
314
|
|
|
301
315
|
if (wd->mode != GIT_FILEMODE_TREE)
|
|
302
316
|
return true;
|
|
303
|
-
|
|
304
|
-
|
|
317
|
+
|
|
318
|
+
if (checkout_target_fullpath(&full, data, wd->path) < 0)
|
|
319
|
+
return false;
|
|
320
|
+
|
|
305
321
|
return !full || !git_path_contains(full, DOT_GIT);
|
|
306
322
|
}
|
|
307
323
|
|
|
@@ -363,14 +379,14 @@ static int checkout_action_wd_only(
|
|
|
363
379
|
if ((error = checkout_notify(data, notify, NULL, wd)) != 0)
|
|
364
380
|
return error;
|
|
365
381
|
|
|
366
|
-
if (remove && wd_item_is_removable(
|
|
382
|
+
if (remove && wd_item_is_removable(data, wd))
|
|
367
383
|
error = checkout_queue_remove(data, wd->path);
|
|
368
384
|
|
|
369
385
|
if (!error)
|
|
370
386
|
error = git_iterator_advance(wditem, workdir);
|
|
371
387
|
} else {
|
|
372
388
|
/* untracked or ignored - can't know which until we advance through */
|
|
373
|
-
bool over = false, removable = wd_item_is_removable(
|
|
389
|
+
bool over = false, removable = wd_item_is_removable(data, wd);
|
|
374
390
|
git_iterator_status_t untracked_state;
|
|
375
391
|
|
|
376
392
|
/* copy the entry for issuing notification callback later */
|
|
@@ -378,7 +394,7 @@ static int checkout_action_wd_only(
|
|
|
378
394
|
git_buf_sets(&data->tmp, wd->path);
|
|
379
395
|
saved_wd.path = data->tmp.ptr;
|
|
380
396
|
|
|
381
|
-
error =
|
|
397
|
+
error = git_iterator_advance_over(
|
|
382
398
|
wditem, &untracked_state, workdir);
|
|
383
399
|
if (error == GIT_ITEROVER)
|
|
384
400
|
over = true;
|
|
@@ -428,10 +444,12 @@ static bool submodule_is_config_only(
|
|
|
428
444
|
|
|
429
445
|
static bool checkout_is_empty_dir(checkout_data *data, const char *path)
|
|
430
446
|
{
|
|
431
|
-
|
|
432
|
-
|
|
447
|
+
git_buf *fullpath;
|
|
448
|
+
|
|
449
|
+
if (checkout_target_fullpath(&fullpath, data, path) < 0)
|
|
433
450
|
return false;
|
|
434
|
-
|
|
451
|
+
|
|
452
|
+
return git_path_is_empty_dir(fullpath->ptr);
|
|
435
453
|
}
|
|
436
454
|
|
|
437
455
|
static int checkout_action_with_wd(
|
|
@@ -639,7 +657,7 @@ static int checkout_action(
|
|
|
639
657
|
if (cmp == 0) {
|
|
640
658
|
if (wd->mode == GIT_FILEMODE_TREE) {
|
|
641
659
|
/* case 2 - entry prefixed by workdir tree */
|
|
642
|
-
error =
|
|
660
|
+
error = git_iterator_advance_into(wditem, workdir);
|
|
643
661
|
if (error < 0 && error != GIT_ITEROVER)
|
|
644
662
|
goto done;
|
|
645
663
|
continue;
|
|
@@ -912,7 +930,7 @@ static int checkout_conflicts_load(checkout_data *data, git_iterator *workdir, g
|
|
|
912
930
|
git_index *index;
|
|
913
931
|
|
|
914
932
|
/* Only write conficts from sources that have them: indexes. */
|
|
915
|
-
if ((index =
|
|
933
|
+
if ((index = git_iterator_index(data->target)) == NULL)
|
|
916
934
|
return 0;
|
|
917
935
|
|
|
918
936
|
data->update_conflicts._cmp = checkout_conflictdata_cmp;
|
|
@@ -1062,7 +1080,7 @@ static int checkout_conflicts_coalesce_renames(
|
|
|
1062
1080
|
size_t i, names;
|
|
1063
1081
|
int error = 0;
|
|
1064
1082
|
|
|
1065
|
-
if ((index =
|
|
1083
|
+
if ((index = git_iterator_index(data->target)) == NULL)
|
|
1066
1084
|
return 0;
|
|
1067
1085
|
|
|
1068
1086
|
/* Juggle entries based on renames */
|
|
@@ -1120,7 +1138,7 @@ static int checkout_conflicts_mark_directoryfile(
|
|
|
1120
1138
|
const char *path;
|
|
1121
1139
|
int prefixed, error = 0;
|
|
1122
1140
|
|
|
1123
|
-
if ((index =
|
|
1141
|
+
if ((index = git_iterator_index(data->target)) == NULL)
|
|
1124
1142
|
return 0;
|
|
1125
1143
|
|
|
1126
1144
|
len = git_index_entrycount(index);
|
|
@@ -1342,9 +1360,11 @@ fail:
|
|
|
1342
1360
|
|
|
1343
1361
|
static bool should_remove_existing(checkout_data *data)
|
|
1344
1362
|
{
|
|
1345
|
-
int ignorecase
|
|
1363
|
+
int ignorecase;
|
|
1346
1364
|
|
|
1347
|
-
git_repository__cvar(&ignorecase, data->repo, GIT_CVAR_IGNORECASE)
|
|
1365
|
+
if (git_repository__cvar(&ignorecase, data->repo, GIT_CVAR_IGNORECASE) < 0) {
|
|
1366
|
+
ignorecase = 0;
|
|
1367
|
+
}
|
|
1348
1368
|
|
|
1349
1369
|
return (ignorecase &&
|
|
1350
1370
|
(data->strategy & GIT_CHECKOUT_DONT_REMOVE_EXISTING) == 0);
|
|
@@ -1582,18 +1602,18 @@ static int checkout_submodule_update_index(
|
|
|
1582
1602
|
checkout_data *data,
|
|
1583
1603
|
const git_diff_file *file)
|
|
1584
1604
|
{
|
|
1605
|
+
git_buf *fullpath;
|
|
1585
1606
|
struct stat st;
|
|
1586
1607
|
|
|
1587
1608
|
/* update the index unless prevented */
|
|
1588
1609
|
if ((data->strategy & GIT_CHECKOUT_DONT_UPDATE_INDEX) != 0)
|
|
1589
1610
|
return 0;
|
|
1590
1611
|
|
|
1591
|
-
|
|
1592
|
-
if (git_buf_puts(&data->path, file->path) < 0)
|
|
1612
|
+
if (checkout_target_fullpath(&fullpath, data, file->path) < 0)
|
|
1593
1613
|
return -1;
|
|
1594
1614
|
|
|
1595
1615
|
data->perfdata.stat_calls++;
|
|
1596
|
-
if (p_stat(
|
|
1616
|
+
if (p_stat(fullpath->ptr, &st) < 0) {
|
|
1597
1617
|
giterr_set(
|
|
1598
1618
|
GITERR_CHECKOUT, "Could not stat submodule %s\n", file->path);
|
|
1599
1619
|
return GIT_ENOTFOUND;
|
|
@@ -1718,22 +1738,23 @@ static int checkout_blob(
|
|
|
1718
1738
|
checkout_data *data,
|
|
1719
1739
|
const git_diff_file *file)
|
|
1720
1740
|
{
|
|
1721
|
-
|
|
1741
|
+
git_buf *fullpath;
|
|
1722
1742
|
struct stat st;
|
|
1743
|
+
int error = 0;
|
|
1723
1744
|
|
|
1724
|
-
|
|
1725
|
-
if (git_buf_puts(&data->path, file->path) < 0)
|
|
1745
|
+
if (checkout_target_fullpath(&fullpath, data, file->path) < 0)
|
|
1726
1746
|
return -1;
|
|
1727
1747
|
|
|
1728
1748
|
if ((data->strategy & GIT_CHECKOUT_UPDATE_ONLY) != 0) {
|
|
1729
1749
|
int rval = checkout_safe_for_update_only(
|
|
1730
|
-
data,
|
|
1750
|
+
data, fullpath->ptr, file->mode);
|
|
1751
|
+
|
|
1731
1752
|
if (rval <= 0)
|
|
1732
1753
|
return rval;
|
|
1733
1754
|
}
|
|
1734
1755
|
|
|
1735
1756
|
error = checkout_write_content(
|
|
1736
|
-
data, &file->id,
|
|
1757
|
+
data, &file->id, fullpath->ptr, NULL, file->mode, &st);
|
|
1737
1758
|
|
|
1738
1759
|
/* update the index unless prevented */
|
|
1739
1760
|
if (!error && (data->strategy & GIT_CHECKOUT_DONT_UPDATE_INDEX) == 0)
|
|
@@ -1754,18 +1775,21 @@ static int checkout_remove_the_old(
|
|
|
1754
1775
|
git_diff_delta *delta;
|
|
1755
1776
|
const char *str;
|
|
1756
1777
|
size_t i;
|
|
1757
|
-
|
|
1778
|
+
git_buf *fullpath;
|
|
1758
1779
|
uint32_t flg = GIT_RMDIR_EMPTY_PARENTS |
|
|
1759
1780
|
GIT_RMDIR_REMOVE_FILES | GIT_RMDIR_REMOVE_BLOCKERS;
|
|
1760
1781
|
|
|
1761
1782
|
if (data->opts.checkout_strategy & GIT_CHECKOUT_SKIP_LOCKED_DIRECTORIES)
|
|
1762
1783
|
flg |= GIT_RMDIR_SKIP_NONEMPTY;
|
|
1763
1784
|
|
|
1764
|
-
|
|
1785
|
+
if (checkout_target_fullpath(&fullpath, data, NULL) < 0)
|
|
1786
|
+
return -1;
|
|
1765
1787
|
|
|
1766
1788
|
git_vector_foreach(&data->diff->deltas, i, delta) {
|
|
1767
1789
|
if (actions[i] & CHECKOUT_ACTION__REMOVE) {
|
|
1768
|
-
error = git_futils_rmdir_r(
|
|
1790
|
+
error = git_futils_rmdir_r(
|
|
1791
|
+
delta->old_file.path, fullpath->ptr, flg);
|
|
1792
|
+
|
|
1769
1793
|
if (error < 0)
|
|
1770
1794
|
return error;
|
|
1771
1795
|
|
|
@@ -1782,7 +1806,7 @@ static int checkout_remove_the_old(
|
|
|
1782
1806
|
}
|
|
1783
1807
|
|
|
1784
1808
|
git_vector_foreach(&data->removes, i, str) {
|
|
1785
|
-
error = git_futils_rmdir_r(str,
|
|
1809
|
+
error = git_futils_rmdir_r(str, fullpath->ptr, flg);
|
|
1786
1810
|
if (error < 0)
|
|
1787
1811
|
return error;
|
|
1788
1812
|
|
|
@@ -1949,13 +1973,13 @@ static int checkout_write_entry(
|
|
|
1949
1973
|
const git_index_entry *side)
|
|
1950
1974
|
{
|
|
1951
1975
|
const char *hint_path = NULL, *suffix;
|
|
1976
|
+
git_buf *fullpath;
|
|
1952
1977
|
struct stat st;
|
|
1953
1978
|
int error;
|
|
1954
1979
|
|
|
1955
1980
|
assert (side == conflict->ours || side == conflict->theirs);
|
|
1956
1981
|
|
|
1957
|
-
|
|
1958
|
-
if (git_buf_puts(&data->path, side->path) < 0)
|
|
1982
|
+
if (checkout_target_fullpath(&fullpath, data, side->path) < 0)
|
|
1959
1983
|
return -1;
|
|
1960
1984
|
|
|
1961
1985
|
if ((conflict->name_collision || conflict->directoryfile) &&
|
|
@@ -1969,18 +1993,18 @@ static int checkout_write_entry(
|
|
|
1969
1993
|
suffix = data->opts.their_label ? data->opts.their_label :
|
|
1970
1994
|
"theirs";
|
|
1971
1995
|
|
|
1972
|
-
if (checkout_path_suffixed(
|
|
1996
|
+
if (checkout_path_suffixed(fullpath, suffix) < 0)
|
|
1973
1997
|
return -1;
|
|
1974
1998
|
|
|
1975
1999
|
hint_path = side->path;
|
|
1976
2000
|
}
|
|
1977
2001
|
|
|
1978
2002
|
if ((data->strategy & GIT_CHECKOUT_UPDATE_ONLY) != 0 &&
|
|
1979
|
-
(error = checkout_safe_for_update_only(data,
|
|
2003
|
+
(error = checkout_safe_for_update_only(data, fullpath->ptr, side->mode)) <= 0)
|
|
1980
2004
|
return error;
|
|
1981
2005
|
|
|
1982
2006
|
return checkout_write_content(data,
|
|
1983
|
-
&side->id,
|
|
2007
|
+
&side->id, fullpath->ptr, hint_path, side->mode, &st);
|
|
1984
2008
|
}
|
|
1985
2009
|
|
|
1986
2010
|
static int checkout_write_entries(
|
|
@@ -2293,7 +2317,7 @@ static void checkout_data_clear(checkout_data *data)
|
|
|
2293
2317
|
|
|
2294
2318
|
git_strmap_free(data->mkdir_map);
|
|
2295
2319
|
|
|
2296
|
-
git_buf_free(&data->
|
|
2320
|
+
git_buf_free(&data->target_path);
|
|
2297
2321
|
git_buf_free(&data->tmp);
|
|
2298
2322
|
|
|
2299
2323
|
git_index_free(data->index);
|
|
@@ -2356,7 +2380,7 @@ static int checkout_data_init(
|
|
|
2356
2380
|
if ((error = git_repository_index(&data->index, data->repo)) < 0)
|
|
2357
2381
|
goto cleanup;
|
|
2358
2382
|
|
|
2359
|
-
if (data->index !=
|
|
2383
|
+
if (data->index != git_iterator_index(target)) {
|
|
2360
2384
|
if ((error = git_index_read(data->index, true)) < 0)
|
|
2361
2385
|
goto cleanup;
|
|
2362
2386
|
|
|
@@ -2447,12 +2471,12 @@ static int checkout_data_init(
|
|
|
2447
2471
|
if ((error = git_vector_init(&data->removes, 0, git__strcmp_cb)) < 0 ||
|
|
2448
2472
|
(error = git_vector_init(&data->remove_conflicts, 0, NULL)) < 0 ||
|
|
2449
2473
|
(error = git_vector_init(&data->update_conflicts, 0, NULL)) < 0 ||
|
|
2450
|
-
(error = git_buf_puts(&data->
|
|
2451
|
-
(error = git_path_to_dir(&data->
|
|
2474
|
+
(error = git_buf_puts(&data->target_path, data->opts.target_directory)) < 0 ||
|
|
2475
|
+
(error = git_path_to_dir(&data->target_path)) < 0 ||
|
|
2452
2476
|
(error = git_strmap_alloc(&data->mkdir_map)) < 0)
|
|
2453
2477
|
goto cleanup;
|
|
2454
2478
|
|
|
2455
|
-
data->
|
|
2479
|
+
data->target_len = git_buf_len(&data->target_path);
|
|
2456
2480
|
|
|
2457
2481
|
git_attr_session__init(&data->attr_session, data->repo);
|
|
2458
2482
|
|
|
@@ -2508,7 +2532,7 @@ int git_checkout_iterator(
|
|
|
2508
2532
|
workdir_opts.start = data.pfx;
|
|
2509
2533
|
workdir_opts.end = data.pfx;
|
|
2510
2534
|
|
|
2511
|
-
if ((error =
|
|
2535
|
+
if ((error = git_iterator_reset_range(target, data.pfx, data.pfx)) < 0 ||
|
|
2512
2536
|
(error = git_iterator_for_workdir_ext(
|
|
2513
2537
|
&workdir, data.repo, data.opts.target_directory, index, NULL,
|
|
2514
2538
|
&workdir_opts)) < 0)
|
|
@@ -2578,7 +2602,7 @@ int git_checkout_iterator(
|
|
|
2578
2602
|
(error = checkout_create_conflicts(&data)) < 0)
|
|
2579
2603
|
goto cleanup;
|
|
2580
2604
|
|
|
2581
|
-
if (data.index !=
|
|
2605
|
+
if (data.index != git_iterator_index(target) &&
|
|
2582
2606
|
(error = checkout_extensions_update_index(&data)) < 0)
|
|
2583
2607
|
goto cleanup;
|
|
2584
2608
|
|