rugged 0.21.1b2 → 0.21.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -12
- data/ext/rugged/extconf.rb +8 -8
- data/ext/rugged/rugged.h +1 -1
- data/ext/rugged/rugged_blob.c +0 -57
- data/ext/rugged/rugged_cred.c +0 -23
- data/ext/rugged/rugged_index.c +2 -6
- data/ext/rugged/rugged_remote.c +1 -69
- data/ext/rugged/rugged_repo.c +5 -287
- data/ext/rugged/rugged_tag_collection.c +2 -70
- data/ext/rugged/rugged_tree.c +10 -29
- data/lib/rugged.rb +0 -2
- data/lib/rugged/diff.rb +1 -0
- data/lib/rugged/diff/line.rb +3 -1
- data/lib/rugged/patch.rb +2 -12
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +0 -11
- data/vendor/libgit2/deps/http-parser/http_parser.h +0 -2
- data/vendor/libgit2/deps/zlib/adler32.c +29 -39
- data/vendor/libgit2/deps/zlib/crc32.c +50 -33
- data/vendor/libgit2/deps/zlib/crc32.h +1 -1
- data/vendor/libgit2/deps/zlib/deflate.c +65 -198
- data/vendor/libgit2/deps/zlib/deflate.h +4 -8
- data/vendor/libgit2/deps/zlib/inffast.c +3 -3
- data/vendor/libgit2/deps/zlib/inffixed.h +3 -3
- data/vendor/libgit2/deps/zlib/inflate.c +52 -84
- data/vendor/libgit2/deps/zlib/inftrees.c +39 -15
- data/vendor/libgit2/deps/zlib/trees.c +36 -18
- data/vendor/libgit2/deps/zlib/zconf.h +0 -4
- data/vendor/libgit2/deps/zlib/zlib.h +95 -250
- data/vendor/libgit2/deps/zlib/zutil.c +10 -13
- data/vendor/libgit2/deps/zlib/zutil.h +62 -41
- data/vendor/libgit2/include/git2/attr.h +13 -16
- data/vendor/libgit2/include/git2/buffer.h +0 -16
- data/vendor/libgit2/include/git2/checkout.h +12 -12
- data/vendor/libgit2/include/git2/cherrypick.h +15 -15
- data/vendor/libgit2/include/git2/clone.h +69 -77
- data/vendor/libgit2/include/git2/diff.h +0 -7
- data/vendor/libgit2/include/git2/errors.h +0 -2
- data/vendor/libgit2/include/git2/merge.h +0 -16
- data/vendor/libgit2/include/git2/oid.h +4 -8
- data/vendor/libgit2/include/git2/remote.h +32 -13
- data/vendor/libgit2/include/git2/repository.h +1 -4
- data/vendor/libgit2/include/git2/reset.h +0 -4
- data/vendor/libgit2/include/git2/revert.h +1 -1
- data/vendor/libgit2/include/git2/status.h +14 -17
- data/vendor/libgit2/include/git2/submodule.h +0 -18
- data/vendor/libgit2/include/git2/sys/repository.h +0 -13
- data/vendor/libgit2/include/git2/transport.h +313 -79
- data/vendor/libgit2/include/git2/tree.h +2 -4
- data/vendor/libgit2/include/git2/types.h +6 -54
- data/vendor/libgit2/include/git2/version.h +2 -2
- data/vendor/libgit2/src/attr.c +4 -8
- data/vendor/libgit2/src/attr_file.c +1 -14
- data/vendor/libgit2/src/blame.c +1 -0
- data/vendor/libgit2/src/buf_text.c +5 -9
- data/vendor/libgit2/src/buf_text.h +2 -3
- data/vendor/libgit2/src/buffer.c +10 -67
- data/vendor/libgit2/src/buffer.h +2 -4
- data/vendor/libgit2/src/cache.c +9 -9
- data/vendor/libgit2/src/cache.h +1 -1
- data/vendor/libgit2/src/checkout.c +44 -121
- data/vendor/libgit2/src/cherrypick.c +44 -41
- data/vendor/libgit2/src/clone.c +56 -94
- data/vendor/libgit2/src/config_file.c +7 -2
- data/vendor/libgit2/src/crlf.c +1 -2
- data/vendor/libgit2/src/diff.c +0 -21
- data/vendor/libgit2/src/diff_file.c +0 -1
- data/vendor/libgit2/src/diff_print.c +9 -11
- data/vendor/libgit2/src/diff_tform.c +2 -4
- data/vendor/libgit2/src/errors.c +7 -9
- data/vendor/libgit2/src/filebuf.c +2 -0
- data/vendor/libgit2/src/fileops.c +7 -9
- data/vendor/libgit2/src/filter.c +11 -2
- data/vendor/libgit2/src/global.c +20 -3
- data/vendor/libgit2/src/global.h +0 -2
- data/vendor/libgit2/src/graph.c +2 -2
- data/vendor/libgit2/src/hashsig.c +1 -1
- data/vendor/libgit2/{include/git2/sys → src}/hashsig.h +7 -11
- data/vendor/libgit2/src/ignore.c +2 -2
- data/vendor/libgit2/src/indexer.c +1 -13
- data/vendor/libgit2/src/merge.c +145 -99
- data/vendor/libgit2/src/merge.h +1 -1
- data/vendor/libgit2/src/mwindow.c +8 -117
- data/vendor/libgit2/src/mwindow.h +1 -9
- data/vendor/libgit2/src/netops.c +7 -6
- data/vendor/libgit2/src/netops.h +4 -0
- data/vendor/libgit2/src/odb_loose.c +1 -1
- data/vendor/libgit2/src/odb_pack.c +3 -6
- data/vendor/libgit2/src/oid.c +0 -8
- data/vendor/libgit2/src/oid.h +0 -11
- data/vendor/libgit2/src/pack.c +6 -20
- data/vendor/libgit2/src/pack.h +0 -3
- data/vendor/libgit2/src/path.c +64 -134
- data/vendor/libgit2/src/path.h +1 -22
- data/vendor/libgit2/src/posix.h +28 -46
- data/vendor/libgit2/src/refs.h +2 -2
- data/vendor/libgit2/src/refspec.c +2 -14
- data/vendor/libgit2/src/remote.c +26 -29
- data/vendor/libgit2/src/remote.h +1 -3
- data/vendor/libgit2/src/repository.c +14 -54
- data/vendor/libgit2/src/revert.c +6 -4
- data/vendor/libgit2/src/revparse.c +18 -15
- data/vendor/libgit2/src/signature.c +2 -2
- data/vendor/libgit2/src/stash.c +1 -2
- data/vendor/libgit2/src/status.c +2 -11
- data/vendor/libgit2/src/strnlen.h +1 -2
- data/vendor/libgit2/src/submodule.c +33 -73
- data/vendor/libgit2/src/tag.c +3 -2
- data/vendor/libgit2/src/thread-utils.h +7 -0
- data/vendor/libgit2/src/trace.h +1 -9
- data/vendor/libgit2/src/transport.c +90 -93
- data/vendor/libgit2/src/transports/cred.c +0 -58
- data/vendor/libgit2/src/transports/cred_helpers.c +0 -3
- data/vendor/libgit2/src/transports/git.c +0 -1
- data/vendor/libgit2/src/transports/http.c +82 -205
- data/vendor/libgit2/src/transports/smart.c +0 -2
- data/vendor/libgit2/src/transports/smart.h +0 -2
- data/vendor/libgit2/src/transports/smart_protocol.c +5 -7
- data/vendor/libgit2/src/transports/ssh.c +35 -224
- data/vendor/libgit2/src/transports/winhttp.c +34 -140
- data/vendor/libgit2/src/tree.c +60 -64
- data/vendor/libgit2/src/tree.h +3 -2
- data/vendor/libgit2/src/unix/posix.h +9 -23
- data/vendor/libgit2/src/unix/realpath.c +7 -8
- data/vendor/libgit2/src/util.c +1 -2
- data/vendor/libgit2/src/util.h +3 -3
- data/vendor/libgit2/src/win32/mingw-compat.h +12 -5
- data/vendor/libgit2/src/win32/msvc-compat.h +32 -3
- data/vendor/libgit2/src/win32/posix.h +31 -20
- data/vendor/libgit2/src/win32/posix_w32.c +18 -62
- metadata +5 -18
- data/lib/rugged/attributes.rb +0 -41
- data/lib/rugged/blob.rb +0 -28
- data/vendor/libgit2/cmake/Modules/FindGSSAPI.cmake +0 -324
- data/vendor/libgit2/deps/zlib/infback.c +0 -640
- data/vendor/libgit2/include/git2/oidarray.h +0 -40
- data/vendor/libgit2/include/git2/sys/transport.h +0 -352
- data/vendor/libgit2/src/oidarray.c +0 -21
- data/vendor/libgit2/src/oidarray.h +0 -18
- data/vendor/libgit2/src/transports/auth.c +0 -71
- data/vendor/libgit2/src/transports/auth.h +0 -63
- data/vendor/libgit2/src/transports/auth_negotiate.c +0 -275
- data/vendor/libgit2/src/transports/auth_negotiate.h +0 -27
- data/vendor/libgit2/src/transports/cred.h +0 -14
@@ -301,10 +301,8 @@ GIT_EXTERN(const git_tree_entry *) git_treebuilder_get(
|
|
301
301
|
* If an entry named `filename` already exists, its attributes
|
302
302
|
* will be updated with the given ones.
|
303
303
|
*
|
304
|
-
* The optional pointer `out` can be used to retrieve a pointer to
|
305
|
-
* newly created/updated entry. Pass NULL if you do not need it.
|
306
|
-
* pointer may not be valid past the next operation in this
|
307
|
-
* builder. Duplicate the entry if you want to keep it.
|
304
|
+
* The optional pointer `out` can be used to retrieve a pointer to
|
305
|
+
* the newly created/updated entry. Pass NULL if you do not need it.
|
308
306
|
*
|
309
307
|
* No attempt is being made to ensure that the provided oid points
|
310
308
|
* to an existing git object in the object database, nor that the
|
@@ -198,12 +198,12 @@ typedef enum {
|
|
198
198
|
|
199
199
|
/** Valid modes for index and tree entries. */
|
200
200
|
typedef enum {
|
201
|
-
|
202
|
-
GIT_FILEMODE_TREE
|
203
|
-
GIT_FILEMODE_BLOB
|
204
|
-
GIT_FILEMODE_BLOB_EXECUTABLE
|
205
|
-
GIT_FILEMODE_LINK
|
206
|
-
GIT_FILEMODE_COMMIT
|
201
|
+
GIT_FILEMODE_NEW = 0000000,
|
202
|
+
GIT_FILEMODE_TREE = 0040000,
|
203
|
+
GIT_FILEMODE_BLOB = 0100644,
|
204
|
+
GIT_FILEMODE_BLOB_EXECUTABLE = 0100755,
|
205
|
+
GIT_FILEMODE_LINK = 0120000,
|
206
|
+
GIT_FILEMODE_COMMIT = 0160000,
|
207
207
|
} git_filemode_t;
|
208
208
|
|
209
209
|
typedef struct git_refspec git_refspec;
|
@@ -243,54 +243,6 @@ typedef struct git_transfer_progress {
|
|
243
243
|
*/
|
244
244
|
typedef int (*git_transfer_progress_cb)(const git_transfer_progress *stats, void *payload);
|
245
245
|
|
246
|
-
/**
|
247
|
-
* Type for messages delivered by the transport. Return a negative value
|
248
|
-
* to cancel the network operation.
|
249
|
-
*
|
250
|
-
* @param str The message from the transport
|
251
|
-
* @param len The length of the message
|
252
|
-
* @param payload Payload provided by the caller
|
253
|
-
*/
|
254
|
-
typedef int (*git_transport_message_cb)(const char *str, int len, void *payload);
|
255
|
-
|
256
|
-
/**
|
257
|
-
* Type of host certificate structure that is passed to the check callback
|
258
|
-
*/
|
259
|
-
typedef enum git_cert_t {
|
260
|
-
/**
|
261
|
-
* The `data` argument to the callback will be a pointer to
|
262
|
-
* the DER-encoded data.
|
263
|
-
*/
|
264
|
-
GIT_CERT_X509,
|
265
|
-
/**
|
266
|
-
* The `data` argument to the callback will be a pointer to a
|
267
|
-
* `git_cert_hostkey` structure.
|
268
|
-
*/
|
269
|
-
GIT_CERT_HOSTKEY_LIBSSH2,
|
270
|
-
} git_cert_t;
|
271
|
-
|
272
|
-
/**
|
273
|
-
* Parent type for `git_cert_hostkey` and `git_cert_x509`.
|
274
|
-
*/
|
275
|
-
typedef struct {
|
276
|
-
/**
|
277
|
-
* Type of certificate. A `GIT_CERT_` value.
|
278
|
-
*/
|
279
|
-
git_cert_t cert_type;
|
280
|
-
} git_cert;
|
281
|
-
|
282
|
-
/**
|
283
|
-
* Callback for the user's custom certificate checks.
|
284
|
-
*
|
285
|
-
* @param type The type of certificate or host info, SSH or X.509
|
286
|
-
* @param data The data for the certificate or host info
|
287
|
-
* @param len The size of the certificate or host info
|
288
|
-
* @param valid Whether the libgit2 checks (OpenSSL or WinHTTP) think
|
289
|
-
* this certificate is valid
|
290
|
-
* @param payload Payload provided by the caller
|
291
|
-
*/
|
292
|
-
typedef int (*git_transport_certificate_check_cb)(git_cert *cert, int valid, void *payload);
|
293
|
-
|
294
246
|
/**
|
295
247
|
* Opaque structure representing a submodule.
|
296
248
|
*/
|
@@ -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.21.
|
10
|
+
#define LIBGIT2_VERSION "0.21.2"
|
11
11
|
#define LIBGIT2_VER_MAJOR 0
|
12
12
|
#define LIBGIT2_VER_MINOR 21
|
13
|
-
#define LIBGIT2_VER_REVISION
|
13
|
+
#define LIBGIT2_VER_REVISION 2
|
14
14
|
|
15
15
|
#define LIBGIT2_SOVERSION 21
|
16
16
|
|
data/vendor/libgit2/src/attr.c
CHANGED
@@ -377,7 +377,7 @@ static int push_attr_file(
|
|
377
377
|
return error;
|
378
378
|
}
|
379
379
|
|
380
|
-
static int push_one_attr(void *ref,
|
380
|
+
static int push_one_attr(void *ref, git_buf *path)
|
381
381
|
{
|
382
382
|
int error = 0, n_src, i;
|
383
383
|
attr_walk_up_info *info = (attr_walk_up_info *)ref;
|
@@ -388,7 +388,7 @@ static int push_one_attr(void *ref, const char *path)
|
|
388
388
|
|
389
389
|
for (i = 0; !error && i < n_src; ++i)
|
390
390
|
error = push_attr_file(
|
391
|
-
info->repo, info->files, src[i], path, GIT_ATTR_FILE);
|
391
|
+
info->repo, info->files, src[i], path->ptr, GIT_ATTR_FILE);
|
392
392
|
|
393
393
|
return error;
|
394
394
|
}
|
@@ -411,7 +411,7 @@ static int collect_attr_files(
|
|
411
411
|
const char *path,
|
412
412
|
git_vector *files)
|
413
413
|
{
|
414
|
-
int error
|
414
|
+
int error;
|
415
415
|
git_buf dir = GIT_BUF_INIT;
|
416
416
|
const char *workdir = git_repository_workdir(repo);
|
417
417
|
attr_walk_up_info info = { NULL };
|
@@ -447,11 +447,7 @@ static int collect_attr_files(
|
|
447
447
|
giterr_clear(); /* no error even if there is no index */
|
448
448
|
info.files = files;
|
449
449
|
|
450
|
-
|
451
|
-
error = push_one_attr(&info, "");
|
452
|
-
else
|
453
|
-
error = git_path_walk_up(&dir, workdir, push_one_attr, &info);
|
454
|
-
|
450
|
+
error = git_path_walk_up(&dir, workdir, push_one_attr, &info);
|
455
451
|
if (error < 0)
|
456
452
|
goto cleanup;
|
457
453
|
|
@@ -378,18 +378,6 @@ bool git_attr_fnmatch__match(
|
|
378
378
|
return (matchval != FNM_NOMATCH);
|
379
379
|
}
|
380
380
|
|
381
|
-
/* if path is a directory prefix of a negated pattern, then match */
|
382
|
-
if ((match->flags & GIT_ATTR_FNMATCH_NEGATIVE) && path->is_dir) {
|
383
|
-
size_t pathlen = strlen(path->path);
|
384
|
-
bool prefixed = (pathlen <= match->length) &&
|
385
|
-
((match->flags & GIT_ATTR_FNMATCH_ICASE) ?
|
386
|
-
!strncasecmp(match->pattern, path->path, pathlen) :
|
387
|
-
!strncmp(match->pattern, path->path, pathlen));
|
388
|
-
|
389
|
-
if (prefixed && git_path_at_end_of_segment(&match->pattern[pathlen]))
|
390
|
-
return true;
|
391
|
-
}
|
392
|
-
|
393
381
|
return (p_fnmatch(match->pattern, filename, flags) != FNM_NOMATCH);
|
394
382
|
}
|
395
383
|
|
@@ -534,8 +522,7 @@ int git_attr_fnmatch__parse(
|
|
534
522
|
}
|
535
523
|
|
536
524
|
if (*pattern == '!' && (spec->flags & GIT_ATTR_FNMATCH_ALLOWNEG) != 0) {
|
537
|
-
spec->flags = spec->flags |
|
538
|
-
GIT_ATTR_FNMATCH_NEGATIVE | GIT_ATTR_FNMATCH_LEADINGDIR;
|
525
|
+
spec->flags = spec->flags | GIT_ATTR_FNMATCH_NEGATIVE;
|
539
526
|
pattern++;
|
540
527
|
}
|
541
528
|
|
data/vendor/libgit2/src/blame.c
CHANGED
@@ -123,13 +123,9 @@ int git_buf_text_lf_to_crlf(git_buf *tgt, const git_buf *src)
|
|
123
123
|
|
124
124
|
for (; next; scan = next + 1, next = memchr(scan, '\n', end - scan)) {
|
125
125
|
size_t copylen = next - scan;
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
if (next > start && next[-1] == '\r') {
|
130
|
-
git_buf_free(tgt);
|
131
|
-
return GIT_PASSTHROUGH;
|
132
|
-
}
|
126
|
+
/* don't convert existing \r\n to \r\r\n */
|
127
|
+
size_t extralen = (next > start && next[-1] == '\r') ? 1 : 2;
|
128
|
+
size_t needsize = tgt->size + copylen + extralen + 1;
|
133
129
|
|
134
130
|
if (tgt->asize < needsize && git_buf_grow(tgt, needsize) < 0)
|
135
131
|
return -1;
|
@@ -138,8 +134,8 @@ int git_buf_text_lf_to_crlf(git_buf *tgt, const git_buf *src)
|
|
138
134
|
memcpy(tgt->ptr + tgt->size, scan, copylen);
|
139
135
|
tgt->size += copylen;
|
140
136
|
}
|
141
|
-
|
142
|
-
|
137
|
+
if (extralen == 2)
|
138
|
+
tgt->ptr[tgt->size++] = '\r';
|
143
139
|
tgt->ptr[tgt->size++] = '\n';
|
144
140
|
}
|
145
141
|
|
@@ -56,10 +56,9 @@ GIT_INLINE(int) git_buf_text_puts_escape_regex(git_buf *buf, const char *string)
|
|
56
56
|
extern void git_buf_text_unescape(git_buf *buf);
|
57
57
|
|
58
58
|
/**
|
59
|
-
* Replace all \r\n with \n.
|
59
|
+
* Replace all \r\n with \n. Does not modify \r without trailing \n.
|
60
60
|
*
|
61
|
-
* @return 0 on success, -1 on memory error
|
62
|
-
* source buffer has mixed line endings.
|
61
|
+
* @return 0 on success, -1 on memory error
|
63
62
|
*/
|
64
63
|
extern int git_buf_text_crlf_to_lf(git_buf *tgt, const git_buf *src);
|
65
64
|
|
data/vendor/libgit2/src/buffer.c
CHANGED
@@ -7,7 +7,6 @@
|
|
7
7
|
#include "buffer.h"
|
8
8
|
#include "posix.h"
|
9
9
|
#include "git2/buffer.h"
|
10
|
-
#include "buf_text.h"
|
11
10
|
#include <ctype.h>
|
12
11
|
|
13
12
|
/* Used as default value for git_buf->ptr so that people can always
|
@@ -142,16 +141,6 @@ int git_buf_set(git_buf *buf, const void *data, size_t len)
|
|
142
141
|
return 0;
|
143
142
|
}
|
144
143
|
|
145
|
-
int git_buf_is_binary(const git_buf *buf)
|
146
|
-
{
|
147
|
-
return git_buf_text_is_binary(buf);
|
148
|
-
}
|
149
|
-
|
150
|
-
int git_buf_contains_nul(const git_buf *buf)
|
151
|
-
{
|
152
|
-
return git_buf_text_contains_nul(buf);
|
153
|
-
}
|
154
|
-
|
155
144
|
int git_buf_sets(git_buf *buf, const char *string)
|
156
145
|
{
|
157
146
|
return git_buf_set(buf, string, string ? strlen(string) : 0);
|
@@ -189,10 +178,10 @@ int git_buf_puts(git_buf *buf, const char *string)
|
|
189
178
|
return git_buf_put(buf, string, strlen(string));
|
190
179
|
}
|
191
180
|
|
192
|
-
static const char
|
181
|
+
static const char b64str[] =
|
193
182
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
194
183
|
|
195
|
-
int
|
184
|
+
int git_buf_put_base64(git_buf *buf, const char *data, size_t len)
|
196
185
|
{
|
197
186
|
size_t extra = len % 3;
|
198
187
|
uint8_t *write, a, b, c;
|
@@ -207,19 +196,19 @@ int git_buf_encode_base64(git_buf *buf, const char *data, size_t len)
|
|
207
196
|
b = *read++;
|
208
197
|
c = *read++;
|
209
198
|
|
210
|
-
*write++ =
|
211
|
-
*write++ =
|
212
|
-
*write++ =
|
213
|
-
*write++ =
|
199
|
+
*write++ = b64str[a >> 2];
|
200
|
+
*write++ = b64str[(a & 0x03) << 4 | b >> 4];
|
201
|
+
*write++ = b64str[(b & 0x0f) << 2 | c >> 6];
|
202
|
+
*write++ = b64str[c & 0x3f];
|
214
203
|
}
|
215
204
|
|
216
205
|
if (extra > 0) {
|
217
206
|
a = *read++;
|
218
207
|
b = (extra > 1) ? *read++ : 0;
|
219
208
|
|
220
|
-
*write++ =
|
221
|
-
*write++ =
|
222
|
-
*write++ = (extra > 1) ?
|
209
|
+
*write++ = b64str[a >> 2];
|
210
|
+
*write++ = b64str[(a & 0x03) << 4 | b >> 4];
|
211
|
+
*write++ = (extra > 1) ? b64str[(b & 0x0f) << 2] : '=';
|
223
212
|
*write++ = '=';
|
224
213
|
}
|
225
214
|
|
@@ -229,56 +218,10 @@ int git_buf_encode_base64(git_buf *buf, const char *data, size_t len)
|
|
229
218
|
return 0;
|
230
219
|
}
|
231
220
|
|
232
|
-
/* The inverse of base64_encode, offset by '+' == 43. */
|
233
|
-
static const int8_t base64_decode[] = {
|
234
|
-
62,
|
235
|
-
-1, -1, -1,
|
236
|
-
63,
|
237
|
-
52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
|
238
|
-
-1, -1, -1, 0, -1, -1, -1,
|
239
|
-
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
|
240
|
-
13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
|
241
|
-
-1, -1, -1, -1, -1, -1,
|
242
|
-
26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
|
243
|
-
39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51
|
244
|
-
};
|
245
|
-
|
246
|
-
#define BASE64_DECODE_VALUE(c) (((c) < 43 || (c) > 122) ? -1 : base64_decode[c - 43])
|
247
|
-
|
248
|
-
int git_buf_decode_base64(git_buf *buf, const char *base64, size_t len)
|
249
|
-
{
|
250
|
-
size_t i;
|
251
|
-
int8_t a, b, c, d;
|
252
|
-
size_t orig_size = buf->size;
|
253
|
-
|
254
|
-
assert(len % 4 == 0);
|
255
|
-
ENSURE_SIZE(buf, buf->size + (len / 4 * 3) + 1);
|
256
|
-
|
257
|
-
for (i = 0; i < len; i += 4) {
|
258
|
-
if ((a = BASE64_DECODE_VALUE(base64[i])) < 0 ||
|
259
|
-
(b = BASE64_DECODE_VALUE(base64[i+1])) < 0 ||
|
260
|
-
(c = BASE64_DECODE_VALUE(base64[i+2])) < 0 ||
|
261
|
-
(d = BASE64_DECODE_VALUE(base64[i+3])) < 0) {
|
262
|
-
buf->size = orig_size;
|
263
|
-
buf->ptr[buf->size] = '\0';
|
264
|
-
|
265
|
-
giterr_set(GITERR_INVALID, "Invalid base64 input");
|
266
|
-
return -1;
|
267
|
-
}
|
268
|
-
|
269
|
-
buf->ptr[buf->size++] = ((a << 2) | (b & 0x30) >> 4);
|
270
|
-
buf->ptr[buf->size++] = ((b & 0x0f) << 4) | ((c & 0x3c) >> 2);
|
271
|
-
buf->ptr[buf->size++] = (c & 0x03) << 6 | (d & 0x3f);
|
272
|
-
}
|
273
|
-
|
274
|
-
buf->ptr[buf->size] = '\0';
|
275
|
-
return 0;
|
276
|
-
}
|
277
|
-
|
278
221
|
static const char b85str[] =
|
279
222
|
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~";
|
280
223
|
|
281
|
-
int
|
224
|
+
int git_buf_put_base85(git_buf *buf, const char *data, size_t len)
|
282
225
|
{
|
283
226
|
ENSURE_SIZE(buf, buf->size + (5 * ((len / 4) + !!(len % 4))) + 1);
|
284
227
|
|
data/vendor/libgit2/src/buffer.h
CHANGED
@@ -156,12 +156,10 @@ void git_buf_rtrim(git_buf *buf);
|
|
156
156
|
int git_buf_cmp(const git_buf *a, const git_buf *b);
|
157
157
|
|
158
158
|
/* Write data as base64 encoded in buffer */
|
159
|
-
int
|
160
|
-
/* Decode the given bas64 and write the result to the buffer */
|
161
|
-
int git_buf_decode_base64(git_buf *buf, const char *base64, size_t len);
|
159
|
+
int git_buf_put_base64(git_buf *buf, const char *data, size_t len);
|
162
160
|
|
163
161
|
/* Write data as "base85" encoded in buffer */
|
164
|
-
int
|
162
|
+
int git_buf_put_base85(git_buf *buf, const char *data, size_t len);
|
165
163
|
|
166
164
|
/*
|
167
165
|
* Insert, remove or replace a portion of the buffer.
|
data/vendor/libgit2/src/cache.c
CHANGED
@@ -68,8 +68,8 @@ int git_cache_init(git_cache *cache)
|
|
68
68
|
{
|
69
69
|
memset(cache, 0, sizeof(*cache));
|
70
70
|
cache->map = git_oidmap_alloc();
|
71
|
-
if (
|
72
|
-
giterr_set(GITERR_OS, "Failed to initialize cache
|
71
|
+
if (git_mutex_init(&cache->lock)) {
|
72
|
+
giterr_set(GITERR_OS, "Failed to initialize cache mutex");
|
73
73
|
return -1;
|
74
74
|
}
|
75
75
|
return 0;
|
@@ -94,19 +94,19 @@ static void clear_cache(git_cache *cache)
|
|
94
94
|
|
95
95
|
void git_cache_clear(git_cache *cache)
|
96
96
|
{
|
97
|
-
if (
|
97
|
+
if (git_mutex_lock(&cache->lock) < 0)
|
98
98
|
return;
|
99
99
|
|
100
100
|
clear_cache(cache);
|
101
101
|
|
102
|
-
|
102
|
+
git_mutex_unlock(&cache->lock);
|
103
103
|
}
|
104
104
|
|
105
105
|
void git_cache_free(git_cache *cache)
|
106
106
|
{
|
107
107
|
git_cache_clear(cache);
|
108
108
|
git_oidmap_free(cache->map);
|
109
|
-
|
109
|
+
git_mutex_free(&cache->lock);
|
110
110
|
git__memzero(cache, sizeof(*cache));
|
111
111
|
}
|
112
112
|
|
@@ -152,7 +152,7 @@ static void *cache_get(git_cache *cache, const git_oid *oid, unsigned int flags)
|
|
152
152
|
khiter_t pos;
|
153
153
|
git_cached_obj *entry = NULL;
|
154
154
|
|
155
|
-
if (!git_cache__enabled ||
|
155
|
+
if (!git_cache__enabled || git_mutex_lock(&cache->lock) < 0)
|
156
156
|
return NULL;
|
157
157
|
|
158
158
|
pos = kh_get(oid, cache->map, oid);
|
@@ -166,7 +166,7 @@ static void *cache_get(git_cache *cache, const git_oid *oid, unsigned int flags)
|
|
166
166
|
}
|
167
167
|
}
|
168
168
|
|
169
|
-
|
169
|
+
git_mutex_unlock(&cache->lock);
|
170
170
|
|
171
171
|
return entry;
|
172
172
|
}
|
@@ -185,7 +185,7 @@ static void *cache_store(git_cache *cache, git_cached_obj *entry)
|
|
185
185
|
if (!cache_should_store(entry->type, entry->size))
|
186
186
|
return entry;
|
187
187
|
|
188
|
-
if (
|
188
|
+
if (git_mutex_lock(&cache->lock) < 0)
|
189
189
|
return entry;
|
190
190
|
|
191
191
|
/* soften the load on the cache */
|
@@ -227,7 +227,7 @@ static void *cache_store(git_cache *cache, git_cached_obj *entry)
|
|
227
227
|
}
|
228
228
|
}
|
229
229
|
|
230
|
-
|
230
|
+
git_mutex_unlock(&cache->lock);
|
231
231
|
return entry;
|
232
232
|
}
|
233
233
|
|
data/vendor/libgit2/src/cache.h
CHANGED
@@ -46,7 +46,6 @@ enum {
|
|
46
46
|
|
47
47
|
typedef struct {
|
48
48
|
git_repository *repo;
|
49
|
-
git_iterator *target;
|
50
49
|
git_diff *diff;
|
51
50
|
git_checkout_options opts;
|
52
51
|
bool opts_free_baseline;
|
@@ -55,8 +54,6 @@ typedef struct {
|
|
55
54
|
git_pool pool;
|
56
55
|
git_vector removes;
|
57
56
|
git_vector conflicts;
|
58
|
-
git_vector *reuc;
|
59
|
-
git_vector *names;
|
60
57
|
git_buf path;
|
61
58
|
size_t workdir_len;
|
62
59
|
git_buf tmp;
|
@@ -119,7 +116,6 @@ static int checkout_notify(
|
|
119
116
|
case GIT_DELTA_ADDED:
|
120
117
|
case GIT_DELTA_IGNORED:
|
121
118
|
case GIT_DELTA_UNTRACKED:
|
122
|
-
case GIT_DELTA_UNREADABLE:
|
123
119
|
target = &delta->new_file;
|
124
120
|
break;
|
125
121
|
case GIT_DELTA_DELETED:
|
@@ -142,7 +138,6 @@ static int checkout_notify(
|
|
142
138
|
static bool checkout_is_workdir_modified(
|
143
139
|
checkout_data *data,
|
144
140
|
const git_diff_file *baseitem,
|
145
|
-
const git_diff_file *newitem,
|
146
141
|
const git_index_entry *wditem)
|
147
142
|
{
|
148
143
|
git_oid oid;
|
@@ -174,16 +169,13 @@ static bool checkout_is_workdir_modified(
|
|
174
169
|
|
175
170
|
/* Look at the cache to decide if the workdir is modified. If not,
|
176
171
|
* we can simply compare the oid in the cache to the baseitem instead
|
177
|
-
* of hashing the file.
|
178
|
-
* oid is identical (ie, the staged item is what we're trying to check
|
179
|
-
* out.)
|
172
|
+
* of hashing the file.
|
180
173
|
*/
|
181
174
|
if ((ie = git_index_get_bypath(data->index, wditem->path, 0)) != NULL) {
|
182
175
|
if (wditem->mtime.seconds == ie->mtime.seconds &&
|
183
176
|
wditem->mtime.nanoseconds == ie->mtime.nanoseconds &&
|
184
177
|
wditem->file_size == ie->file_size)
|
185
|
-
return (git_oid__cmp(&baseitem->id, &ie->id) != 0
|
186
|
-
git_oid_cmp(&newitem->id, &ie->id) != 0);
|
178
|
+
return (git_oid__cmp(&baseitem->id, &ie->id) != 0);
|
187
179
|
}
|
188
180
|
|
189
181
|
/* depending on where base is coming from, we may or may not know
|
@@ -409,7 +401,7 @@ static int checkout_action_with_wd(
|
|
409
401
|
|
410
402
|
switch (delta->status) {
|
411
403
|
case GIT_DELTA_UNMODIFIED: /* case 14/15 or 33 */
|
412
|
-
if (checkout_is_workdir_modified(data, &delta->old_file,
|
404
|
+
if (checkout_is_workdir_modified(data, &delta->old_file, wd)) {
|
413
405
|
GITERR_CHECK_ERROR(
|
414
406
|
checkout_notify(data, GIT_CHECKOUT_NOTIFY_DIRTY, delta, wd) );
|
415
407
|
*action = CHECKOUT_ACTION_IF(FORCE, UPDATE_BLOB, NONE);
|
@@ -422,13 +414,13 @@ static int checkout_action_with_wd(
|
|
422
414
|
*action = CHECKOUT_ACTION_IF(FORCE, UPDATE_BLOB, CONFLICT);
|
423
415
|
break;
|
424
416
|
case GIT_DELTA_DELETED: /* case 9 or 10 (or 26 but not really) */
|
425
|
-
if (checkout_is_workdir_modified(data, &delta->old_file,
|
417
|
+
if (checkout_is_workdir_modified(data, &delta->old_file, wd))
|
426
418
|
*action = CHECKOUT_ACTION_IF(FORCE, REMOVE, CONFLICT);
|
427
419
|
else
|
428
420
|
*action = CHECKOUT_ACTION_IF(SAFE, REMOVE, NONE);
|
429
421
|
break;
|
430
422
|
case GIT_DELTA_MODIFIED: /* case 16, 17, 18 (or 36 but not really) */
|
431
|
-
if (checkout_is_workdir_modified(data, &delta->old_file,
|
423
|
+
if (checkout_is_workdir_modified(data, &delta->old_file, wd))
|
432
424
|
*action = CHECKOUT_ACTION_IF(FORCE, UPDATE_BLOB, CONFLICT);
|
433
425
|
else
|
434
426
|
*action = CHECKOUT_ACTION_IF(SAFE, UPDATE_BLOB, NONE);
|
@@ -451,7 +443,7 @@ static int checkout_action_with_wd(
|
|
451
443
|
} else
|
452
444
|
*action = CHECKOUT_ACTION_IF(FORCE, REMOVE, CONFLICT);
|
453
445
|
}
|
454
|
-
else if (checkout_is_workdir_modified(data, &delta->old_file,
|
446
|
+
else if (checkout_is_workdir_modified(data, &delta->old_file, wd))
|
455
447
|
*action = CHECKOUT_ACTION_IF(FORCE, REMOVE_AND_UPDATE, CONFLICT);
|
456
448
|
else
|
457
449
|
*action = CHECKOUT_ACTION_IF(SAFE, REMOVE_AND_UPDATE, NONE);
|
@@ -796,16 +788,11 @@ done:
|
|
796
788
|
static int checkout_conflicts_load(checkout_data *data, git_iterator *workdir, git_vector *pathspec)
|
797
789
|
{
|
798
790
|
git_index_conflict_iterator *iterator = NULL;
|
799
|
-
git_index *index;
|
800
791
|
const git_index_entry *ancestor, *ours, *theirs;
|
801
792
|
checkout_conflictdata *conflict;
|
802
793
|
int error = 0;
|
803
794
|
|
804
|
-
|
805
|
-
if ((index = git_iterator_get_index(data->target)) == NULL)
|
806
|
-
return 0;
|
807
|
-
|
808
|
-
if ((error = git_index_conflict_iterator_new(&iterator, index)) < 0)
|
795
|
+
if ((error = git_index_conflict_iterator_new(&iterator, data->index)) < 0)
|
809
796
|
goto done;
|
810
797
|
|
811
798
|
data->conflicts._cmp = checkout_conflictdata_cmp;
|
@@ -832,10 +819,6 @@ static int checkout_conflicts_load(checkout_data *data, git_iterator *workdir, g
|
|
832
819
|
git_vector_insert(&data->conflicts, conflict);
|
833
820
|
}
|
834
821
|
|
835
|
-
/* Collect the REUC and NAME entries */
|
836
|
-
data->reuc = &index->reuc;
|
837
|
-
data->names = &index->names;
|
838
|
-
|
839
822
|
if (error == GIT_ITEROVER)
|
840
823
|
error = 0;
|
841
824
|
|
@@ -974,20 +957,16 @@ done:
|
|
974
957
|
static int checkout_conflicts_coalesce_renames(
|
975
958
|
checkout_data *data)
|
976
959
|
{
|
977
|
-
git_index *index;
|
978
960
|
const git_index_name_entry *name_entry;
|
979
961
|
checkout_conflictdata *ancestor_conflict, *our_conflict, *their_conflict;
|
980
962
|
size_t i, names;
|
981
963
|
int error = 0;
|
982
964
|
|
983
|
-
if ((index = git_iterator_get_index(data->target)) == NULL)
|
984
|
-
return 0;
|
985
|
-
|
986
965
|
/* Juggle entries based on renames */
|
987
|
-
names = git_index_name_entrycount(index);
|
966
|
+
names = git_index_name_entrycount(data->index);
|
988
967
|
|
989
968
|
for (i = 0; i < names; i++) {
|
990
|
-
name_entry = git_index_name_get_byindex(index, i);
|
969
|
+
name_entry = git_index_name_get_byindex(data->index, i);
|
991
970
|
|
992
971
|
if ((error = checkout_conflicts_load_byname_entry(
|
993
972
|
&ancestor_conflict, &our_conflict, &their_conflict,
|
@@ -1031,17 +1010,13 @@ done:
|
|
1031
1010
|
static int checkout_conflicts_mark_directoryfile(
|
1032
1011
|
checkout_data *data)
|
1033
1012
|
{
|
1034
|
-
git_index *index;
|
1035
1013
|
checkout_conflictdata *conflict;
|
1036
1014
|
const git_index_entry *entry;
|
1037
1015
|
size_t i, j, len;
|
1038
1016
|
const char *path;
|
1039
1017
|
int prefixed, error = 0;
|
1040
1018
|
|
1041
|
-
|
1042
|
-
return 0;
|
1043
|
-
|
1044
|
-
len = git_index_entrycount(index);
|
1019
|
+
len = git_index_entrycount(data->index);
|
1045
1020
|
|
1046
1021
|
/* Find d/f conflicts */
|
1047
1022
|
git_vector_foreach(&data->conflicts, i, conflict) {
|
@@ -1052,7 +1027,7 @@ static int checkout_conflicts_mark_directoryfile(
|
|
1052
1027
|
path = conflict->ours ?
|
1053
1028
|
conflict->ours->path : conflict->theirs->path;
|
1054
1029
|
|
1055
|
-
if ((error = git_index_find(&j, index, path)) < 0) {
|
1030
|
+
if ((error = git_index_find(&j, data->index, path)) < 0) {
|
1056
1031
|
if (error == GIT_ENOTFOUND)
|
1057
1032
|
giterr_set(GITERR_INDEX,
|
1058
1033
|
"Index inconsistency, could not find entry for expected conflict '%s'", path);
|
@@ -1061,7 +1036,7 @@ static int checkout_conflicts_mark_directoryfile(
|
|
1061
1036
|
}
|
1062
1037
|
|
1063
1038
|
for (; j < len; j++) {
|
1064
|
-
if ((entry = git_index_get_byindex(index, j)) == NULL) {
|
1039
|
+
if ((entry = git_index_get_byindex(data->index, j)) == NULL) {
|
1065
1040
|
giterr_set(GITERR_INDEX,
|
1066
1041
|
"Index inconsistency, truncated index while loading expected conflict '%s'", path);
|
1067
1042
|
error = -1;
|
@@ -1761,10 +1736,12 @@ static int checkout_write_merge(
|
|
1761
1736
|
checkout_conflictdata *conflict)
|
1762
1737
|
{
|
1763
1738
|
git_buf our_label = GIT_BUF_INIT, their_label = GIT_BUF_INIT,
|
1764
|
-
path_suffixed = GIT_BUF_INIT, path_workdir = GIT_BUF_INIT
|
1739
|
+
path_suffixed = GIT_BUF_INIT, path_workdir = GIT_BUF_INIT,
|
1740
|
+
in_data = GIT_BUF_INIT, out_data = GIT_BUF_INIT;
|
1765
1741
|
git_merge_file_options opts = GIT_MERGE_FILE_OPTIONS_INIT;
|
1766
1742
|
git_merge_file_result result = {0};
|
1767
1743
|
git_filebuf output = GIT_FILEBUF_INIT;
|
1744
|
+
git_filter_list *fl = NULL;
|
1768
1745
|
int error = 0;
|
1769
1746
|
|
1770
1747
|
if (data->opts.checkout_strategy & GIT_CHECKOUT_CONFLICT_STYLE_DIFF3)
|
@@ -1810,13 +1787,29 @@ static int checkout_write_merge(
|
|
1810
1787
|
(error = checkout_safe_for_update_only(git_buf_cstr(&path_workdir), result.mode)) <= 0)
|
1811
1788
|
goto done;
|
1812
1789
|
|
1790
|
+
if (!data->opts.disable_filters) {
|
1791
|
+
in_data.ptr = (char *)result.ptr;
|
1792
|
+
in_data.size = result.len;
|
1793
|
+
|
1794
|
+
if ((error = git_filter_list_load(&fl, data->repo, NULL, git_buf_cstr(&path_workdir),
|
1795
|
+
GIT_FILTER_TO_WORKTREE, GIT_FILTER_OPT_DEFAULT)) < 0 ||
|
1796
|
+
(error = git_filter_list_apply_to_data(&out_data, fl, &in_data)) < 0)
|
1797
|
+
goto done;
|
1798
|
+
} else {
|
1799
|
+
out_data.ptr = (char *)result.ptr;
|
1800
|
+
out_data.size = result.len;
|
1801
|
+
}
|
1802
|
+
|
1813
1803
|
if ((error = git_futils_mkpath2file(path_workdir.ptr, 0755)) < 0 ||
|
1814
|
-
(error = git_filebuf_open(&output, path_workdir
|
1815
|
-
(error = git_filebuf_write(&output,
|
1804
|
+
(error = git_filebuf_open(&output, git_buf_cstr(&path_workdir), GIT_FILEBUF_DO_NOT_BUFFER, result.mode)) < 0 ||
|
1805
|
+
(error = git_filebuf_write(&output, out_data.ptr, out_data.size)) < 0 ||
|
1816
1806
|
(error = git_filebuf_commit(&output)) < 0)
|
1817
1807
|
goto done;
|
1818
1808
|
|
1819
1809
|
done:
|
1810
|
+
git_filter_list_free(fl);
|
1811
|
+
|
1812
|
+
git_buf_free(&out_data);
|
1820
1813
|
git_buf_free(&our_label);
|
1821
1814
|
git_buf_free(&their_label);
|
1822
1815
|
|
@@ -1827,24 +1820,6 @@ done:
|
|
1827
1820
|
return error;
|
1828
1821
|
}
|
1829
1822
|
|
1830
|
-
static int checkout_conflict_update_index(
|
1831
|
-
checkout_data *data,
|
1832
|
-
checkout_conflictdata *conflict)
|
1833
|
-
{
|
1834
|
-
int error = 0;
|
1835
|
-
|
1836
|
-
if (conflict->ancestor)
|
1837
|
-
error = git_index_add(data->index, conflict->ancestor);
|
1838
|
-
|
1839
|
-
if (!error && conflict->ours)
|
1840
|
-
error = git_index_add(data->index, conflict->ours);
|
1841
|
-
|
1842
|
-
if (!error && conflict->theirs)
|
1843
|
-
error = git_index_add(data->index, conflict->theirs);
|
1844
|
-
|
1845
|
-
return error;
|
1846
|
-
}
|
1847
|
-
|
1848
1823
|
static int checkout_create_conflicts(checkout_data *data)
|
1849
1824
|
{
|
1850
1825
|
checkout_conflictdata *conflict;
|
@@ -1907,12 +1882,6 @@ static int checkout_create_conflicts(checkout_data *data)
|
|
1907
1882
|
else if (!error)
|
1908
1883
|
error = checkout_write_merge(data, conflict);
|
1909
1884
|
|
1910
|
-
/* Update the index extensions (REUC and NAME) if we're checking
|
1911
|
-
* out a different index. (Otherwise just leave them there.)
|
1912
|
-
*/
|
1913
|
-
if (!error && (data->strategy & GIT_CHECKOUT_DONT_UPDATE_INDEX) == 0)
|
1914
|
-
error = checkout_conflict_update_index(data, conflict);
|
1915
|
-
|
1916
1885
|
if (error)
|
1917
1886
|
break;
|
1918
1887
|
|
@@ -1925,37 +1894,6 @@ static int checkout_create_conflicts(checkout_data *data)
|
|
1925
1894
|
return error;
|
1926
1895
|
}
|
1927
1896
|
|
1928
|
-
static int checkout_extensions_update_index(checkout_data *data)
|
1929
|
-
{
|
1930
|
-
const git_index_reuc_entry *reuc_entry;
|
1931
|
-
const git_index_name_entry *name_entry;
|
1932
|
-
size_t i;
|
1933
|
-
int error = 0;
|
1934
|
-
|
1935
|
-
if ((data->strategy & GIT_CHECKOUT_UPDATE_ONLY) != 0)
|
1936
|
-
return 0;
|
1937
|
-
|
1938
|
-
if (data->reuc) {
|
1939
|
-
git_vector_foreach(data->reuc, i, reuc_entry) {
|
1940
|
-
if ((error = git_index_reuc_add(data->index, reuc_entry->path,
|
1941
|
-
reuc_entry->mode[0], &reuc_entry->oid[0],
|
1942
|
-
reuc_entry->mode[1], &reuc_entry->oid[1],
|
1943
|
-
reuc_entry->mode[2], &reuc_entry->oid[2])) < 0)
|
1944
|
-
goto done;
|
1945
|
-
}
|
1946
|
-
}
|
1947
|
-
|
1948
|
-
if (data->names) {
|
1949
|
-
git_vector_foreach(data->names, i, name_entry) {
|
1950
|
-
if ((error = git_index_name_add(data->index, name_entry->ancestor,
|
1951
|
-
name_entry->ours, name_entry->theirs)) < 0)
|
1952
|
-
goto done;
|
1953
|
-
}
|
1954
|
-
}
|
1955
|
-
|
1956
|
-
done:
|
1957
|
-
return error;
|
1958
|
-
}
|
1959
1897
|
|
1960
1898
|
static void checkout_data_clear(checkout_data *data)
|
1961
1899
|
{
|
@@ -1999,7 +1937,6 @@ static int checkout_data_init(
|
|
1999
1937
|
return error;
|
2000
1938
|
|
2001
1939
|
data->repo = repo;
|
2002
|
-
data->target = target;
|
2003
1940
|
|
2004
1941
|
GITERR_CHECK_VERSION(
|
2005
1942
|
proposed, GIT_CHECKOUT_OPTIONS_VERSION, "git_checkout_options");
|
@@ -2024,15 +1961,15 @@ static int checkout_data_init(
|
|
2024
1961
|
(error = git_config_refresh(cfg)) < 0)
|
2025
1962
|
goto cleanup;
|
2026
1963
|
|
2027
|
-
/*
|
2028
|
-
*
|
2029
|
-
* out and those should not be overwritten.)
|
1964
|
+
/* if we are checking out the index, don't reload,
|
1965
|
+
* otherwise get index and force reload
|
2030
1966
|
*/
|
2031
|
-
if ((
|
2032
|
-
|
2033
|
-
|
2034
|
-
|
2035
|
-
if ((error =
|
1967
|
+
if ((data->index = git_iterator_get_index(target)) != NULL) {
|
1968
|
+
GIT_REFCOUNT_INC(data->index);
|
1969
|
+
} else {
|
1970
|
+
/* otherwise, grab and reload the index */
|
1971
|
+
if ((error = git_repository_index(&data->index, data->repo)) < 0 ||
|
1972
|
+
(error = git_index_read(data->index, true)) < 0)
|
2036
1973
|
goto cleanup;
|
2037
1974
|
|
2038
1975
|
/* cannot checkout if unresolved conflicts exist */
|
@@ -2044,7 +1981,7 @@ static int checkout_data_init(
|
|
2044
1981
|
goto cleanup;
|
2045
1982
|
}
|
2046
1983
|
|
2047
|
-
/* clean conflict data
|
1984
|
+
/* clean conflict data when doing a tree or commit checkout */
|
2048
1985
|
git_index_name_clear(data->index);
|
2049
1986
|
git_index_reuc_clear(data->index);
|
2050
1987
|
}
|
@@ -2144,7 +2081,6 @@ int git_checkout_iterator(
|
|
2144
2081
|
|
2145
2082
|
diff_opts.flags =
|
2146
2083
|
GIT_DIFF_INCLUDE_UNMODIFIED |
|
2147
|
-
GIT_DIFF_INCLUDE_UNREADABLE |
|
2148
2084
|
GIT_DIFF_INCLUDE_UNTRACKED |
|
2149
2085
|
GIT_DIFF_RECURSE_UNTRACKED_DIRS | /* needed to match baseline */
|
2150
2086
|
GIT_DIFF_INCLUDE_IGNORED |
|
@@ -2214,10 +2150,6 @@ int git_checkout_iterator(
|
|
2214
2150
|
(error = checkout_create_conflicts(&data)) < 0)
|
2215
2151
|
goto cleanup;
|
2216
2152
|
|
2217
|
-
if (data.index != git_iterator_get_index(target) &&
|
2218
|
-
(error = checkout_extensions_update_index(&data)) < 0)
|
2219
|
-
goto cleanup;
|
2220
|
-
|
2221
2153
|
assert(data.completed_steps == data.total_steps);
|
2222
2154
|
|
2223
2155
|
cleanup:
|
@@ -2240,7 +2172,7 @@ int git_checkout_index(
|
|
2240
2172
|
git_index *index,
|
2241
2173
|
const git_checkout_options *opts)
|
2242
2174
|
{
|
2243
|
-
int error
|
2175
|
+
int error;
|
2244
2176
|
git_iterator *index_i;
|
2245
2177
|
|
2246
2178
|
if (!index && !repo) {
|
@@ -2248,16 +2180,10 @@ int git_checkout_index(
|
|
2248
2180
|
"Must provide either repository or index to checkout");
|
2249
2181
|
return -1;
|
2250
2182
|
}
|
2251
|
-
|
2252
|
-
if (index && repo &&
|
2253
|
-
git_index_owner(index) &&
|
2254
|
-
git_index_owner(index) != repo) {
|
2183
|
+
if (index && repo && git_index_owner(index) != repo) {
|
2255
2184
|
giterr_set(GITERR_CHECKOUT,
|
2256
2185
|
"Index to checkout does not match repository");
|
2257
2186
|
return -1;
|
2258
|
-
} else if(index && repo && !git_index_owner(index)) {
|
2259
|
-
GIT_REFCOUNT_OWN(index, repo);
|
2260
|
-
owned = 1;
|
2261
2187
|
}
|
2262
2188
|
|
2263
2189
|
if (!repo)
|
@@ -2270,9 +2196,6 @@ int git_checkout_index(
|
|
2270
2196
|
if (!(error = git_iterator_for_index(&index_i, index, 0, NULL, NULL)))
|
2271
2197
|
error = git_checkout_iterator(index_i, opts);
|
2272
2198
|
|
2273
|
-
if (owned)
|
2274
|
-
GIT_REFCOUNT_OWN(index, NULL);
|
2275
|
-
|
2276
2199
|
git_iterator_free(index_i);
|
2277
2200
|
git_index_free(index);
|
2278
2201
|
|