rugged 0.24.0b8 → 0.24.0b9
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/ext/rugged/rugged_tree.c +7 -3
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +27 -1
- data/vendor/libgit2/include/git2/common.h +12 -7
- data/vendor/libgit2/include/git2/diff.h +24 -5
- data/vendor/libgit2/include/git2/merge.h +31 -13
- data/vendor/libgit2/include/git2/repository.h +2 -0
- data/vendor/libgit2/include/git2/submodule.h +12 -1
- data/vendor/libgit2/include/git2/sys/stream.h +13 -0
- data/vendor/libgit2/include/git2/sys/transport.h +1 -0
- data/vendor/libgit2/src/annotated_commit.c +71 -18
- data/vendor/libgit2/src/annotated_commit.h +26 -1
- data/vendor/libgit2/src/checkout.c +1 -2
- data/vendor/libgit2/src/commit.c +25 -10
- data/vendor/libgit2/src/common.h +1 -0
- data/vendor/libgit2/src/config_file.c +5 -10
- data/vendor/libgit2/src/diff.c +18 -21
- data/vendor/libgit2/src/diff.h +0 -1
- data/vendor/libgit2/src/diff_file.c +25 -0
- data/vendor/libgit2/src/filebuf.c +6 -0
- data/vendor/libgit2/src/fileops.c +54 -29
- data/vendor/libgit2/src/fileops.h +3 -2
- data/vendor/libgit2/src/global.c +5 -0
- data/vendor/libgit2/src/global.h +2 -0
- data/vendor/libgit2/src/index.c +105 -58
- data/vendor/libgit2/src/index.h +39 -0
- data/vendor/libgit2/src/merge.c +303 -104
- data/vendor/libgit2/src/merge.h +2 -2
- data/vendor/libgit2/src/object.c +0 -2
- data/vendor/libgit2/src/pool.c +16 -8
- data/vendor/libgit2/src/refdb_fs.c +15 -5
- data/vendor/libgit2/src/refs.h +5 -0
- data/vendor/libgit2/src/repository.c +10 -3
- data/vendor/libgit2/src/reset.c +6 -6
- data/vendor/libgit2/src/settings.c +31 -3
- data/vendor/libgit2/src/stream.h +3 -0
- data/vendor/libgit2/src/submodule.c +19 -25
- data/vendor/libgit2/src/tls_stream.c +13 -0
- data/vendor/libgit2/src/transports/http.c +12 -1
- data/vendor/libgit2/src/transports/winhttp.c +34 -2
- data/vendor/libgit2/src/tree.c +75 -21
- data/vendor/libgit2/src/tree.h +5 -2
- data/vendor/libgit2/src/win32/mingw-compat.h +0 -6
- data/vendor/libgit2/src/win32/msvc-compat.h +0 -3
- data/vendor/libgit2/src/win32/w32_util.h +14 -8
- data/vendor/libgit2/src/win32/win32-compat.h +42 -0
- metadata +3 -2
data/vendor/libgit2/src/tree.c
CHANGED
@@ -81,14 +81,26 @@ int git_tree_entry_icmp(const git_tree_entry *e1, const git_tree_entry *e2)
|
|
81
81
|
git__strncasecmp);
|
82
82
|
}
|
83
83
|
|
84
|
-
|
84
|
+
/**
|
85
|
+
* Allocate either from the pool or from the system allocator
|
86
|
+
*/
|
87
|
+
static git_tree_entry *alloc_entry_base(git_pool *pool, const char *filename, size_t filename_len)
|
85
88
|
{
|
86
89
|
git_tree_entry *entry = NULL;
|
87
|
-
size_t
|
90
|
+
size_t tree_len;
|
91
|
+
|
92
|
+
if (filename_len > UINT16_MAX) {
|
93
|
+
giterr_set(GITERR_INVALID, "tree entry is over UINT16_MAX in length");
|
94
|
+
return NULL;
|
95
|
+
}
|
88
96
|
|
89
97
|
if (GIT_ADD_SIZET_OVERFLOW(&tree_len, sizeof(git_tree_entry), filename_len) ||
|
90
|
-
|
91
|
-
|
98
|
+
GIT_ADD_SIZET_OVERFLOW(&tree_len, tree_len, 1))
|
99
|
+
return NULL;
|
100
|
+
|
101
|
+
entry = pool ? git_pool_malloc(pool, tree_len) :
|
102
|
+
git__malloc(tree_len);
|
103
|
+
if (!entry)
|
92
104
|
return NULL;
|
93
105
|
|
94
106
|
memset(entry, 0x0, sizeof(git_tree_entry));
|
@@ -99,9 +111,31 @@ static git_tree_entry *alloc_entry(const char *filename)
|
|
99
111
|
return entry;
|
100
112
|
}
|
101
113
|
|
114
|
+
/**
|
115
|
+
* Allocate a tree entry, using the poolin the tree which owns
|
116
|
+
* it. This is useful when reading trees, so we don't allocate a ton
|
117
|
+
* of small strings but can use the pool.
|
118
|
+
*/
|
119
|
+
static git_tree_entry *alloc_entry_pooled(git_pool *pool, const char *filename, size_t filename_len)
|
120
|
+
{
|
121
|
+
git_tree_entry *entry = NULL;
|
122
|
+
|
123
|
+
if (!(entry = alloc_entry_base(pool, filename, filename_len)))
|
124
|
+
return NULL;
|
125
|
+
|
126
|
+
entry->pooled = true;
|
127
|
+
|
128
|
+
return entry;
|
129
|
+
}
|
130
|
+
|
131
|
+
static git_tree_entry *alloc_entry(const char *filename)
|
132
|
+
{
|
133
|
+
return alloc_entry_base(NULL, filename, strlen(filename));
|
134
|
+
}
|
135
|
+
|
102
136
|
struct tree_key_search {
|
103
137
|
const char *filename;
|
104
|
-
|
138
|
+
uint16_t filename_len;
|
105
139
|
};
|
106
140
|
|
107
141
|
static int homing_search_cmp(const void *key, const void *array_member)
|
@@ -198,7 +232,7 @@ static int tree_key_search(
|
|
198
232
|
|
199
233
|
void git_tree_entry_free(git_tree_entry *entry)
|
200
234
|
{
|
201
|
-
if (entry == NULL)
|
235
|
+
if (entry == NULL || entry->pooled)
|
202
236
|
return;
|
203
237
|
|
204
238
|
git__free(entry);
|
@@ -219,6 +253,8 @@ int git_tree_entry_dup(git_tree_entry **dest, const git_tree_entry *source)
|
|
219
253
|
|
220
254
|
memcpy(copy, source, total_size);
|
221
255
|
|
256
|
+
copy->pooled = 0;
|
257
|
+
|
222
258
|
*dest = copy;
|
223
259
|
return 0;
|
224
260
|
}
|
@@ -233,6 +269,7 @@ void git_tree__free(void *_tree)
|
|
233
269
|
git_tree_entry_free(e);
|
234
270
|
|
235
271
|
git_vector_free(&tree->entries);
|
272
|
+
git_pool_clear(&tree->pool);
|
236
273
|
git__free(tree);
|
237
274
|
}
|
238
275
|
|
@@ -379,51 +416,68 @@ static int tree_error(const char *str, const char *path)
|
|
379
416
|
return -1;
|
380
417
|
}
|
381
418
|
|
419
|
+
static int parse_mode(unsigned int *modep, const char *buffer, const char **buffer_out)
|
420
|
+
{
|
421
|
+
unsigned char c;
|
422
|
+
unsigned int mode = 0;
|
423
|
+
|
424
|
+
if (*buffer == ' ')
|
425
|
+
return -1;
|
426
|
+
|
427
|
+
while ((c = *buffer++) != ' ') {
|
428
|
+
if (c < '0' || c > '7')
|
429
|
+
return -1;
|
430
|
+
mode = (mode << 3) + (c - '0');
|
431
|
+
}
|
432
|
+
*modep = mode;
|
433
|
+
*buffer_out = buffer;
|
434
|
+
|
435
|
+
return 0;
|
436
|
+
}
|
437
|
+
|
382
438
|
int git_tree__parse(void *_tree, git_odb_object *odb_obj)
|
383
439
|
{
|
384
440
|
git_tree *tree = _tree;
|
385
441
|
const char *buffer = git_odb_object_data(odb_obj);
|
386
442
|
const char *buffer_end = buffer + git_odb_object_size(odb_obj);
|
387
443
|
|
444
|
+
git_pool_init(&tree->pool, 1);
|
388
445
|
if (git_vector_init(&tree->entries, DEFAULT_TREE_SIZE, entry_sort_cmp) < 0)
|
389
446
|
return -1;
|
390
447
|
|
391
448
|
while (buffer < buffer_end) {
|
392
449
|
git_tree_entry *entry;
|
393
|
-
|
450
|
+
size_t filename_len;
|
451
|
+
const char *nul;
|
452
|
+
unsigned int attr;
|
394
453
|
|
395
|
-
if (
|
454
|
+
if (parse_mode(&attr, buffer, &buffer) < 0 || !buffer)
|
396
455
|
return tree_error("Failed to parse tree. Can't parse filemode", NULL);
|
397
456
|
|
398
|
-
if (
|
399
|
-
return tree_error("Failed to parse tree. Object is corrupted", NULL);
|
400
|
-
|
401
|
-
if (memchr(buffer, 0, buffer_end - buffer) == NULL)
|
457
|
+
if ((nul = memchr(buffer, 0, buffer_end - buffer)) == NULL)
|
402
458
|
return tree_error("Failed to parse tree. Object is corrupted", NULL);
|
403
459
|
|
460
|
+
filename_len = nul - buffer;
|
404
461
|
/** Allocate the entry and store it in the entries vector */
|
405
462
|
{
|
406
|
-
entry =
|
463
|
+
entry = alloc_entry_pooled(&tree->pool, buffer, filename_len);
|
407
464
|
GITERR_CHECK_ALLOC(entry);
|
408
465
|
|
409
|
-
if (git_vector_insert(&tree->entries, entry) < 0)
|
410
|
-
git__free(entry);
|
466
|
+
if (git_vector_insert(&tree->entries, entry) < 0)
|
411
467
|
return -1;
|
412
|
-
}
|
413
468
|
|
414
469
|
entry->attr = attr;
|
415
470
|
}
|
416
471
|
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
buffer++;
|
472
|
+
/* Advance to the ID just after the path */
|
473
|
+
buffer += filename_len + 1;
|
421
474
|
|
422
475
|
git_oid_fromraw(&entry->oid, (const unsigned char *)buffer);
|
423
476
|
buffer += GIT_OID_RAWSZ;
|
424
477
|
}
|
425
478
|
|
426
|
-
|
479
|
+
/* The tree is sorted by definition. Bad inputs give bad outputs */
|
480
|
+
tree->entries.flags |= GIT_VECTOR_SORTED;
|
427
481
|
|
428
482
|
return 0;
|
429
483
|
}
|
data/vendor/libgit2/src/tree.h
CHANGED
@@ -12,17 +12,20 @@
|
|
12
12
|
#include "odb.h"
|
13
13
|
#include "vector.h"
|
14
14
|
#include "strmap.h"
|
15
|
+
#include "pool.h"
|
15
16
|
|
16
17
|
struct git_tree_entry {
|
17
18
|
uint16_t attr;
|
19
|
+
uint16_t filename_len;
|
18
20
|
git_oid oid;
|
19
|
-
|
20
|
-
char filename[
|
21
|
+
bool pooled;
|
22
|
+
char filename[GIT_FLEX_ARRAY];
|
21
23
|
};
|
22
24
|
|
23
25
|
struct git_tree {
|
24
26
|
git_object object;
|
25
27
|
git_vector entries;
|
28
|
+
git_pool pool;
|
26
29
|
};
|
27
30
|
|
28
31
|
struct git_treebuilder {
|
@@ -11,12 +11,6 @@
|
|
11
11
|
|
12
12
|
#undef stat
|
13
13
|
|
14
|
-
#if _WIN32_WINNT >= 0x0601
|
15
|
-
#define stat __stat64
|
16
|
-
#else
|
17
|
-
#define stat _stati64
|
18
|
-
#endif
|
19
|
-
|
20
14
|
#if _WIN32_WINNT < 0x0600 && !defined(__MINGW64_VERSION_MAJOR)
|
21
15
|
#undef MemoryBarrier
|
22
16
|
void __mingworg_MemoryBarrier(void);
|
@@ -76,17 +76,23 @@ size_t git_win32__path_trim_end(wchar_t *str, size_t len);
|
|
76
76
|
size_t git_win32__canonicalize_path(wchar_t *str, size_t len);
|
77
77
|
|
78
78
|
/**
|
79
|
-
* Converts a FILETIME structure to a
|
79
|
+
* Converts a FILETIME structure to a struct timespec.
|
80
80
|
*
|
81
81
|
* @param FILETIME A pointer to a FILETIME
|
82
|
-
* @
|
82
|
+
* @param ts A pointer to the timespec structure to fill in
|
83
83
|
*/
|
84
|
-
GIT_INLINE(
|
84
|
+
GIT_INLINE(void) git_win32__filetime_to_timespec(
|
85
|
+
const FILETIME *ft,
|
86
|
+
struct timespec *ts)
|
85
87
|
{
|
86
88
|
long long winTime = ((long long)ft->dwHighDateTime << 32) + ft->dwLowDateTime;
|
87
89
|
winTime -= 116444736000000000LL; /* Windows to Unix Epoch conversion */
|
88
|
-
winTime
|
89
|
-
|
90
|
+
ts->tv_sec = (time_t)(winTime / 10000000);
|
91
|
+
#ifdef GIT_USE_NSEC
|
92
|
+
ts->tv_nsec = (winTime % 10000000) * 100;
|
93
|
+
#else
|
94
|
+
ts->tv_nsec = 0;
|
95
|
+
#endif
|
90
96
|
}
|
91
97
|
|
92
98
|
GIT_INLINE(void) git_win32__timeval_to_filetime(
|
@@ -122,9 +128,9 @@ GIT_INLINE(int) git_win32__file_attribute_to_stat(
|
|
122
128
|
st->st_size = ((git_off_t)attrdata->nFileSizeHigh << 32) + attrdata->nFileSizeLow;
|
123
129
|
st->st_dev = _getdrive() - 1;
|
124
130
|
st->st_rdev = st->st_dev;
|
125
|
-
|
126
|
-
|
127
|
-
|
131
|
+
git_win32__filetime_to_timespec(&(attrdata->ftLastAccessTime), &(st->st_atim));
|
132
|
+
git_win32__filetime_to_timespec(&(attrdata->ftLastWriteTime), &(st->st_mtim));
|
133
|
+
git_win32__filetime_to_timespec(&(attrdata->ftCreationTime), &(st->st_ctim));
|
128
134
|
|
129
135
|
if (attrdata->dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT && path) {
|
130
136
|
git_win32_path target;
|
@@ -0,0 +1,42 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) the libgit2 contributors. All rights reserved.
|
3
|
+
*
|
4
|
+
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
|
+
* a Linking Exception. For full terms see the included COPYING file.
|
6
|
+
*/
|
7
|
+
#ifndef INCLUDE_win32_compat__
|
8
|
+
#define INCLUDE_win32_compat__
|
9
|
+
|
10
|
+
#include <stdint.h>
|
11
|
+
#include <time.h>
|
12
|
+
#include <wchar.h>
|
13
|
+
#include <sys/stat.h>
|
14
|
+
#include <sys/types.h>
|
15
|
+
|
16
|
+
struct p_timespec {
|
17
|
+
time_t tv_sec;
|
18
|
+
long tv_nsec;
|
19
|
+
};
|
20
|
+
|
21
|
+
#define timespec p_timespec
|
22
|
+
|
23
|
+
struct p_stat {
|
24
|
+
_dev_t st_dev;
|
25
|
+
_ino_t st_ino;
|
26
|
+
mode_t st_mode;
|
27
|
+
short st_nlink;
|
28
|
+
short st_uid;
|
29
|
+
short st_gid;
|
30
|
+
_dev_t st_rdev;
|
31
|
+
__int64 st_size;
|
32
|
+
struct timespec st_atim;
|
33
|
+
struct timespec st_mtim;
|
34
|
+
struct timespec st_ctim;
|
35
|
+
#define st_atime st_atim.tv_sec
|
36
|
+
#define st_mtime st_mtim.tv_sec
|
37
|
+
#define st_ctime st_ctim.tv_sec
|
38
|
+
};
|
39
|
+
|
40
|
+
#define stat p_stat
|
41
|
+
|
42
|
+
#endif /* INCLUDE_win32_compat__ */
|
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.
|
4
|
+
version: 0.24.0b9
|
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
|
+
date: 2015-12-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake-compiler
|
@@ -492,6 +492,7 @@ files:
|
|
492
492
|
- vendor/libgit2/src/win32/w32_stack.h
|
493
493
|
- vendor/libgit2/src/win32/w32_util.c
|
494
494
|
- vendor/libgit2/src/win32/w32_util.h
|
495
|
+
- vendor/libgit2/src/win32/win32-compat.h
|
495
496
|
- vendor/libgit2/src/xdiff/xdiff.h
|
496
497
|
- vendor/libgit2/src/xdiff/xdiffi.c
|
497
498
|
- vendor/libgit2/src/xdiff/xdiffi.h
|