rugged 0.22.0b5 → 0.22.1b1
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/README.md +19 -3
- data/ext/rugged/extconf.rb +21 -5
- data/ext/rugged/rugged.c +1 -0
- data/ext/rugged/rugged.h +8 -0
- data/ext/rugged/rugged_backend.c +34 -0
- data/ext/rugged/rugged_branch_collection.c +1 -0
- data/ext/rugged/rugged_remote.c +37 -86
- data/ext/rugged/rugged_remote_collection.c +2 -1
- data/ext/rugged/rugged_repo.c +149 -24
- data/ext/rugged/rugged_revwalk.c +1 -2
- data/ext/rugged/rugged_submodule.c +1 -1
- data/ext/rugged/rugged_tree.c +69 -5
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +2 -1
- data/vendor/libgit2/include/git2.h +0 -1
- data/vendor/libgit2/include/git2/checkout.h +8 -0
- data/vendor/libgit2/include/git2/merge.h +8 -0
- data/vendor/libgit2/include/git2/push.h +0 -110
- data/vendor/libgit2/include/git2/remote.h +30 -1
- data/vendor/libgit2/include/git2/revert.h +1 -1
- data/vendor/libgit2/include/git2/submodule.h +80 -1
- data/vendor/libgit2/include/git2/sys/index.h +2 -2
- data/vendor/libgit2/include/git2/{threads.h → sys/openssl.h} +10 -12
- data/vendor/libgit2/include/git2/sys/refs.h +11 -0
- data/vendor/libgit2/include/git2/tree.h +1 -1
- data/vendor/libgit2/include/git2/version.h +3 -3
- data/vendor/libgit2/src/attr_file.c +3 -1
- data/vendor/libgit2/src/buffer.c +2 -1
- data/vendor/libgit2/src/checkout.c +135 -39
- data/vendor/libgit2/src/checkout.h +7 -0
- data/vendor/libgit2/src/config_file.c +5 -7
- data/vendor/libgit2/src/crlf.c +2 -0
- data/vendor/libgit2/src/describe.c +6 -2
- data/vendor/libgit2/src/diff.c +1 -0
- data/vendor/libgit2/src/fileops.c +87 -19
- data/vendor/libgit2/src/fileops.h +18 -0
- data/vendor/libgit2/src/global.c +1 -1
- data/vendor/libgit2/src/ident.c +2 -0
- data/vendor/libgit2/src/index.c +4 -4
- data/vendor/libgit2/src/merge.c +3 -1
- data/vendor/libgit2/src/notes.c +1 -1
- data/vendor/libgit2/src/pack.c +1 -0
- data/vendor/libgit2/src/path.c +17 -12
- data/vendor/libgit2/src/path.h +17 -3
- data/vendor/libgit2/src/push.h +110 -0
- data/vendor/libgit2/src/rebase.c +4 -2
- data/vendor/libgit2/src/remote.c +237 -16
- data/vendor/libgit2/src/remote.h +2 -0
- data/vendor/libgit2/src/repository.c +7 -3
- data/vendor/libgit2/src/submodule.c +229 -18
- data/vendor/libgit2/src/transports/local.c +61 -2
- data/vendor/libgit2/src/transports/smart_protocol.c +5 -3
- data/vendor/libgit2/src/tree.c +2 -2
- data/vendor/libgit2/src/util.h +13 -2
- data/vendor/libgit2/src/win32/mingw-compat.h +2 -0
- data/vendor/libgit2/src/win32/path_w32.h +2 -0
- metadata +4 -4
- data/vendor/libgit2/cmake/Modules/FindLIBSSH2.cmake +0 -44
@@ -42,7 +42,7 @@ typedef struct git_index_reuc_entry {
|
|
42
42
|
* @param index an existing index object
|
43
43
|
* @return integer of count of current filename conflict entries
|
44
44
|
*/
|
45
|
-
GIT_EXTERN(
|
45
|
+
GIT_EXTERN(size_t) git_index_name_entrycount(git_index *index);
|
46
46
|
|
47
47
|
/**
|
48
48
|
* Get a filename conflict entry from the index.
|
@@ -90,7 +90,7 @@ GIT_EXTERN(void) git_index_name_clear(git_index *index);
|
|
90
90
|
* @param index an existing index object
|
91
91
|
* @return integer of count of current resolve undo entries
|
92
92
|
*/
|
93
|
-
GIT_EXTERN(
|
93
|
+
GIT_EXTERN(size_t) git_index_reuc_entrycount(git_index *index);
|
94
94
|
|
95
95
|
/**
|
96
96
|
* Finds the resolve undo entry that points to the given path in the Git
|
@@ -4,37 +4,35 @@
|
|
4
4
|
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
5
|
* a Linking Exception. For full terms see the included COPYING file.
|
6
6
|
*/
|
7
|
-
#ifndef
|
8
|
-
#define
|
7
|
+
#ifndef INCLUDE_git_openssl_h__
|
8
|
+
#define INCLUDE_git_openssl_h__
|
9
9
|
|
10
|
-
#include "common.h"
|
10
|
+
#include "git2/common.h"
|
11
11
|
|
12
|
-
/**
|
13
|
-
* @file git2/threads.h
|
14
|
-
* @brief Library level thread functions
|
15
|
-
* @defgroup git_thread Threading functions
|
16
|
-
* @ingroup Git
|
17
|
-
* @{
|
18
|
-
*/
|
19
12
|
GIT_BEGIN_DECL
|
20
13
|
|
21
14
|
/**
|
22
15
|
* Initialize the OpenSSL locks
|
23
16
|
*
|
24
17
|
* OpenSSL requires the application to determine how it performs
|
25
|
-
* locking.
|
18
|
+
* locking.
|
19
|
+
*
|
20
|
+
* This is a last-resort convenience function which libgit2 provides for
|
26
21
|
* allocating and initializing the locks as well as setting the
|
27
22
|
* locking function to use the system's native locking functions.
|
28
23
|
*
|
29
24
|
* The locking function will be cleared and the memory will be freed
|
30
25
|
* when you call git_threads_sutdown().
|
31
26
|
*
|
27
|
+
* If your programming language has an OpenSSL package/bindings, it
|
28
|
+
* likely sets up locking. You should very strongly prefer that over
|
29
|
+
* this function.
|
30
|
+
*
|
32
31
|
* @return 0 on success, -1 if there are errors or if libgit2 was not
|
33
32
|
* built with OpenSSL and threading support.
|
34
33
|
*/
|
35
34
|
GIT_EXTERN(int) git_openssl_set_locking(void);
|
36
35
|
|
37
|
-
/** @} */
|
38
36
|
GIT_END_DECL
|
39
37
|
#endif
|
40
38
|
|
@@ -11,6 +11,15 @@
|
|
11
11
|
#include "git2/types.h"
|
12
12
|
#include "git2/oid.h"
|
13
13
|
|
14
|
+
/**
|
15
|
+
* @file git2/sys/refs.h
|
16
|
+
* @brief Low-level Git ref creation
|
17
|
+
* @defgroup git_backend Git custom backend APIs
|
18
|
+
* @ingroup Git
|
19
|
+
* @{
|
20
|
+
*/
|
21
|
+
GIT_BEGIN_DECL
|
22
|
+
|
14
23
|
/**
|
15
24
|
* Create a new direct reference from an OID.
|
16
25
|
*
|
@@ -35,4 +44,6 @@ GIT_EXTERN(git_reference *) git_reference__alloc_symbolic(
|
|
35
44
|
const char *name,
|
36
45
|
const char *target);
|
37
46
|
|
47
|
+
/** @} */
|
48
|
+
GIT_END_DECL
|
38
49
|
#endif
|
@@ -251,7 +251,7 @@ GIT_EXTERN(int) git_tree_entry_to_object(
|
|
251
251
|
* @param source Source tree to initialize the builder (optional)
|
252
252
|
* @return 0 on success; error code otherwise
|
253
253
|
*/
|
254
|
-
GIT_EXTERN(int)
|
254
|
+
GIT_EXTERN(int) git_treebuilder_new(
|
255
255
|
git_treebuilder **out, git_repository *repo, const git_tree *source);
|
256
256
|
|
257
257
|
/**
|
@@ -7,11 +7,11 @@
|
|
7
7
|
#ifndef INCLUDE_git_version_h__
|
8
8
|
#define INCLUDE_git_version_h__
|
9
9
|
|
10
|
-
#define LIBGIT2_VERSION "0.
|
10
|
+
#define LIBGIT2_VERSION "0.22.0"
|
11
11
|
#define LIBGIT2_VER_MAJOR 0
|
12
|
-
#define LIBGIT2_VER_MINOR
|
12
|
+
#define LIBGIT2_VER_MINOR 22
|
13
13
|
#define LIBGIT2_VER_REVISION 0
|
14
14
|
|
15
|
-
#define LIBGIT2_SOVERSION
|
15
|
+
#define LIBGIT2_SOVERSION 22
|
16
16
|
|
17
17
|
#endif
|
@@ -781,8 +781,10 @@ int git_attr_assignment__parse(
|
|
781
781
|
|
782
782
|
error = git_vector_insert_sorted(
|
783
783
|
assigns, massign, &merge_assignments);
|
784
|
-
if (error < 0 && error != GIT_EEXISTS)
|
784
|
+
if (error < 0 && error != GIT_EEXISTS) {
|
785
|
+
git_attr_assignment__free(assign);
|
785
786
|
return error;
|
787
|
+
}
|
786
788
|
}
|
787
789
|
}
|
788
790
|
}
|
data/vendor/libgit2/src/buffer.c
CHANGED
@@ -67,6 +67,8 @@ typedef struct {
|
|
67
67
|
bool reload_submodules;
|
68
68
|
size_t total_steps;
|
69
69
|
size_t completed_steps;
|
70
|
+
git_checkout_perfdata perfdata;
|
71
|
+
git_buf last_mkdir;
|
70
72
|
} checkout_data;
|
71
73
|
|
72
74
|
typedef struct {
|
@@ -1101,7 +1103,7 @@ static int checkout_conflicts_mark_directoryfile(
|
|
1101
1103
|
goto done;
|
1102
1104
|
}
|
1103
1105
|
|
1104
|
-
prefixed = git_path_equal_or_prefixed(path, entry->path);
|
1106
|
+
prefixed = git_path_equal_or_prefixed(path, entry->path, NULL);
|
1105
1107
|
|
1106
1108
|
if (prefixed == GIT_PATH_EQUAL)
|
1107
1109
|
continue;
|
@@ -1289,50 +1291,140 @@ fail:
|
|
1289
1291
|
return error;
|
1290
1292
|
}
|
1291
1293
|
|
1294
|
+
static int checkout_mkdir(
|
1295
|
+
checkout_data *data,
|
1296
|
+
const char *path,
|
1297
|
+
const char *base,
|
1298
|
+
mode_t mode,
|
1299
|
+
unsigned int flags)
|
1300
|
+
{
|
1301
|
+
struct git_futils_mkdir_perfdata mkdir_perfdata = {0};
|
1302
|
+
|
1303
|
+
int error = git_futils_mkdir_withperf(
|
1304
|
+
path, base, mode, flags, &mkdir_perfdata);
|
1305
|
+
|
1306
|
+
data->perfdata.mkdir_calls += mkdir_perfdata.mkdir_calls;
|
1307
|
+
data->perfdata.stat_calls += mkdir_perfdata.stat_calls;
|
1308
|
+
data->perfdata.chmod_calls += mkdir_perfdata.chmod_calls;
|
1309
|
+
|
1310
|
+
return error;
|
1311
|
+
}
|
1312
|
+
|
1313
|
+
static bool should_remove_existing(checkout_data *data)
|
1314
|
+
{
|
1315
|
+
int ignorecase = 0;
|
1316
|
+
|
1317
|
+
git_repository__cvar(&ignorecase, data->repo, GIT_CVAR_IGNORECASE);
|
1318
|
+
|
1319
|
+
return (ignorecase &&
|
1320
|
+
(data->strategy & GIT_CHECKOUT_DONT_REMOVE_EXISTING) == 0);
|
1321
|
+
}
|
1322
|
+
|
1323
|
+
#define MKDIR_NORMAL \
|
1324
|
+
GIT_MKDIR_PATH | GIT_MKDIR_VERIFY_DIR
|
1325
|
+
#define MKDIR_REMOVE_EXISTING \
|
1326
|
+
MKDIR_NORMAL | GIT_MKDIR_REMOVE_FILES | GIT_MKDIR_REMOVE_SYMLINKS
|
1327
|
+
|
1328
|
+
static int mkpath2file(
|
1329
|
+
checkout_data *data, const char *path, unsigned int mode)
|
1330
|
+
{
|
1331
|
+
git_buf *mkdir_path = &data->tmp;
|
1332
|
+
struct stat st;
|
1333
|
+
bool remove_existing = should_remove_existing(data);
|
1334
|
+
int error;
|
1335
|
+
|
1336
|
+
if ((error = git_buf_sets(mkdir_path, path)) < 0)
|
1337
|
+
return error;
|
1338
|
+
|
1339
|
+
git_buf_rtruncate_at_char(mkdir_path, '/');
|
1340
|
+
|
1341
|
+
if (!data->last_mkdir.size ||
|
1342
|
+
data->last_mkdir.size != mkdir_path->size ||
|
1343
|
+
memcmp(mkdir_path->ptr, data->last_mkdir.ptr, mkdir_path->size) != 0) {
|
1344
|
+
|
1345
|
+
if ((error = checkout_mkdir(
|
1346
|
+
data, mkdir_path->ptr, data->opts.target_directory, mode,
|
1347
|
+
remove_existing ? MKDIR_REMOVE_EXISTING : MKDIR_NORMAL)) < 0)
|
1348
|
+
return error;
|
1349
|
+
|
1350
|
+
git_buf_swap(&data->last_mkdir, mkdir_path);
|
1351
|
+
}
|
1352
|
+
|
1353
|
+
if (remove_existing) {
|
1354
|
+
data->perfdata.stat_calls++;
|
1355
|
+
|
1356
|
+
if (p_lstat(path, &st) == 0) {
|
1357
|
+
|
1358
|
+
/* Some file, symlink or folder already exists at this name.
|
1359
|
+
* We would have removed it in remove_the_old unless we're on
|
1360
|
+
* a case inensitive filesystem (or the user has asked us not
|
1361
|
+
* to). Remove the similarly named file to write the new.
|
1362
|
+
*/
|
1363
|
+
error = git_futils_rmdir_r(path, NULL, GIT_RMDIR_REMOVE_FILES);
|
1364
|
+
} else if (errno != ENOENT) {
|
1365
|
+
giterr_set(GITERR_OS, "Failed to stat file '%s'", path);
|
1366
|
+
return GIT_EEXISTS;
|
1367
|
+
} else {
|
1368
|
+
giterr_clear();
|
1369
|
+
}
|
1370
|
+
}
|
1371
|
+
|
1372
|
+
return error;
|
1373
|
+
}
|
1374
|
+
|
1292
1375
|
static int buffer_to_file(
|
1376
|
+
checkout_data *data,
|
1293
1377
|
struct stat *st,
|
1294
1378
|
git_buf *buf,
|
1295
1379
|
const char *path,
|
1296
|
-
mode_t dir_mode,
|
1297
|
-
int file_open_flags,
|
1298
1380
|
mode_t file_mode)
|
1299
1381
|
{
|
1300
1382
|
int error;
|
1301
1383
|
|
1302
|
-
if ((error =
|
1384
|
+
if ((error = mkpath2file(data, path, data->opts.dir_mode)) < 0)
|
1303
1385
|
return error;
|
1304
1386
|
|
1305
1387
|
if ((error = git_futils_writebuffer(
|
1306
|
-
buf, path, file_open_flags, file_mode)) < 0)
|
1388
|
+
buf, path, data->opts.file_open_flags, file_mode)) < 0)
|
1307
1389
|
return error;
|
1308
1390
|
|
1309
|
-
if (st
|
1310
|
-
|
1391
|
+
if (st) {
|
1392
|
+
data->perfdata.stat_calls++;
|
1311
1393
|
|
1312
|
-
|
1313
|
-
(
|
1314
|
-
|
1394
|
+
if ((error = p_stat(path, st)) < 0) {
|
1395
|
+
giterr_set(GITERR_OS, "Error statting '%s'", path);
|
1396
|
+
return error;
|
1397
|
+
}
|
1398
|
+
}
|
1399
|
+
|
1400
|
+
if (GIT_PERMS_IS_EXEC(file_mode)) {
|
1401
|
+
data->perfdata.chmod_calls++;
|
1402
|
+
|
1403
|
+
if ((error = p_chmod(path, file_mode)) < 0)
|
1404
|
+
giterr_set(GITERR_OS, "Failed to set permissions on '%s'", path);
|
1405
|
+
}
|
1315
1406
|
|
1316
1407
|
return error;
|
1317
1408
|
}
|
1318
1409
|
|
1319
1410
|
static int blob_content_to_file(
|
1411
|
+
checkout_data *data,
|
1320
1412
|
struct stat *st,
|
1321
1413
|
git_blob *blob,
|
1322
1414
|
const char *path,
|
1323
1415
|
const char * hint_path,
|
1324
|
-
mode_t entry_filemode
|
1325
|
-
git_checkout_options *opts)
|
1416
|
+
mode_t entry_filemode)
|
1326
1417
|
{
|
1327
|
-
|
1328
|
-
|
1418
|
+
mode_t file_mode = data->opts.file_mode ?
|
1419
|
+
data->opts.file_mode : entry_filemode;
|
1329
1420
|
git_buf out = GIT_BUF_INIT;
|
1330
1421
|
git_filter_list *fl = NULL;
|
1422
|
+
int error = 0;
|
1331
1423
|
|
1332
1424
|
if (hint_path == NULL)
|
1333
1425
|
hint_path = path;
|
1334
1426
|
|
1335
|
-
if (!opts
|
1427
|
+
if (!data->opts.disable_filters)
|
1336
1428
|
error = git_filter_list_load(
|
1337
1429
|
&fl, git_blob_owner(blob), blob, hint_path,
|
1338
1430
|
GIT_FILTER_TO_WORKTREE, GIT_FILTER_OPT_DEFAULT);
|
@@ -1343,9 +1435,7 @@ static int blob_content_to_file(
|
|
1343
1435
|
git_filter_list_free(fl);
|
1344
1436
|
|
1345
1437
|
if (!error) {
|
1346
|
-
error = buffer_to_file(
|
1347
|
-
st, &out, path, opts->dir_mode, opts->file_open_flags, file_mode);
|
1348
|
-
|
1438
|
+
error = buffer_to_file(data, st, &out, path, file_mode);
|
1349
1439
|
st->st_mode = entry_filemode;
|
1350
1440
|
|
1351
1441
|
git_buf_free(&out);
|
@@ -1355,29 +1445,30 @@ static int blob_content_to_file(
|
|
1355
1445
|
}
|
1356
1446
|
|
1357
1447
|
static int blob_content_to_link(
|
1448
|
+
checkout_data *data,
|
1358
1449
|
struct stat *st,
|
1359
1450
|
git_blob *blob,
|
1360
|
-
const char *path
|
1361
|
-
mode_t dir_mode,
|
1362
|
-
int can_symlink)
|
1451
|
+
const char *path)
|
1363
1452
|
{
|
1364
1453
|
git_buf linktarget = GIT_BUF_INIT;
|
1365
1454
|
int error;
|
1366
1455
|
|
1367
|
-
if ((error =
|
1456
|
+
if ((error = mkpath2file(data, path, data->opts.dir_mode)) < 0)
|
1368
1457
|
return error;
|
1369
1458
|
|
1370
1459
|
if ((error = git_blob__getbuf(&linktarget, blob)) < 0)
|
1371
1460
|
return error;
|
1372
1461
|
|
1373
|
-
if (can_symlink) {
|
1462
|
+
if (data->can_symlink) {
|
1374
1463
|
if ((error = p_symlink(git_buf_cstr(&linktarget), path)) < 0)
|
1375
|
-
giterr_set(GITERR_OS, "Could not create symlink %s
|
1464
|
+
giterr_set(GITERR_OS, "Could not create symlink %s", path);
|
1376
1465
|
} else {
|
1377
1466
|
error = git_futils_fake_symlink(git_buf_cstr(&linktarget), path);
|
1378
1467
|
}
|
1379
1468
|
|
1380
1469
|
if (!error) {
|
1470
|
+
data->perfdata.stat_calls++;
|
1471
|
+
|
1381
1472
|
if ((error = p_lstat(path, st)) < 0)
|
1382
1473
|
giterr_set(GITERR_CHECKOUT, "Could not stat symlink %s", path);
|
1383
1474
|
|
@@ -1421,6 +1512,7 @@ static int checkout_submodule_update_index(
|
|
1421
1512
|
if (git_buf_puts(&data->path, file->path) < 0)
|
1422
1513
|
return -1;
|
1423
1514
|
|
1515
|
+
data->perfdata.stat_calls++;
|
1424
1516
|
if (p_stat(git_buf_cstr(&data->path), &st) < 0) {
|
1425
1517
|
giterr_set(
|
1426
1518
|
GITERR_CHECKOUT, "Could not stat submodule %s\n", file->path);
|
@@ -1436,15 +1528,17 @@ static int checkout_submodule(
|
|
1436
1528
|
checkout_data *data,
|
1437
1529
|
const git_diff_file *file)
|
1438
1530
|
{
|
1531
|
+
bool remove_existing = should_remove_existing(data);
|
1439
1532
|
int error = 0;
|
1440
1533
|
|
1441
1534
|
/* Until submodules are supported, UPDATE_ONLY means do nothing here */
|
1442
1535
|
if ((data->strategy & GIT_CHECKOUT_UPDATE_ONLY) != 0)
|
1443
1536
|
return 0;
|
1444
1537
|
|
1445
|
-
if ((error =
|
1446
|
-
|
1447
|
-
data->opts.dir_mode,
|
1538
|
+
if ((error = checkout_mkdir(
|
1539
|
+
data,
|
1540
|
+
file->path, data->opts.target_directory, data->opts.dir_mode,
|
1541
|
+
remove_existing ? MKDIR_REMOVE_EXISTING : MKDIR_NORMAL)) < 0)
|
1448
1542
|
return error;
|
1449
1543
|
|
1450
1544
|
if ((error = git_submodule_lookup(NULL, data->repo, file->path)) < 0) {
|
@@ -1481,10 +1575,13 @@ static void report_progress(
|
|
1481
1575
|
data->opts.progress_payload);
|
1482
1576
|
}
|
1483
1577
|
|
1484
|
-
static int checkout_safe_for_update_only(
|
1578
|
+
static int checkout_safe_for_update_only(
|
1579
|
+
checkout_data *data, const char *path, mode_t expected_mode)
|
1485
1580
|
{
|
1486
1581
|
struct stat st;
|
1487
1582
|
|
1583
|
+
data->perfdata.stat_calls++;
|
1584
|
+
|
1488
1585
|
if (p_lstat(path, &st) < 0) {
|
1489
1586
|
/* if doesn't exist, then no error and no update */
|
1490
1587
|
if (errno == ENOENT || errno == ENOTDIR)
|
@@ -1517,11 +1614,9 @@ static int checkout_write_content(
|
|
1517
1614
|
return error;
|
1518
1615
|
|
1519
1616
|
if (S_ISLNK(mode))
|
1520
|
-
error = blob_content_to_link(
|
1521
|
-
st, blob, full_path, data->opts.dir_mode, data->can_symlink);
|
1617
|
+
error = blob_content_to_link(data, st, blob, full_path);
|
1522
1618
|
else
|
1523
|
-
error = blob_content_to_file(
|
1524
|
-
st, blob, full_path, hint_path, mode, &data->opts);
|
1619
|
+
error = blob_content_to_file(data, st, blob, full_path, hint_path, mode);
|
1525
1620
|
|
1526
1621
|
git_blob_free(blob);
|
1527
1622
|
|
@@ -1552,7 +1647,7 @@ static int checkout_blob(
|
|
1552
1647
|
|
1553
1648
|
if ((data->strategy & GIT_CHECKOUT_UPDATE_ONLY) != 0) {
|
1554
1649
|
int rval = checkout_safe_for_update_only(
|
1555
|
-
git_buf_cstr(&data->path), file->mode);
|
1650
|
+
data, git_buf_cstr(&data->path), file->mode);
|
1556
1651
|
if (rval <= 0)
|
1557
1652
|
return rval;
|
1558
1653
|
}
|
@@ -1807,7 +1902,7 @@ static int checkout_write_entry(
|
|
1807
1902
|
}
|
1808
1903
|
|
1809
1904
|
if ((data->strategy & GIT_CHECKOUT_UPDATE_ONLY) != 0 &&
|
1810
|
-
(error = checkout_safe_for_update_only(git_buf_cstr(&data->path), side->mode)) <= 0)
|
1905
|
+
(error = checkout_safe_for_update_only(data, git_buf_cstr(&data->path), side->mode)) <= 0)
|
1811
1906
|
return error;
|
1812
1907
|
|
1813
1908
|
return checkout_write_content(data,
|
@@ -1906,7 +2001,7 @@ static int checkout_write_merge(
|
|
1906
2001
|
goto done;
|
1907
2002
|
|
1908
2003
|
if ((data->strategy & GIT_CHECKOUT_UPDATE_ONLY) != 0 &&
|
1909
|
-
(error = checkout_safe_for_update_only(git_buf_cstr(&path_workdir), result.mode)) <= 0)
|
2004
|
+
(error = checkout_safe_for_update_only(data, git_buf_cstr(&path_workdir), result.mode)) <= 0)
|
1910
2005
|
goto done;
|
1911
2006
|
|
1912
2007
|
if (!data->opts.disable_filters) {
|
@@ -1922,7 +2017,7 @@ static int checkout_write_merge(
|
|
1922
2017
|
out_data.size = result.len;
|
1923
2018
|
}
|
1924
2019
|
|
1925
|
-
if ((error =
|
2020
|
+
if ((error = mkpath2file(data, path_workdir.ptr, data->opts.dir_mode)) < 0 ||
|
1926
2021
|
(error = git_filebuf_open(&output, git_buf_cstr(&path_workdir), GIT_FILEBUF_DO_NOT_BUFFER, result.mode)) < 0 ||
|
1927
2022
|
(error = git_filebuf_write(&output, out_data.ptr, out_data.size)) < 0 ||
|
1928
2023
|
(error = git_filebuf_commit(&output)) < 0)
|
@@ -2157,8 +2252,9 @@ static int checkout_data_init(
|
|
2157
2252
|
if (!data->opts.target_directory)
|
2158
2253
|
data->opts.target_directory = git_repository_workdir(repo);
|
2159
2254
|
else if (!git_path_isdir(data->opts.target_directory) &&
|
2160
|
-
(error =
|
2161
|
-
|
2255
|
+
(error = checkout_mkdir(data,
|
2256
|
+
data->opts.target_directory, NULL,
|
2257
|
+
GIT_DIR_MODE, GIT_MKDIR_VERIFY_DIR)) < 0)
|
2162
2258
|
goto cleanup;
|
2163
2259
|
|
2164
2260
|
/* refresh config and index content unless NO_REFRESH is given */
|
@@ -2474,7 +2570,7 @@ int git_checkout_tree(
|
|
2474
2570
|
if ((error = git_repository_index(&index, repo)) < 0)
|
2475
2571
|
return error;
|
2476
2572
|
|
2477
|
-
if (!(error = git_iterator_for_tree(&tree_i, tree,
|
2573
|
+
if (!(error = git_iterator_for_tree(&tree_i, tree, GIT_ITERATOR_DONT_IGNORE_CASE, NULL, NULL)))
|
2478
2574
|
error = git_checkout_iterator(tree_i, index, opts);
|
2479
2575
|
|
2480
2576
|
git_iterator_free(tree_i);
|