rugged 0.23.0b2 → 0.23.0b4
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_blob.c +39 -0
- data/ext/rugged/rugged_diff.c +7 -3
- data/ext/rugged/rugged_index.c +2 -2
- data/ext/rugged/rugged_remote.c +27 -148
- data/ext/rugged/rugged_remote_collection.c +134 -12
- data/ext/rugged/rugged_repo.c +74 -5
- data/ext/rugged/rugged_submodule.c +18 -208
- data/ext/rugged/rugged_submodule_collection.c +148 -0
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/AUTHORS +1 -0
- data/vendor/libgit2/CMakeLists.txt +33 -25
- data/vendor/libgit2/deps/winhttp/winhttp.def +29 -29
- data/vendor/libgit2/include/git2.h +1 -1
- data/vendor/libgit2/include/git2/blob.h +4 -6
- data/vendor/libgit2/include/git2/checkout.h +10 -1
- data/vendor/libgit2/include/git2/clone.h +6 -7
- data/vendor/libgit2/include/git2/commit.h +11 -0
- data/vendor/libgit2/include/git2/cred_helpers.h +2 -2
- data/vendor/libgit2/include/git2/describe.h +1 -1
- data/vendor/libgit2/include/git2/diff.h +68 -11
- data/vendor/libgit2/include/git2/errors.h +4 -1
- data/vendor/libgit2/include/git2/filter.h +16 -0
- data/vendor/libgit2/include/git2/index.h +38 -11
- data/vendor/libgit2/include/git2/odb.h +1 -1
- data/vendor/libgit2/include/git2/odb_backend.h +2 -2
- data/vendor/libgit2/include/git2/remote.h +300 -207
- data/vendor/libgit2/include/git2/reset.h +1 -0
- data/vendor/libgit2/include/git2/stash.h +135 -4
- data/vendor/libgit2/include/git2/status.h +1 -0
- data/vendor/libgit2/include/git2/submodule.h +46 -75
- data/vendor/libgit2/include/git2/sys/odb_backend.h +1 -1
- data/vendor/libgit2/include/git2/sys/stream.h +2 -0
- data/vendor/libgit2/include/git2/sys/transport.h +1 -21
- data/vendor/libgit2/include/git2/transport.h +27 -0
- data/vendor/libgit2/include/git2/types.h +20 -10
- data/vendor/libgit2/include/git2/version.h +3 -3
- data/vendor/libgit2/libgit2.pc.in +4 -2
- data/vendor/libgit2/src/attr.c +2 -1
- data/vendor/libgit2/src/attr_file.c +18 -37
- data/vendor/libgit2/src/blame.c +2 -2
- data/vendor/libgit2/src/blob.c +4 -3
- data/vendor/libgit2/src/branch.c +6 -3
- data/vendor/libgit2/src/buf_text.c +4 -6
- data/vendor/libgit2/src/buf_text.h +1 -2
- data/vendor/libgit2/src/buffer.c +8 -6
- data/vendor/libgit2/src/buffer.h +1 -1
- data/vendor/libgit2/src/cache.c +1 -0
- data/vendor/libgit2/src/checkout.c +34 -20
- data/vendor/libgit2/src/clone.c +29 -29
- data/vendor/libgit2/src/commit.c +65 -0
- data/vendor/libgit2/src/common.h +5 -0
- data/vendor/libgit2/src/config.c +20 -0
- data/vendor/libgit2/src/config.h +6 -0
- data/vendor/libgit2/src/config_file.c +2 -2
- data/vendor/libgit2/src/crlf.c +39 -17
- data/vendor/libgit2/src/curl_stream.c +257 -0
- data/vendor/libgit2/src/curl_stream.h +14 -0
- data/vendor/libgit2/src/diff.c +223 -88
- data/vendor/libgit2/src/diff.h +21 -1
- data/vendor/libgit2/src/diff_file.c +23 -13
- data/vendor/libgit2/src/diff_file.h +4 -2
- data/vendor/libgit2/src/diff_patch.c +266 -71
- data/vendor/libgit2/src/diff_patch.h +36 -0
- data/vendor/libgit2/src/diff_print.c +156 -126
- data/vendor/libgit2/src/diff_tform.c +32 -54
- data/vendor/libgit2/src/fetch.c +27 -10
- data/vendor/libgit2/src/fetch.h +2 -2
- data/vendor/libgit2/src/filebuf.c +1 -1
- data/vendor/libgit2/src/fileops.c +6 -2
- data/vendor/libgit2/src/filter.c +28 -7
- data/vendor/libgit2/src/fnmatch.c +5 -5
- data/vendor/libgit2/src/global.c +16 -0
- data/vendor/libgit2/src/ident.c +2 -2
- data/vendor/libgit2/src/ignore.c +1 -0
- data/vendor/libgit2/src/index.c +338 -80
- data/vendor/libgit2/src/index.h +4 -1
- data/vendor/libgit2/src/indexer.c +19 -5
- data/vendor/libgit2/src/iterator.c +118 -11
- data/vendor/libgit2/src/iterator.h +25 -0
- data/vendor/libgit2/src/merge.c +96 -106
- data/vendor/libgit2/src/merge.h +14 -4
- data/vendor/libgit2/src/netops.c +3 -3
- data/vendor/libgit2/src/odb.c +17 -9
- data/vendor/libgit2/src/odb.h +1 -1
- data/vendor/libgit2/src/odb_loose.c +2 -2
- data/vendor/libgit2/src/odb_pack.c +1 -1
- data/vendor/libgit2/src/openssl_stream.c +118 -27
- data/vendor/libgit2/src/pack-objects.c +28 -0
- data/vendor/libgit2/src/pack-objects.h +1 -0
- data/vendor/libgit2/src/pack.c +18 -10
- data/vendor/libgit2/src/path.c +16 -11
- data/vendor/libgit2/src/path.h +1 -1
- data/vendor/libgit2/src/push.c +26 -42
- data/vendor/libgit2/src/push.h +2 -34
- data/vendor/libgit2/src/rebase.c +1 -1
- data/vendor/libgit2/src/refs.c +1 -1
- data/vendor/libgit2/src/refspec.c +6 -0
- data/vendor/libgit2/src/remote.c +381 -274
- data/vendor/libgit2/src/remote.h +0 -4
- data/vendor/libgit2/src/repository.c +33 -12
- data/vendor/libgit2/src/repository.h +0 -1
- data/vendor/libgit2/src/reset.c +1 -0
- data/vendor/libgit2/src/stash.c +439 -17
- data/vendor/libgit2/src/status.c +6 -0
- data/vendor/libgit2/src/stransport_stream.c +58 -21
- data/vendor/libgit2/src/stream.h +15 -0
- data/vendor/libgit2/src/submodule.c +410 -664
- data/vendor/libgit2/src/submodule.h +0 -24
- data/vendor/libgit2/src/transaction.c +1 -0
- data/vendor/libgit2/src/transports/cred.c +55 -1
- data/vendor/libgit2/src/transports/http.c +18 -2
- data/vendor/libgit2/src/transports/local.c +60 -59
- data/vendor/libgit2/src/transports/smart.h +1 -1
- data/vendor/libgit2/src/transports/smart_protocol.c +11 -11
- data/vendor/libgit2/src/transports/ssh.c +46 -7
- data/vendor/libgit2/src/unix/posix.h +4 -0
- data/vendor/libgit2/src/util.c +9 -9
- data/vendor/libgit2/src/util.h +9 -0
- data/vendor/libgit2/src/win32/posix.h +3 -0
- data/vendor/libgit2/src/win32/posix_w32.c +38 -0
- data/vendor/libgit2/src/win32/w32_util.h +10 -0
- metadata +4 -3
- data/vendor/libgit2/include/git2/push.h +0 -94
|
@@ -20,6 +20,9 @@
|
|
|
20
20
|
*/
|
|
21
21
|
GIT_BEGIN_DECL
|
|
22
22
|
|
|
23
|
+
/** Signature of a function which creates a transport */
|
|
24
|
+
typedef int (*git_transport_cb)(git_transport **out, git_remote *owner, void *param);
|
|
25
|
+
|
|
23
26
|
/**
|
|
24
27
|
* Type of SSH host fingerprint
|
|
25
28
|
*/
|
|
@@ -105,6 +108,13 @@ typedef enum {
|
|
|
105
108
|
* it will ask via this credential type.
|
|
106
109
|
*/
|
|
107
110
|
GIT_CREDTYPE_USERNAME = (1u << 5),
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Credentials read from memory.
|
|
114
|
+
*
|
|
115
|
+
* Only available for libssh2+OpenSSL for now.
|
|
116
|
+
*/
|
|
117
|
+
GIT_CREDTYPE_SSH_MEMORY = (1u << 6),
|
|
108
118
|
} git_credtype_t;
|
|
109
119
|
|
|
110
120
|
/* The base structure for all credential types */
|
|
@@ -287,6 +297,23 @@ GIT_EXTERN(int) git_cred_default_new(git_cred **out);
|
|
|
287
297
|
*/
|
|
288
298
|
GIT_EXTERN(int) git_cred_username_new(git_cred **cred, const char *username);
|
|
289
299
|
|
|
300
|
+
/**
|
|
301
|
+
* Create a new ssh key credential object reading the keys from memory.
|
|
302
|
+
*
|
|
303
|
+
* @param out The newly created credential object.
|
|
304
|
+
* @param username username to use to authenticate.
|
|
305
|
+
* @param publickey The public key of the credential.
|
|
306
|
+
* @param privatekey The private key of the credential.
|
|
307
|
+
* @param passphrase The passphrase of the credential.
|
|
308
|
+
* @return 0 for success or an error code for failure
|
|
309
|
+
*/
|
|
310
|
+
GIT_EXTERN(int) git_cred_ssh_key_memory_new(
|
|
311
|
+
git_cred **out,
|
|
312
|
+
const char *username,
|
|
313
|
+
const char *publickey,
|
|
314
|
+
const char *privatekey,
|
|
315
|
+
const char *passphrase);
|
|
316
|
+
|
|
290
317
|
/**
|
|
291
318
|
* Signature of a function which acquires a credential object.
|
|
292
319
|
*
|
|
@@ -223,6 +223,12 @@ typedef struct git_refspec git_refspec;
|
|
|
223
223
|
*/
|
|
224
224
|
typedef struct git_remote git_remote;
|
|
225
225
|
|
|
226
|
+
/**
|
|
227
|
+
* Interface which represents a transport to communicate with a
|
|
228
|
+
* remote.
|
|
229
|
+
*/
|
|
230
|
+
typedef struct git_transport git_transport;
|
|
231
|
+
|
|
226
232
|
/**
|
|
227
233
|
* Preparation for a push operation. Can be used to configure what to
|
|
228
234
|
* push and the level of parallelism of the packfile builder.
|
|
@@ -278,6 +284,11 @@ typedef int (*git_transport_message_cb)(const char *str, int len, void *payload)
|
|
|
278
284
|
* Type of host certificate structure that is passed to the check callback
|
|
279
285
|
*/
|
|
280
286
|
typedef enum git_cert_t {
|
|
287
|
+
/**
|
|
288
|
+
* No information about the certificate is available. This may
|
|
289
|
+
* happen when using curl.
|
|
290
|
+
*/
|
|
291
|
+
GIT_CERT_NONE,
|
|
281
292
|
/**
|
|
282
293
|
* The `data` argument to the callback will be a pointer to
|
|
283
294
|
* the DER-encoded data.
|
|
@@ -288,6 +299,13 @@ typedef enum git_cert_t {
|
|
|
288
299
|
* `git_cert_hostkey` structure.
|
|
289
300
|
*/
|
|
290
301
|
GIT_CERT_HOSTKEY_LIBSSH2,
|
|
302
|
+
/**
|
|
303
|
+
* The `data` argument to the callback will be a pointer to a
|
|
304
|
+
* `git_strarray` with `name:content` strings containing
|
|
305
|
+
* information about the certificate. This is used when using
|
|
306
|
+
* curl.
|
|
307
|
+
*/
|
|
308
|
+
GIT_CERT_STRARRAY,
|
|
291
309
|
} git_cert_t;
|
|
292
310
|
|
|
293
311
|
/**
|
|
@@ -331,7 +349,6 @@ typedef struct git_submodule git_submodule;
|
|
|
331
349
|
*
|
|
332
350
|
* The values are:
|
|
333
351
|
*
|
|
334
|
-
* - GIT_SUBMODULE_UPDATE_RESET: reset to the on-disk value.
|
|
335
352
|
* - GIT_SUBMODULE_UPDATE_CHECKOUT: the default; when a submodule is
|
|
336
353
|
* updated, checkout the new detached HEAD to the submodule directory.
|
|
337
354
|
* - GIT_SUBMODULE_UPDATE_REBASE: update by rebasing the current checked
|
|
@@ -344,8 +361,6 @@ typedef struct git_submodule git_submodule;
|
|
|
344
361
|
* when we don't want any particular update rule to be specified.
|
|
345
362
|
*/
|
|
346
363
|
typedef enum {
|
|
347
|
-
GIT_SUBMODULE_UPDATE_RESET = -1,
|
|
348
|
-
|
|
349
364
|
GIT_SUBMODULE_UPDATE_CHECKOUT = 1,
|
|
350
365
|
GIT_SUBMODULE_UPDATE_REBASE = 2,
|
|
351
366
|
GIT_SUBMODULE_UPDATE_MERGE = 3,
|
|
@@ -368,7 +383,7 @@ typedef enum {
|
|
|
368
383
|
*
|
|
369
384
|
* The values are:
|
|
370
385
|
*
|
|
371
|
-
* -
|
|
386
|
+
* - GIT_SUBMODULE_IGNORE_UNSPECIFIED: use the submodule's configuration
|
|
372
387
|
* - GIT_SUBMODULE_IGNORE_NONE: don't ignore any change - i.e. even an
|
|
373
388
|
* untracked file, will mark the submodule as dirty. Ignored files are
|
|
374
389
|
* still ignored, of course.
|
|
@@ -382,14 +397,12 @@ typedef enum {
|
|
|
382
397
|
* when we don't want any particular ignore rule to be specified.
|
|
383
398
|
*/
|
|
384
399
|
typedef enum {
|
|
385
|
-
|
|
400
|
+
GIT_SUBMODULE_IGNORE_UNSPECIFIED = -1, /**< use the submodule's configuration */
|
|
386
401
|
|
|
387
402
|
GIT_SUBMODULE_IGNORE_NONE = 1, /**< any change or untracked == dirty */
|
|
388
403
|
GIT_SUBMODULE_IGNORE_UNTRACKED = 2, /**< dirty if tracked files change */
|
|
389
404
|
GIT_SUBMODULE_IGNORE_DIRTY = 3, /**< only dirty if HEAD moved */
|
|
390
405
|
GIT_SUBMODULE_IGNORE_ALL = 4, /**< never dirty */
|
|
391
|
-
|
|
392
|
-
GIT_SUBMODULE_IGNORE_DEFAULT = 0
|
|
393
406
|
} git_submodule_ignore_t;
|
|
394
407
|
|
|
395
408
|
/**
|
|
@@ -397,15 +410,12 @@ typedef enum {
|
|
|
397
410
|
*
|
|
398
411
|
* Represent the value of `submodule.$name.fetchRecurseSubmodules`
|
|
399
412
|
*
|
|
400
|
-
* * GIT_SUBMODULE_RECURSE_RESET - reset to the on-disk value
|
|
401
413
|
* * GIT_SUBMODULE_RECURSE_NO - do no recurse into submodules
|
|
402
414
|
* * GIT_SUBMODULE_RECURSE_YES - recurse into submodules
|
|
403
415
|
* * GIT_SUBMODULE_RECURSE_ONDEMAND - recurse into submodules only when
|
|
404
416
|
* commit not already in local clone
|
|
405
417
|
*/
|
|
406
418
|
typedef enum {
|
|
407
|
-
GIT_SUBMODULE_RECURSE_RESET = -1,
|
|
408
|
-
|
|
409
419
|
GIT_SUBMODULE_RECURSE_NO = 0,
|
|
410
420
|
GIT_SUBMODULE_RECURSE_YES = 1,
|
|
411
421
|
GIT_SUBMODULE_RECURSE_ONDEMAND = 2,
|
|
@@ -7,12 +7,12 @@
|
|
|
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.23.0"
|
|
11
11
|
#define LIBGIT2_VER_MAJOR 0
|
|
12
|
-
#define LIBGIT2_VER_MINOR
|
|
12
|
+
#define LIBGIT2_VER_MINOR 23
|
|
13
13
|
#define LIBGIT2_VER_REVISION 0
|
|
14
14
|
#define LIBGIT2_VER_PATCH 0
|
|
15
15
|
|
|
16
|
-
#define LIBGIT2_SOVERSION
|
|
16
|
+
#define LIBGIT2_SOVERSION 23
|
|
17
17
|
|
|
18
18
|
#endif
|
|
@@ -4,7 +4,9 @@ includedir=@CMAKE_INSTALL_PREFIX@/@INCLUDE_INSTALL_DIR@
|
|
|
4
4
|
Name: libgit2
|
|
5
5
|
Description: The git library, take 2
|
|
6
6
|
Version: @LIBGIT2_VERSION_STRING@
|
|
7
|
-
|
|
8
|
-
Libs.private: @LIBGIT2_PC_LIBS@
|
|
7
|
+
|
|
9
8
|
Libs: -L${libdir} -lgit2
|
|
9
|
+
Libs.private: @LIBGIT2_PC_LIBS@
|
|
10
|
+
Requires.private: @LIBGIT2_PC_REQUIRES@
|
|
11
|
+
|
|
10
12
|
Cflags: -I${includedir}
|
data/vendor/libgit2/src/attr.c
CHANGED
|
@@ -309,7 +309,8 @@ static int attr_setup(git_repository *repo, git_attr_session *attr_session)
|
|
|
309
309
|
if (error == 0)
|
|
310
310
|
error = preload_attr_file(
|
|
311
311
|
repo, attr_session, GIT_ATTR_FILE__FROM_FILE, NULL, sys.ptr);
|
|
312
|
-
|
|
312
|
+
|
|
313
|
+
if (error != GIT_ENOTFOUND)
|
|
313
314
|
return error;
|
|
314
315
|
|
|
315
316
|
git_buf_free(&sys);
|
|
@@ -359,6 +359,7 @@ bool git_attr_fnmatch__match(
|
|
|
359
359
|
git_attr_fnmatch *match,
|
|
360
360
|
git_attr_path *path)
|
|
361
361
|
{
|
|
362
|
+
const char *relpath = path->path;
|
|
362
363
|
const char *filename;
|
|
363
364
|
int flags = 0;
|
|
364
365
|
|
|
@@ -375,6 +376,8 @@ bool git_attr_fnmatch__match(
|
|
|
375
376
|
if (git__prefixcmp(path->path, match->containing_dir))
|
|
376
377
|
return 0;
|
|
377
378
|
}
|
|
379
|
+
|
|
380
|
+
relpath += match->containing_dir_length;
|
|
378
381
|
}
|
|
379
382
|
|
|
380
383
|
if (match->flags & GIT_ATTR_FNMATCH_ICASE)
|
|
@@ -383,7 +386,7 @@ bool git_attr_fnmatch__match(
|
|
|
383
386
|
flags |= FNM_LEADING_DIR;
|
|
384
387
|
|
|
385
388
|
if (match->flags & GIT_ATTR_FNMATCH_FULLPATH) {
|
|
386
|
-
filename =
|
|
389
|
+
filename = relpath;
|
|
387
390
|
flags |= FNM_PATHNAME;
|
|
388
391
|
} else {
|
|
389
392
|
filename = path->basename;
|
|
@@ -393,35 +396,33 @@ bool git_attr_fnmatch__match(
|
|
|
393
396
|
}
|
|
394
397
|
|
|
395
398
|
if ((match->flags & GIT_ATTR_FNMATCH_DIRECTORY) && !path->is_dir) {
|
|
396
|
-
|
|
397
|
-
char *matchpath;
|
|
399
|
+
bool samename;
|
|
398
400
|
|
|
399
401
|
/* for attribute checks or root ignore checks, fail match */
|
|
400
402
|
if (!(match->flags & GIT_ATTR_FNMATCH_IGNORE) ||
|
|
401
403
|
path->basename == path->path)
|
|
402
404
|
return false;
|
|
403
405
|
|
|
404
|
-
/* for ignore checks, use container of current item for check */
|
|
405
|
-
path->basename[-1] = '\0';
|
|
406
406
|
flags |= FNM_LEADING_DIR;
|
|
407
407
|
|
|
408
|
-
if
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
408
|
+
/* fail match if this is a file with same name as ignored folder */
|
|
409
|
+
samename = (match->flags & GIT_ATTR_FNMATCH_ICASE) ?
|
|
410
|
+
!strcasecmp(match->pattern, relpath) :
|
|
411
|
+
!strcmp(match->pattern, relpath);
|
|
412
412
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
413
|
+
if (samename)
|
|
414
|
+
return false;
|
|
415
|
+
|
|
416
|
+
return (p_fnmatch(match->pattern, relpath, flags) != FNM_NOMATCH);
|
|
416
417
|
}
|
|
417
418
|
|
|
418
419
|
/* if path is a directory prefix of a negated pattern, then match */
|
|
419
420
|
if ((match->flags & GIT_ATTR_FNMATCH_NEGATIVE) && path->is_dir) {
|
|
420
|
-
size_t pathlen = strlen(
|
|
421
|
+
size_t pathlen = strlen(relpath);
|
|
421
422
|
bool prefixed = (pathlen <= match->length) &&
|
|
422
423
|
((match->flags & GIT_ATTR_FNMATCH_ICASE) ?
|
|
423
|
-
|
|
424
|
-
|
|
424
|
+
!strncasecmp(match->pattern, relpath, pathlen) :
|
|
425
|
+
!strncmp(match->pattern, relpath, pathlen));
|
|
425
426
|
|
|
426
427
|
if (prefixed && git_path_at_end_of_segment(&match->pattern[pathlen]))
|
|
427
428
|
return true;
|
|
@@ -640,7 +641,7 @@ int git_attr_fnmatch__parse(
|
|
|
640
641
|
}
|
|
641
642
|
|
|
642
643
|
if (context) {
|
|
643
|
-
char *slash =
|
|
644
|
+
char *slash = strrchr(context, '/');
|
|
644
645
|
size_t len;
|
|
645
646
|
if (slash) {
|
|
646
647
|
/* include the slash for easier matching */
|
|
@@ -650,27 +651,7 @@ int git_attr_fnmatch__parse(
|
|
|
650
651
|
}
|
|
651
652
|
}
|
|
652
653
|
|
|
653
|
-
|
|
654
|
-
context != NULL && git_path_root(pattern) < 0)
|
|
655
|
-
{
|
|
656
|
-
/* use context path minus the trailing filename */
|
|
657
|
-
char *slash = strrchr(context, '/');
|
|
658
|
-
size_t contextlen = slash ? slash - context + 1 : 0;
|
|
659
|
-
|
|
660
|
-
/* given an unrooted fullpath match from a file inside a repo,
|
|
661
|
-
* prefix the pattern with the relative directory of the source file
|
|
662
|
-
*/
|
|
663
|
-
spec->pattern = git_pool_malloc(
|
|
664
|
-
pool, (uint32_t)(contextlen + spec->length + 1));
|
|
665
|
-
if (spec->pattern) {
|
|
666
|
-
memcpy(spec->pattern, context, contextlen);
|
|
667
|
-
memcpy(spec->pattern + contextlen, pattern, spec->length);
|
|
668
|
-
spec->length += contextlen;
|
|
669
|
-
spec->pattern[spec->length] = '\0';
|
|
670
|
-
}
|
|
671
|
-
} else {
|
|
672
|
-
spec->pattern = git_pool_strndup(pool, pattern, spec->length);
|
|
673
|
-
}
|
|
654
|
+
spec->pattern = git_pool_strndup(pool, pattern, spec->length);
|
|
674
655
|
|
|
675
656
|
if (!spec->pattern) {
|
|
676
657
|
*base = git__next_line(pattern);
|
data/vendor/libgit2/src/blame.c
CHANGED
|
@@ -496,8 +496,8 @@ int git_blame_buffer(
|
|
|
496
496
|
|
|
497
497
|
/* Diff to the reference blob */
|
|
498
498
|
git_diff_blob_to_buffer(reference->final_blob, blame->path,
|
|
499
|
-
|
|
500
|
-
|
|
499
|
+
buffer, buffer_len, blame->path, &diffopts,
|
|
500
|
+
NULL, NULL, buffer_hunk_cb, buffer_line_cb, blame);
|
|
501
501
|
|
|
502
502
|
*out = blame;
|
|
503
503
|
return 0;
|
data/vendor/libgit2/src/blob.c
CHANGED
|
@@ -74,12 +74,13 @@ static int write_file_stream(
|
|
|
74
74
|
git_oid *id, git_odb *odb, const char *path, git_off_t file_size)
|
|
75
75
|
{
|
|
76
76
|
int fd, error;
|
|
77
|
-
char buffer[
|
|
77
|
+
char buffer[FILEIO_BUFSIZE];
|
|
78
78
|
git_odb_stream *stream = NULL;
|
|
79
|
-
ssize_t read_len = -1
|
|
79
|
+
ssize_t read_len = -1;
|
|
80
|
+
git_off_t written = 0;
|
|
80
81
|
|
|
81
82
|
if ((error = git_odb_open_wstream(
|
|
82
|
-
&stream, odb,
|
|
83
|
+
&stream, odb, file_size, GIT_OBJ_BLOB)) < 0)
|
|
83
84
|
return error;
|
|
84
85
|
|
|
85
86
|
if ((fd = git_futils_open_ro(path)) < 0) {
|
data/vendor/libgit2/src/branch.c
CHANGED
|
@@ -551,7 +551,7 @@ int git_branch_set_upstream(git_reference *branch, const char *upstream_name)
|
|
|
551
551
|
git_remote *remote = NULL;
|
|
552
552
|
git_config *config;
|
|
553
553
|
const char *name, *shortname;
|
|
554
|
-
int local;
|
|
554
|
+
int local, error;
|
|
555
555
|
const git_refspec *fetchspec;
|
|
556
556
|
|
|
557
557
|
name = git_reference_name(branch);
|
|
@@ -586,9 +586,12 @@ int git_branch_set_upstream(git_reference *branch, const char *upstream_name)
|
|
|
586
586
|
* that.
|
|
587
587
|
*/
|
|
588
588
|
if (local)
|
|
589
|
-
git_buf_puts(&value, ".");
|
|
589
|
+
error = git_buf_puts(&value, ".");
|
|
590
590
|
else
|
|
591
|
-
git_branch_remote_name(&value, repo, git_reference_name(upstream));
|
|
591
|
+
error = git_branch_remote_name(&value, repo, git_reference_name(upstream));
|
|
592
|
+
|
|
593
|
+
if (error < 0)
|
|
594
|
+
goto on_error;
|
|
592
595
|
|
|
593
596
|
if (git_buf_printf(&key, "branch.%s.remote", shortname) < 0)
|
|
594
597
|
goto on_error;
|
|
@@ -131,17 +131,15 @@ int git_buf_text_lf_to_crlf(git_buf *tgt, const git_buf *src)
|
|
|
131
131
|
for (; next; scan = next + 1, next = memchr(scan, '\n', end - scan)) {
|
|
132
132
|
size_t copylen = next - scan;
|
|
133
133
|
|
|
134
|
-
/* if we find mixed line endings,
|
|
135
|
-
if (
|
|
136
|
-
|
|
137
|
-
return GIT_PASSTHROUGH;
|
|
138
|
-
}
|
|
134
|
+
/* if we find mixed line endings, carry on */
|
|
135
|
+
if (copylen && next[-1] == '\r')
|
|
136
|
+
copylen--;
|
|
139
137
|
|
|
140
138
|
GITERR_CHECK_ALLOC_ADD(&alloclen, copylen, 3);
|
|
141
139
|
if (git_buf_grow_by(tgt, alloclen) < 0)
|
|
142
140
|
return -1;
|
|
143
141
|
|
|
144
|
-
if (
|
|
142
|
+
if (copylen) {
|
|
145
143
|
memcpy(tgt->ptr + tgt->size, scan, copylen);
|
|
146
144
|
tgt->size += copylen;
|
|
147
145
|
}
|
|
@@ -58,8 +58,7 @@ extern void git_buf_text_unescape(git_buf *buf);
|
|
|
58
58
|
/**
|
|
59
59
|
* Replace all \r\n with \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
|
@@ -33,7 +33,7 @@ void git_buf_init(git_buf *buf, size_t initial_size)
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
int git_buf_try_grow(
|
|
36
|
-
git_buf *buf, size_t target_size, bool mark_oom
|
|
36
|
+
git_buf *buf, size_t target_size, bool mark_oom)
|
|
37
37
|
{
|
|
38
38
|
char *new_ptr;
|
|
39
39
|
size_t new_size;
|
|
@@ -41,6 +41,11 @@ int git_buf_try_grow(
|
|
|
41
41
|
if (buf->ptr == git_buf__oom)
|
|
42
42
|
return -1;
|
|
43
43
|
|
|
44
|
+
if (buf->asize == 0 && buf->size != 0) {
|
|
45
|
+
giterr_set(GITERR_INVALID, "cannot grow a borrowed buffer");
|
|
46
|
+
return GIT_EINVALID;
|
|
47
|
+
}
|
|
48
|
+
|
|
44
49
|
if (!target_size)
|
|
45
50
|
target_size = buf->size;
|
|
46
51
|
|
|
@@ -82,9 +87,6 @@ int git_buf_try_grow(
|
|
|
82
87
|
return -1;
|
|
83
88
|
}
|
|
84
89
|
|
|
85
|
-
if (preserve_external && !buf->asize && buf->ptr != NULL && buf->size > 0)
|
|
86
|
-
memcpy(new_ptr, buf->ptr, min(buf->size, new_size));
|
|
87
|
-
|
|
88
90
|
buf->asize = new_size;
|
|
89
91
|
buf->ptr = new_ptr;
|
|
90
92
|
|
|
@@ -98,7 +100,7 @@ int git_buf_try_grow(
|
|
|
98
100
|
|
|
99
101
|
int git_buf_grow(git_buf *buffer, size_t target_size)
|
|
100
102
|
{
|
|
101
|
-
return git_buf_try_grow(buffer, target_size, true
|
|
103
|
+
return git_buf_try_grow(buffer, target_size, true);
|
|
102
104
|
}
|
|
103
105
|
|
|
104
106
|
int git_buf_grow_by(git_buf *buffer, size_t additional_size)
|
|
@@ -110,7 +112,7 @@ int git_buf_grow_by(git_buf *buffer, size_t additional_size)
|
|
|
110
112
|
return -1;
|
|
111
113
|
}
|
|
112
114
|
|
|
113
|
-
return git_buf_try_grow(buffer, newsize, true
|
|
115
|
+
return git_buf_try_grow(buffer, newsize, true);
|
|
114
116
|
}
|
|
115
117
|
|
|
116
118
|
void git_buf_free(git_buf *buf)
|
data/vendor/libgit2/src/buffer.h
CHANGED
|
@@ -59,7 +59,7 @@ extern int git_buf_grow_by(git_buf *buffer, size_t additional_size);
|
|
|
59
59
|
* into the newly allocated buffer.
|
|
60
60
|
*/
|
|
61
61
|
extern int git_buf_try_grow(
|
|
62
|
-
git_buf *buf, size_t target_size, bool mark_oom
|
|
62
|
+
git_buf *buf, size_t target_size, bool mark_oom);
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
65
|
* Sanitizes git_buf structures provided from user input. Users of the
|
data/vendor/libgit2/src/cache.c
CHANGED
|
@@ -68,6 +68,7 @@ int git_cache_init(git_cache *cache)
|
|
|
68
68
|
{
|
|
69
69
|
memset(cache, 0, sizeof(*cache));
|
|
70
70
|
cache->map = git_oidmap_alloc();
|
|
71
|
+
GITERR_CHECK_ALLOC(cache->map);
|
|
71
72
|
if (git_rwlock_init(&cache->lock)) {
|
|
72
73
|
giterr_set(GITERR_OS, "Failed to initialize cache rwlock");
|
|
73
74
|
return -1;
|