rugged 1.5.0.1 → 1.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/rugged/extconf.rb +2 -2
- data/ext/rugged/rugged_allocator.c +0 -54
- data/ext/rugged/rugged_blame.c +2 -0
- data/ext/rugged/rugged_blob.c +3 -0
- data/ext/rugged/rugged_commit.c +1 -0
- data/ext/rugged/rugged_config.c +2 -0
- data/ext/rugged/rugged_diff.c +1 -0
- data/ext/rugged/rugged_index.c +2 -0
- data/ext/rugged/rugged_patch.c +1 -0
- data/ext/rugged/rugged_rebase.c +1 -0
- data/ext/rugged/rugged_reference.c +1 -0
- data/ext/rugged/rugged_remote.c +1 -0
- data/ext/rugged/rugged_repo.c +5 -2
- data/ext/rugged/rugged_revwalk.c +5 -1
- data/ext/rugged/rugged_submodule.c +1 -0
- data/ext/rugged/rugged_tag.c +1 -0
- data/ext/rugged/rugged_tree.c +4 -0
- data/lib/rugged/index.rb +1 -1
- data/lib/rugged/tree.rb +1 -1
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +7 -8
- data/vendor/libgit2/COPYING +30 -0
- data/vendor/libgit2/cmake/CheckPrototypeDefinitionSafe.cmake +16 -0
- data/vendor/libgit2/cmake/ExperimentalFeatures.cmake +23 -0
- data/vendor/libgit2/cmake/SelectGSSAPI.cmake +3 -3
- data/vendor/libgit2/cmake/SelectHTTPSBackend.cmake +21 -2
- data/vendor/libgit2/cmake/SelectHashes.cmake +4 -0
- data/vendor/libgit2/cmake/SelectXdiff.cmake +9 -0
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +2 -0
- data/vendor/libgit2/deps/pcre/LICENCE +5 -5
- data/vendor/libgit2/deps/pcre/pcre.h +2 -2
- data/vendor/libgit2/deps/pcre/pcre_compile.c +6 -3
- data/vendor/libgit2/deps/pcre/pcre_exec.c +2 -2
- data/vendor/libgit2/deps/xdiff/CMakeLists.txt +28 -0
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/git-xdiff.h +4 -1
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xdiffi.c +19 -18
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xdiffi.h +2 -4
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xemit.c +3 -3
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xhistogram.c +7 -18
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xmacros.h +18 -1
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xmerge.c +24 -22
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xpatience.c +21 -30
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xprepare.c +13 -30
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xutils.c +18 -1
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xutils.h +2 -1
- data/vendor/libgit2/include/git2/common.h +38 -6
- data/vendor/libgit2/include/git2/deprecated.h +6 -0
- data/vendor/libgit2/include/git2/diff.h +42 -4
- data/vendor/libgit2/include/git2/errors.h +4 -2
- data/vendor/libgit2/include/git2/experimental.h +20 -0
- data/vendor/libgit2/include/git2/index.h +9 -0
- data/vendor/libgit2/include/git2/indexer.h +29 -0
- data/vendor/libgit2/include/git2/object.h +28 -2
- data/vendor/libgit2/include/git2/odb.h +58 -7
- data/vendor/libgit2/include/git2/odb_backend.h +106 -18
- data/vendor/libgit2/include/git2/oid.h +116 -16
- data/vendor/libgit2/include/git2/remote.h +18 -0
- data/vendor/libgit2/include/git2/repository.h +32 -3
- data/vendor/libgit2/include/git2/stash.h +60 -6
- data/vendor/libgit2/include/git2/strarray.h +0 -13
- data/vendor/libgit2/include/git2/sys/alloc.h +0 -34
- data/vendor/libgit2/include/git2/sys/commit_graph.h +12 -2
- data/vendor/libgit2/include/git2/sys/midx.h +5 -1
- data/vendor/libgit2/include/git2/sys/odb_backend.h +1 -1
- data/vendor/libgit2/include/git2/sys/stream.h +16 -2
- data/vendor/libgit2/include/git2/sys/transport.h +32 -2
- data/vendor/libgit2/include/git2/version.h +4 -4
- data/vendor/libgit2/include/git2/worktree.h +3 -1
- data/vendor/libgit2/include/git2.h +1 -0
- data/vendor/libgit2/src/CMakeLists.txt +34 -17
- data/vendor/libgit2/src/cli/CMakeLists.txt +5 -2
- data/vendor/libgit2/src/cli/cmd_clone.c +22 -6
- data/vendor/libgit2/src/cli/cmd_hash_object.c +27 -8
- data/vendor/libgit2/src/cli/opt.c +1 -1
- data/vendor/libgit2/src/cli/progress.c +9 -8
- data/vendor/libgit2/src/cli/progress.h +4 -4
- data/vendor/libgit2/src/libgit2/CMakeLists.txt +25 -34
- data/vendor/libgit2/src/libgit2/annotated_commit.c +2 -2
- data/vendor/libgit2/src/libgit2/annotated_commit.h +1 -1
- data/vendor/libgit2/src/libgit2/apply.c +4 -3
- data/vendor/libgit2/src/libgit2/attr_file.c +1 -1
- data/vendor/libgit2/src/libgit2/attrcache.c +1 -1
- data/vendor/libgit2/src/libgit2/blame.c +23 -14
- data/vendor/libgit2/src/libgit2/blame_git.c +0 -1
- data/vendor/libgit2/src/libgit2/blob.c +4 -2
- data/vendor/libgit2/src/libgit2/blob.h +2 -2
- data/vendor/libgit2/src/libgit2/branch.c +2 -2
- data/vendor/libgit2/src/libgit2/cherrypick.c +3 -3
- data/vendor/libgit2/src/libgit2/clone.c +34 -3
- data/vendor/libgit2/src/libgit2/commit.c +78 -21
- data/vendor/libgit2/src/libgit2/commit.h +25 -7
- data/vendor/libgit2/src/libgit2/commit_graph.c +129 -47
- data/vendor/libgit2/src/libgit2/commit_graph.h +23 -4
- data/vendor/libgit2/src/libgit2/commit_list.c +16 -5
- data/vendor/libgit2/src/libgit2/commit_list.h +1 -0
- data/vendor/libgit2/src/libgit2/config.c +6 -3
- data/vendor/libgit2/src/libgit2/config_file.c +16 -10
- data/vendor/libgit2/src/libgit2/describe.c +11 -8
- data/vendor/libgit2/src/libgit2/diff.c +19 -6
- data/vendor/libgit2/src/libgit2/diff.h +6 -6
- data/vendor/libgit2/src/libgit2/diff_file.c +16 -7
- data/vendor/libgit2/src/libgit2/diff_generate.c +37 -11
- data/vendor/libgit2/src/libgit2/diff_parse.c +20 -4
- data/vendor/libgit2/src/libgit2/diff_print.c +26 -7
- data/vendor/libgit2/src/libgit2/diff_tform.c +4 -0
- data/vendor/libgit2/src/libgit2/diff_xdiff.h +1 -1
- data/vendor/libgit2/src/libgit2/email.c +4 -3
- data/vendor/libgit2/src/libgit2/errors.c +73 -18
- data/vendor/libgit2/src/libgit2/experimental.h.in +13 -0
- data/vendor/libgit2/src/libgit2/fetch.c +38 -13
- data/vendor/libgit2/src/libgit2/fetch.h +0 -2
- data/vendor/libgit2/src/libgit2/fetchhead.c +11 -9
- data/vendor/libgit2/src/libgit2/grafts.c +272 -0
- data/vendor/libgit2/src/libgit2/grafts.h +36 -0
- data/vendor/libgit2/src/libgit2/ident.c +3 -3
- data/vendor/libgit2/src/libgit2/index.c +327 -123
- data/vendor/libgit2/src/libgit2/index.h +14 -1
- data/vendor/libgit2/src/libgit2/indexer.c +116 -46
- data/vendor/libgit2/src/libgit2/iterator.c +21 -4
- data/vendor/libgit2/src/libgit2/iterator.h +3 -0
- data/vendor/libgit2/src/libgit2/libgit2.c +58 -0
- data/vendor/libgit2/src/libgit2/merge.c +14 -9
- data/vendor/libgit2/src/libgit2/merge_file.c +0 -2
- data/vendor/libgit2/src/libgit2/midx.c +68 -38
- data/vendor/libgit2/src/libgit2/midx.h +13 -3
- data/vendor/libgit2/src/libgit2/mwindow.c +5 -2
- data/vendor/libgit2/src/libgit2/mwindow.h +4 -1
- data/vendor/libgit2/src/libgit2/notes.c +9 -8
- data/vendor/libgit2/src/libgit2/object.c +118 -29
- data/vendor/libgit2/src/libgit2/object.h +17 -2
- data/vendor/libgit2/src/libgit2/odb.c +224 -55
- data/vendor/libgit2/src/libgit2/odb.h +43 -4
- data/vendor/libgit2/src/libgit2/odb_loose.c +128 -70
- data/vendor/libgit2/src/libgit2/odb_pack.c +111 -46
- data/vendor/libgit2/src/libgit2/oid.c +141 -77
- data/vendor/libgit2/src/libgit2/oid.h +183 -9
- data/vendor/libgit2/src/libgit2/oidarray.c +49 -3
- data/vendor/libgit2/src/libgit2/oidarray.h +5 -1
- data/vendor/libgit2/src/libgit2/pack-objects.c +31 -13
- data/vendor/libgit2/src/libgit2/pack-objects.h +5 -2
- data/vendor/libgit2/src/libgit2/pack.c +93 -70
- data/vendor/libgit2/src/libgit2/pack.h +29 -15
- data/vendor/libgit2/src/libgit2/parse.c +8 -4
- data/vendor/libgit2/src/libgit2/parse.h +1 -1
- data/vendor/libgit2/src/libgit2/patch.h +7 -1
- data/vendor/libgit2/src/libgit2/patch_generate.c +24 -5
- data/vendor/libgit2/src/libgit2/patch_parse.c +16 -8
- data/vendor/libgit2/src/libgit2/push.c +13 -3
- data/vendor/libgit2/src/libgit2/reader.c +1 -1
- data/vendor/libgit2/src/libgit2/rebase.c +72 -83
- data/vendor/libgit2/src/libgit2/refdb_fs.c +92 -52
- data/vendor/libgit2/src/libgit2/reflog.c +7 -5
- data/vendor/libgit2/src/libgit2/reflog.h +1 -2
- data/vendor/libgit2/src/libgit2/refs.c +9 -0
- data/vendor/libgit2/src/libgit2/remote.c +47 -37
- data/vendor/libgit2/src/libgit2/remote.h +41 -0
- data/vendor/libgit2/src/libgit2/repository.c +784 -329
- data/vendor/libgit2/src/libgit2/repository.h +26 -2
- data/vendor/libgit2/src/libgit2/reset.c +2 -2
- data/vendor/libgit2/src/libgit2/revert.c +8 -11
- data/vendor/libgit2/src/libgit2/revparse.c +23 -7
- data/vendor/libgit2/src/libgit2/revwalk.c +31 -5
- data/vendor/libgit2/src/libgit2/stash.c +209 -33
- data/vendor/libgit2/src/libgit2/strarray.c +1 -0
- data/vendor/libgit2/src/libgit2/strarray.h +25 -0
- data/vendor/libgit2/src/libgit2/streams/mbedtls.c +0 -1
- data/vendor/libgit2/src/libgit2/streams/openssl.c +9 -17
- data/vendor/libgit2/src/libgit2/streams/openssl_dynamic.c +7 -3
- data/vendor/libgit2/src/libgit2/streams/schannel.c +715 -0
- data/vendor/libgit2/src/libgit2/streams/schannel.h +28 -0
- data/vendor/libgit2/src/libgit2/streams/socket.c +240 -51
- data/vendor/libgit2/src/libgit2/streams/socket.h +3 -1
- data/vendor/libgit2/src/libgit2/streams/stransport.c +40 -12
- data/vendor/libgit2/src/libgit2/streams/tls.c +5 -0
- data/vendor/libgit2/src/libgit2/submodule.c +6 -2
- data/vendor/libgit2/src/libgit2/submodule.h +3 -3
- data/vendor/libgit2/src/libgit2/sysdir.c +294 -7
- data/vendor/libgit2/src/libgit2/sysdir.h +41 -9
- data/vendor/libgit2/src/libgit2/tag.c +29 -10
- data/vendor/libgit2/src/libgit2/tag.h +2 -2
- data/vendor/libgit2/src/libgit2/threadstate.c +15 -2
- data/vendor/libgit2/src/libgit2/threadstate.h +1 -3
- data/vendor/libgit2/src/libgit2/transports/auth.h +1 -2
- data/vendor/libgit2/src/libgit2/transports/{auth_negotiate.c → auth_gssapi.c} +32 -32
- data/vendor/libgit2/src/libgit2/transports/auth_negotiate.h +1 -1
- data/vendor/libgit2/src/libgit2/transports/auth_ntlm.h +1 -1
- data/vendor/libgit2/src/libgit2/transports/{auth_ntlm.c → auth_ntlmclient.c} +12 -12
- data/vendor/libgit2/src/libgit2/transports/auth_sspi.c +341 -0
- data/vendor/libgit2/src/libgit2/transports/git.c +7 -8
- data/vendor/libgit2/src/libgit2/transports/http.c +15 -9
- data/vendor/libgit2/src/libgit2/transports/httpclient.c +14 -0
- data/vendor/libgit2/src/libgit2/transports/httpclient.h +10 -0
- data/vendor/libgit2/src/libgit2/transports/local.c +27 -4
- data/vendor/libgit2/src/libgit2/transports/smart.c +68 -27
- data/vendor/libgit2/src/libgit2/transports/smart.h +33 -9
- data/vendor/libgit2/src/libgit2/transports/smart_pkt.c +281 -49
- data/vendor/libgit2/src/libgit2/transports/smart_protocol.c +192 -55
- data/vendor/libgit2/src/libgit2/transports/ssh.c +334 -102
- data/vendor/libgit2/src/libgit2/transports/winhttp.c +22 -18
- data/vendor/libgit2/src/libgit2/tree-cache.c +26 -16
- data/vendor/libgit2/src/libgit2/tree-cache.h +5 -3
- data/vendor/libgit2/src/libgit2/tree.c +23 -17
- data/vendor/libgit2/src/libgit2/tree.h +2 -2
- data/vendor/libgit2/src/libgit2/worktree.c +30 -10
- data/vendor/libgit2/src/util/CMakeLists.txt +6 -1
- data/vendor/libgit2/src/util/alloc.c +65 -6
- data/vendor/libgit2/src/util/alloc.h +34 -9
- data/vendor/libgit2/src/util/allocators/failalloc.c +0 -60
- data/vendor/libgit2/src/util/allocators/failalloc.h +0 -6
- data/vendor/libgit2/src/util/allocators/stdalloc.c +2 -105
- data/vendor/libgit2/src/util/allocators/win32_leakcheck.c +0 -68
- data/vendor/libgit2/src/util/array.h +6 -1
- data/vendor/libgit2/src/util/cc-compat.h +2 -0
- data/vendor/libgit2/src/util/filebuf.c +6 -1
- data/vendor/libgit2/src/util/filebuf.h +19 -6
- data/vendor/libgit2/src/util/fs_path.c +2 -2
- data/vendor/libgit2/src/util/futils.c +8 -8
- data/vendor/libgit2/src/{features.h.in → util/git2_features.h.in} +9 -3
- data/vendor/libgit2/src/util/git2_util.h +2 -2
- data/vendor/libgit2/src/util/hash/openssl.c +4 -3
- data/vendor/libgit2/src/util/hash/rfc6234/sha.h +0 -112
- data/vendor/libgit2/src/util/hash.h +13 -0
- data/vendor/libgit2/src/util/net.c +492 -87
- data/vendor/libgit2/src/util/net.h +32 -0
- data/vendor/libgit2/src/util/posix.c +54 -0
- data/vendor/libgit2/src/util/posix.h +24 -0
- data/vendor/libgit2/src/util/rand.c +10 -4
- data/vendor/libgit2/src/util/regexp.c +3 -3
- data/vendor/libgit2/src/util/staticstr.h +66 -0
- data/vendor/libgit2/src/util/thread.h +20 -19
- data/vendor/libgit2/src/util/util.c +15 -10
- data/vendor/libgit2/src/util/util.h +25 -16
- data/vendor/libgit2/src/util/win32/error.c +1 -1
- data/vendor/libgit2/src/util/win32/path_w32.c +8 -8
- data/vendor/libgit2/src/util/win32/posix_w32.c +1 -1
- data/vendor/libgit2/src/util/win32/utf-conv.c +73 -75
- data/vendor/libgit2/src/util/win32/utf-conv.h +81 -14
- data/vendor/libgit2/src/util/win32/w32_util.c +1 -1
- metadata +34 -26
- data/vendor/libgit2/cmake/SelectWinHTTP.cmake +0 -17
- data/vendor/libgit2/src/libgit2/netops.c +0 -124
- data/vendor/libgit2/src/libgit2/netops.h +0 -68
- data/vendor/libgit2/src/util/win32/findfile.c +0 -286
- data/vendor/libgit2/src/util/win32/findfile.h +0 -22
- /data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xdiff.h +0 -0
- /data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xemit.h +0 -0
- /data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xinclude.h +0 -0
- /data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xprepare.h +0 -0
- /data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xtypes.h +0 -0
@@ -8,7 +8,6 @@
|
|
8
8
|
#include "common.h"
|
9
9
|
|
10
10
|
#include "git2/describe.h"
|
11
|
-
#include "git2/strarray.h"
|
12
11
|
#include "git2/diff.h"
|
13
12
|
#include "git2/status.h"
|
14
13
|
|
@@ -19,6 +18,7 @@
|
|
19
18
|
#include "refs.h"
|
20
19
|
#include "repository.h"
|
21
20
|
#include "revwalk.h"
|
21
|
+
#include "strarray.h"
|
22
22
|
#include "tag.h"
|
23
23
|
#include "vector.h"
|
24
24
|
#include "wildmatch.h"
|
@@ -363,12 +363,15 @@ static int find_unique_abbrev_size(
|
|
363
363
|
size_t size = abbreviated_size;
|
364
364
|
git_odb *odb;
|
365
365
|
git_oid dummy;
|
366
|
+
size_t hexsize;
|
366
367
|
int error;
|
367
368
|
|
368
369
|
if ((error = git_repository_odb__weakptr(&odb, repo)) < 0)
|
369
370
|
return error;
|
370
371
|
|
371
|
-
|
372
|
+
hexsize = git_oid_hexsize(repo->oid_type);
|
373
|
+
|
374
|
+
while (size < hexsize) {
|
372
375
|
if ((error = git_odb_exists_prefix(&dummy, odb, oid_in, size)) == 0) {
|
373
376
|
*out = (int) size;
|
374
377
|
return 0;
|
@@ -383,7 +386,7 @@ static int find_unique_abbrev_size(
|
|
383
386
|
}
|
384
387
|
|
385
388
|
/* If we didn't find any shorter prefix, we have to do the whole thing */
|
386
|
-
*out =
|
389
|
+
*out = (int)hexsize;
|
387
390
|
|
388
391
|
return 0;
|
389
392
|
}
|
@@ -397,7 +400,7 @@ static int show_suffix(
|
|
397
400
|
{
|
398
401
|
int error, size = 0;
|
399
402
|
|
400
|
-
char hex_oid[
|
403
|
+
char hex_oid[GIT_OID_MAX_HEXSIZE];
|
401
404
|
|
402
405
|
if ((error = find_unique_abbrev_size(&size, repo, id, abbrev_size)) < 0)
|
403
406
|
return error;
|
@@ -414,7 +417,7 @@ static int show_suffix(
|
|
414
417
|
#define MAX_CANDIDATES_TAGS FLAG_BITS - 1
|
415
418
|
|
416
419
|
static int describe_not_found(const git_oid *oid, const char *message_format) {
|
417
|
-
char oid_str[
|
420
|
+
char oid_str[GIT_OID_MAX_HEXSIZE + 1];
|
418
421
|
git_oid_tostr(oid_str, sizeof(oid_str), oid);
|
419
422
|
|
420
423
|
git_error_set(GIT_ERROR_DESCRIBE, message_format, oid_str);
|
@@ -525,7 +528,7 @@ static int describe(
|
|
525
528
|
if (annotated_cnt && (git_pqueue_size(&list) == 0)) {
|
526
529
|
/*
|
527
530
|
if (debug) {
|
528
|
-
char oid_str[
|
531
|
+
char oid_str[GIT_OID_MAX_HEXSIZE + 1];
|
529
532
|
git_oid_tostr(oid_str, sizeof(oid_str), &c->oid);
|
530
533
|
|
531
534
|
fprintf(stderr, "finished search at %s\n", oid_str);
|
@@ -592,7 +595,7 @@ static int describe(
|
|
592
595
|
"head", "lightweight", "annotated",
|
593
596
|
};
|
594
597
|
|
595
|
-
char oid_str[
|
598
|
+
char oid_str[GIT_OID_MAX_HEXSIZE + 1];
|
596
599
|
|
597
600
|
if (debug) {
|
598
601
|
for (cur_match = 0; cur_match < match_cnt; cur_match++) {
|
@@ -816,7 +819,7 @@ static int git_describe__format(
|
|
816
819
|
|
817
820
|
/* If we didn't find *any* tags, we fall back to the commit's id */
|
818
821
|
if (result->fallback_to_id) {
|
819
|
-
char hex_oid[
|
822
|
+
char hex_oid[GIT_OID_MAX_HEXSIZE + 1] = {0};
|
820
823
|
int size = 0;
|
821
824
|
|
822
825
|
if ((error = find_unique_abbrev_size(
|
@@ -19,8 +19,10 @@
|
|
19
19
|
#include "git2/email.h"
|
20
20
|
|
21
21
|
struct patch_id_args {
|
22
|
+
git_diff *diff;
|
22
23
|
git_hash_ctx ctx;
|
23
24
|
git_oid result;
|
25
|
+
git_oid_t oid_type;
|
24
26
|
int first_file;
|
25
27
|
};
|
26
28
|
|
@@ -280,17 +282,19 @@ int git_diff_find_options_init(
|
|
280
282
|
return 0;
|
281
283
|
}
|
282
284
|
|
283
|
-
static int flush_hunk(git_oid *result,
|
285
|
+
static int flush_hunk(git_oid *result, struct patch_id_args *args)
|
284
286
|
{
|
287
|
+
git_hash_ctx *ctx = &args->ctx;
|
285
288
|
git_oid hash;
|
286
289
|
unsigned short carry = 0;
|
287
|
-
|
290
|
+
size_t i;
|
291
|
+
int error;
|
288
292
|
|
289
293
|
if ((error = git_hash_final(hash.id, ctx)) < 0 ||
|
290
294
|
(error = git_hash_init(ctx)) < 0)
|
291
295
|
return error;
|
292
296
|
|
293
|
-
for (i = 0; i <
|
297
|
+
for (i = 0; i < git_oid_size(args->oid_type); i++) {
|
294
298
|
carry += result->id[i] + hash.id[i];
|
295
299
|
result->id[i] = (unsigned char)carry;
|
296
300
|
carry >>= 8;
|
@@ -338,7 +342,7 @@ static int diff_patchid_print_callback_to_buf(
|
|
338
342
|
|
339
343
|
if (line->origin == GIT_DIFF_LINE_FILE_HDR &&
|
340
344
|
!args->first_file &&
|
341
|
-
(error = flush_hunk(&args->result,
|
345
|
+
(error = flush_hunk(&args->result, args) < 0))
|
342
346
|
goto out;
|
343
347
|
|
344
348
|
if ((error = git_hash_update(&args->ctx, buf.ptr, buf.size)) < 0)
|
@@ -362,14 +366,19 @@ int git_diff_patchid_options_init(git_diff_patchid_options *opts, unsigned int v
|
|
362
366
|
int git_diff_patchid(git_oid *out, git_diff *diff, git_diff_patchid_options *opts)
|
363
367
|
{
|
364
368
|
struct patch_id_args args;
|
369
|
+
git_hash_algorithm_t algorithm;
|
365
370
|
int error;
|
366
371
|
|
367
372
|
GIT_ERROR_CHECK_VERSION(
|
368
373
|
opts, GIT_DIFF_PATCHID_OPTIONS_VERSION, "git_diff_patchid_options");
|
369
374
|
|
375
|
+
algorithm = git_oid_algorithm(diff->opts.oid_type);
|
376
|
+
|
370
377
|
memset(&args, 0, sizeof(args));
|
378
|
+
args.diff = diff;
|
371
379
|
args.first_file = 1;
|
372
|
-
|
380
|
+
args.oid_type = diff->opts.oid_type;
|
381
|
+
if ((error = git_hash_ctx_init(&args.ctx, algorithm)) < 0)
|
373
382
|
goto out;
|
374
383
|
|
375
384
|
if ((error = git_diff_print(diff,
|
@@ -378,9 +387,13 @@ int git_diff_patchid(git_oid *out, git_diff *diff, git_diff_patchid_options *opt
|
|
378
387
|
&args)) < 0)
|
379
388
|
goto out;
|
380
389
|
|
381
|
-
if ((error = (flush_hunk(&args.result, &args
|
390
|
+
if ((error = (flush_hunk(&args.result, &args))) < 0)
|
382
391
|
goto out;
|
383
392
|
|
393
|
+
#ifdef GIT_EXPERIMENTAL_SHA256
|
394
|
+
args.result.type = diff->opts.oid_type;
|
395
|
+
#endif
|
396
|
+
|
384
397
|
git_oid_cpy(out, &args.result);
|
385
398
|
|
386
399
|
out:
|
@@ -30,15 +30,15 @@ typedef enum {
|
|
30
30
|
} git_diff_origin_t;
|
31
31
|
|
32
32
|
struct git_diff {
|
33
|
-
git_refcount
|
33
|
+
git_refcount rc;
|
34
34
|
git_repository *repo;
|
35
|
-
git_attr_session
|
35
|
+
git_attr_session attrsession;
|
36
36
|
git_diff_origin_t type;
|
37
|
-
git_diff_options
|
38
|
-
git_vector
|
37
|
+
git_diff_options opts;
|
38
|
+
git_vector deltas; /* vector of git_diff_delta */
|
39
39
|
git_pool pool;
|
40
|
-
git_iterator_t
|
41
|
-
git_iterator_t
|
40
|
+
git_iterator_t old_src;
|
41
|
+
git_iterator_t new_src;
|
42
42
|
git_diff_perfdata perf;
|
43
43
|
|
44
44
|
int (*strcomp)(const char *, const char *);
|
@@ -112,7 +112,7 @@ int git_diff_file_content__init_from_diff(
|
|
112
112
|
case GIT_DELTA_DELETED:
|
113
113
|
has_data = use_old; break;
|
114
114
|
case GIT_DELTA_UNTRACKED:
|
115
|
-
has_data =
|
115
|
+
has_data = (use_old == (diff->opts.flags & GIT_DIFF_REVERSE)) &&
|
116
116
|
(diff->opts.flags & GIT_DIFF_SHOW_UNTRACKED_CONTENT) != 0;
|
117
117
|
break;
|
118
118
|
case GIT_DELTA_UNREADABLE:
|
@@ -144,6 +144,7 @@ int git_diff_file_content__init_from_src(
|
|
144
144
|
|
145
145
|
if (!src->blob && !src->buf) {
|
146
146
|
fc->flags |= GIT_DIFF_FLAG__NO_DATA;
|
147
|
+
git_oid_clear(&fc->file->id, opts->oid_type);
|
147
148
|
} else {
|
148
149
|
fc->flags |= GIT_DIFF_FLAG__LOADED;
|
149
150
|
fc->file->flags |= GIT_DIFF_FLAG_VALID_ID;
|
@@ -153,7 +154,7 @@ int git_diff_file_content__init_from_src(
|
|
153
154
|
git_blob_dup((git_blob **)&fc->blob, (git_blob *) src->blob);
|
154
155
|
fc->file->size = git_blob_rawsize(src->blob);
|
155
156
|
git_oid_cpy(&fc->file->id, git_blob_id(src->blob));
|
156
|
-
fc->file->id_abbrev =
|
157
|
+
fc->file->id_abbrev = (uint16_t)git_oid_hexsize(repo->oid_type);
|
157
158
|
|
158
159
|
fc->map.len = (size_t)fc->file->size;
|
159
160
|
fc->map.data = (char *)git_blob_rawcontent(src->blob);
|
@@ -161,10 +162,10 @@ int git_diff_file_content__init_from_src(
|
|
161
162
|
fc->flags |= GIT_DIFF_FLAG__FREE_BLOB;
|
162
163
|
} else {
|
163
164
|
int error;
|
164
|
-
if ((error =
|
165
|
+
if ((error = git_odb__hash(&fc->file->id, src->buf, src->buflen, GIT_OBJECT_BLOB, opts->oid_type)) < 0)
|
165
166
|
return error;
|
166
167
|
fc->file->size = src->buflen;
|
167
|
-
fc->file->id_abbrev =
|
168
|
+
fc->file->id_abbrev = (uint16_t)git_oid_hexsize(opts->oid_type);
|
168
169
|
|
169
170
|
fc->map.len = src->buflen;
|
170
171
|
fc->map.data = (char *)src->buf;
|
@@ -177,7 +178,7 @@ int git_diff_file_content__init_from_src(
|
|
177
178
|
static int diff_file_content_commit_to_str(
|
178
179
|
git_diff_file_content *fc, bool check_status)
|
179
180
|
{
|
180
|
-
char oid[
|
181
|
+
char oid[GIT_OID_MAX_HEXSIZE+1];
|
181
182
|
git_str content = GIT_STR_INIT;
|
182
183
|
const char *status = "";
|
183
184
|
|
@@ -347,6 +348,13 @@ static int diff_file_content_load_workdir_file(
|
|
347
348
|
goto cleanup;
|
348
349
|
}
|
349
350
|
|
351
|
+
/* if file is empty, don't attempt to mmap or readbuffer */
|
352
|
+
if (fc->file->size == 0) {
|
353
|
+
fc->map.len = 0;
|
354
|
+
fc->map.data = git_str__initstr;
|
355
|
+
goto cleanup;
|
356
|
+
}
|
357
|
+
|
350
358
|
if ((diff_opts->flags & GIT_DIFF_SHOW_BINARY) == 0 &&
|
351
359
|
diff_file_content_binary_by_size(fc))
|
352
360
|
goto cleanup;
|
@@ -410,8 +418,9 @@ static int diff_file_content_load_workdir(
|
|
410
418
|
|
411
419
|
/* once data is loaded, update OID if we didn't have it previously */
|
412
420
|
if (!error && (fc->file->flags & GIT_DIFF_FLAG_VALID_ID) == 0) {
|
413
|
-
error =
|
414
|
-
&fc->file->id, fc->map.data, fc->map.len,
|
421
|
+
error = git_odb__hash(
|
422
|
+
&fc->file->id, fc->map.data, fc->map.len,
|
423
|
+
GIT_OBJECT_BLOB, diff_opts->oid_type);
|
415
424
|
fc->file->flags |= GIT_DIFF_FLAG_VALID_ID;
|
416
425
|
}
|
417
426
|
|
@@ -61,6 +61,9 @@ static git_diff_delta *diff_delta__alloc(
|
|
61
61
|
}
|
62
62
|
delta->status = status;
|
63
63
|
|
64
|
+
git_oid_clear(&delta->old_file.id, diff->base.opts.oid_type);
|
65
|
+
git_oid_clear(&delta->new_file.id, diff->base.opts.oid_type);
|
66
|
+
|
64
67
|
return delta;
|
65
68
|
}
|
66
69
|
|
@@ -146,10 +149,13 @@ static int diff_delta__from_one(
|
|
146
149
|
const git_index_entry *entry = nitem;
|
147
150
|
bool has_old = false;
|
148
151
|
git_diff_delta *delta;
|
152
|
+
git_oid_t oid_type;
|
149
153
|
const char *matched_pathspec;
|
150
154
|
|
151
155
|
GIT_ASSERT_ARG((oitem != NULL) ^ (nitem != NULL));
|
152
156
|
|
157
|
+
oid_type = diff->base.opts.oid_type;
|
158
|
+
|
153
159
|
if (oitem) {
|
154
160
|
entry = oitem;
|
155
161
|
has_old = true;
|
@@ -183,18 +189,23 @@ static int diff_delta__from_one(
|
|
183
189
|
GIT_ASSERT(status != GIT_DELTA_MODIFIED);
|
184
190
|
delta->nfiles = 1;
|
185
191
|
|
192
|
+
git_oid_clear(&delta->old_file.id, diff->base.opts.oid_type);
|
193
|
+
git_oid_clear(&delta->new_file.id, diff->base.opts.oid_type);
|
194
|
+
|
186
195
|
if (has_old) {
|
187
196
|
delta->old_file.mode = entry->mode;
|
188
197
|
delta->old_file.size = entry->file_size;
|
189
198
|
delta->old_file.flags |= GIT_DIFF_FLAG_EXISTS;
|
190
199
|
git_oid_cpy(&delta->old_file.id, &entry->id);
|
191
|
-
delta->
|
200
|
+
git_oid_clear(&delta->new_file.id, oid_type);
|
201
|
+
delta->old_file.id_abbrev = (uint16_t)git_oid_hexsize(oid_type);
|
192
202
|
} else /* ADDED, IGNORED, UNTRACKED */ {
|
193
203
|
delta->new_file.mode = entry->mode;
|
194
204
|
delta->new_file.size = entry->file_size;
|
195
205
|
delta->new_file.flags |= GIT_DIFF_FLAG_EXISTS;
|
206
|
+
git_oid_clear(&delta->old_file.id, oid_type);
|
196
207
|
git_oid_cpy(&delta->new_file.id, &entry->id);
|
197
|
-
delta->new_file.id_abbrev =
|
208
|
+
delta->new_file.id_abbrev = (uint16_t)git_oid_hexsize(oid_type);
|
198
209
|
}
|
199
210
|
|
200
211
|
delta->old_file.flags |= GIT_DIFF_FLAG_VALID_ID;
|
@@ -220,6 +231,9 @@ static int diff_delta__from_two(
|
|
220
231
|
const git_oid *old_id = &old_entry->id;
|
221
232
|
git_diff_delta *delta;
|
222
233
|
const char *canonical_path = old_entry->path;
|
234
|
+
git_oid_t oid_type;
|
235
|
+
|
236
|
+
oid_type = diff->base.opts.oid_type;
|
223
237
|
|
224
238
|
if (status == GIT_DELTA_UNMODIFIED &&
|
225
239
|
DIFF_FLAG_ISNT_SET(diff, GIT_DIFF_INCLUDE_UNMODIFIED))
|
@@ -249,14 +263,14 @@ static int diff_delta__from_two(
|
|
249
263
|
delta->old_file.size = old_entry->file_size;
|
250
264
|
delta->old_file.mode = old_mode;
|
251
265
|
git_oid_cpy(&delta->old_file.id, old_id);
|
252
|
-
delta->old_file.id_abbrev =
|
266
|
+
delta->old_file.id_abbrev = (uint16_t)git_oid_hexsize(oid_type);
|
253
267
|
delta->old_file.flags |= GIT_DIFF_FLAG_VALID_ID |
|
254
268
|
GIT_DIFF_FLAG_EXISTS;
|
255
269
|
}
|
256
270
|
|
257
271
|
if (!git_index_entry_is_conflict(new_entry)) {
|
258
272
|
git_oid_cpy(&delta->new_file.id, new_id);
|
259
|
-
delta->new_file.id_abbrev =
|
273
|
+
delta->new_file.id_abbrev = (uint16_t)git_oid_hexsize(oid_type);
|
260
274
|
delta->new_file.size = new_entry->file_size;
|
261
275
|
delta->new_file.mode = new_mode;
|
262
276
|
delta->old_file.flags |= GIT_DIFF_FLAG_EXISTS;
|
@@ -485,6 +499,14 @@ static int diff_generated_apply_options(
|
|
485
499
|
return -1;
|
486
500
|
}
|
487
501
|
|
502
|
+
if (!diff->base.opts.oid_type) {
|
503
|
+
diff->base.opts.oid_type = repo->oid_type;
|
504
|
+
} else if (diff->base.opts.oid_type != repo->oid_type) {
|
505
|
+
git_error_set(GIT_ERROR_INVALID,
|
506
|
+
"specified object ID type does not match repository object ID type");
|
507
|
+
return -1;
|
508
|
+
}
|
509
|
+
|
488
510
|
/* flag INCLUDE_TYPECHANGE_TREES implies INCLUDE_TYPECHANGE */
|
489
511
|
if (DIFF_FLAG_IS_SET(diff, GIT_DIFF_INCLUDE_TYPECHANGE_TREES))
|
490
512
|
diff->base.opts.flags |= GIT_DIFF_INCLUDE_TYPECHANGE;
|
@@ -598,6 +620,7 @@ int git_diff__oid_for_file(
|
|
598
620
|
entry.mode = mode;
|
599
621
|
entry.file_size = (uint32_t)size;
|
600
622
|
entry.path = (char *)path;
|
623
|
+
git_oid_clear(&entry.id, diff->opts.oid_type);
|
601
624
|
|
602
625
|
return git_diff__oid_for_entry(out, diff, &entry, mode, NULL);
|
603
626
|
}
|
@@ -618,7 +641,7 @@ int git_diff__oid_for_entry(
|
|
618
641
|
GIT_ASSERT(d->type == GIT_DIFF_TYPE_GENERATED);
|
619
642
|
diff = (git_diff_generated *)d;
|
620
643
|
|
621
|
-
|
644
|
+
git_oid_clear(out, diff->base.opts.oid_type);
|
622
645
|
|
623
646
|
if (git_repository_workdir_path(&full_path, diff->base.repo, entry.path) < 0)
|
624
647
|
return -1;
|
@@ -654,7 +677,8 @@ int git_diff__oid_for_entry(
|
|
654
677
|
git_error_clear();
|
655
678
|
}
|
656
679
|
} else if (S_ISLNK(mode)) {
|
657
|
-
error = git_odb__hashlink(out, full_path.ptr
|
680
|
+
error = git_odb__hashlink(out, full_path.ptr,
|
681
|
+
diff->base.opts.oid_type);
|
658
682
|
diff->base.perf.oid_calculations++;
|
659
683
|
} else if (!git__is_sizet(entry.file_size)) {
|
660
684
|
git_error_set(GIT_ERROR_NOMEMORY, "file size overflow (for 32-bits) on '%s'",
|
@@ -669,7 +693,9 @@ int git_diff__oid_for_entry(
|
|
669
693
|
error = fd;
|
670
694
|
else {
|
671
695
|
error = git_odb__hashfd_filtered(
|
672
|
-
out, fd, (size_t)entry.file_size,
|
696
|
+
out, fd, (size_t)entry.file_size,
|
697
|
+
GIT_OBJECT_BLOB, diff->base.opts.oid_type,
|
698
|
+
fl);
|
673
699
|
p_close(fd);
|
674
700
|
diff->base.perf.oid_calculations++;
|
675
701
|
}
|
@@ -789,11 +815,11 @@ static int maybe_modified(
|
|
789
815
|
const char *matched_pathspec;
|
790
816
|
int error = 0;
|
791
817
|
|
818
|
+
git_oid_clear(&noid, diff->base.opts.oid_type);
|
819
|
+
|
792
820
|
if (!diff_pathspec_match(&matched_pathspec, diff, oitem))
|
793
821
|
return 0;
|
794
822
|
|
795
|
-
memset(&noid, 0, sizeof(noid));
|
796
|
-
|
797
823
|
/* on platforms with no symlinks, preserve mode of existing symlinks */
|
798
824
|
if (S_ISLNK(omode) && S_ISREG(nmode) && new_is_workdir &&
|
799
825
|
!(diff->diffcaps & GIT_DIFFCAPS_HAS_SYMLINKS))
|
@@ -1695,11 +1721,11 @@ int git_diff__commit(
|
|
1695
1721
|
*out = NULL;
|
1696
1722
|
|
1697
1723
|
if ((parents = git_commit_parentcount(commit)) > 1) {
|
1698
|
-
char commit_oidstr[
|
1724
|
+
char commit_oidstr[GIT_OID_MAX_HEXSIZE + 1];
|
1699
1725
|
|
1700
1726
|
error = -1;
|
1701
1727
|
git_error_set(GIT_ERROR_INVALID, "commit %s is a merge commit",
|
1702
|
-
git_oid_tostr(commit_oidstr,
|
1728
|
+
git_oid_tostr(commit_oidstr, GIT_OID_MAX_HEXSIZE + 1, git_commit_id(commit)));
|
1703
1729
|
goto on_error;
|
1704
1730
|
}
|
1705
1731
|
|
@@ -29,7 +29,7 @@ static void diff_parsed_free(git_diff *d)
|
|
29
29
|
git__free(diff);
|
30
30
|
}
|
31
31
|
|
32
|
-
static git_diff_parsed *diff_parsed_alloc(
|
32
|
+
static git_diff_parsed *diff_parsed_alloc(git_oid_t oid_type)
|
33
33
|
{
|
34
34
|
git_diff_parsed *diff;
|
35
35
|
|
@@ -51,6 +51,7 @@ static git_diff_parsed *diff_parsed_alloc(void)
|
|
51
51
|
}
|
52
52
|
|
53
53
|
diff->base.opts.flags &= ~GIT_DIFF_IGNORE_CASE;
|
54
|
+
diff->base.opts.oid_type = oid_type;
|
54
55
|
|
55
56
|
if (git_pool_init(&diff->base.pool, 1) < 0 ||
|
56
57
|
git_vector_init(&diff->patches, 0, NULL) < 0 ||
|
@@ -67,19 +68,34 @@ static git_diff_parsed *diff_parsed_alloc(void)
|
|
67
68
|
int git_diff_from_buffer(
|
68
69
|
git_diff **out,
|
69
70
|
const char *content,
|
70
|
-
size_t content_len
|
71
|
+
size_t content_len
|
72
|
+
#ifdef GIT_EXPERIMENTAL_SHA256
|
73
|
+
, git_diff_parse_options *opts
|
74
|
+
#endif
|
75
|
+
)
|
71
76
|
{
|
72
77
|
git_diff_parsed *diff;
|
73
78
|
git_patch *patch;
|
74
79
|
git_patch_parse_ctx *ctx = NULL;
|
80
|
+
git_patch_options patch_opts = GIT_PATCH_OPTIONS_INIT;
|
81
|
+
git_oid_t oid_type;
|
75
82
|
int error = 0;
|
76
83
|
|
77
84
|
*out = NULL;
|
78
85
|
|
79
|
-
|
86
|
+
#ifdef GIT_EXPERIMENTAL_SHA256
|
87
|
+
oid_type = (opts && opts->oid_type) ? opts->oid_type :
|
88
|
+
GIT_OID_DEFAULT;
|
89
|
+
#else
|
90
|
+
oid_type = GIT_OID_DEFAULT;
|
91
|
+
#endif
|
92
|
+
|
93
|
+
patch_opts.oid_type = oid_type;
|
94
|
+
|
95
|
+
diff = diff_parsed_alloc(oid_type);
|
80
96
|
GIT_ERROR_CHECK_ALLOC(diff);
|
81
97
|
|
82
|
-
ctx = git_patch_parse_ctx_init(content, content_len,
|
98
|
+
ctx = git_patch_parse_ctx_init(content, content_len, &patch_opts);
|
83
99
|
GIT_ERROR_CHECK_ALLOC(ctx);
|
84
100
|
|
85
101
|
while (ctx->parse_ctx.remain_len) {
|
@@ -29,6 +29,7 @@ typedef struct {
|
|
29
29
|
const char *new_prefix;
|
30
30
|
uint32_t flags;
|
31
31
|
int id_strlen;
|
32
|
+
git_oid_t oid_type;
|
32
33
|
|
33
34
|
int (*strcomp)(const char *, const char *);
|
34
35
|
} diff_print_info;
|
@@ -46,6 +47,8 @@ static int diff_print_info_init__common(
|
|
46
47
|
pi->payload = payload;
|
47
48
|
pi->buf = out;
|
48
49
|
|
50
|
+
GIT_ASSERT(pi->oid_type);
|
51
|
+
|
49
52
|
if (!pi->id_strlen) {
|
50
53
|
if (!repo)
|
51
54
|
pi->id_strlen = GIT_ABBREV_DEFAULT;
|
@@ -53,8 +56,9 @@ static int diff_print_info_init__common(
|
|
53
56
|
return -1;
|
54
57
|
}
|
55
58
|
|
56
|
-
if (pi->id_strlen >
|
57
|
-
|
59
|
+
if (pi->id_strlen > 0 &&
|
60
|
+
(size_t)pi->id_strlen > git_oid_hexsize(pi->oid_type))
|
61
|
+
pi->id_strlen = (int)git_oid_hexsize(pi->oid_type);
|
58
62
|
|
59
63
|
memset(&pi->line, 0, sizeof(pi->line));
|
60
64
|
pi->line.old_lineno = -1;
|
@@ -78,6 +82,7 @@ static int diff_print_info_init_fromdiff(
|
|
78
82
|
|
79
83
|
if (diff) {
|
80
84
|
pi->flags = diff->opts.flags;
|
85
|
+
pi->oid_type = diff->opts.oid_type;
|
81
86
|
pi->id_strlen = diff->opts.id_abbrev;
|
82
87
|
pi->old_prefix = diff->opts.old_prefix;
|
83
88
|
pi->new_prefix = diff->opts.new_prefix;
|
@@ -101,6 +106,7 @@ static int diff_print_info_init_frompatch(
|
|
101
106
|
memset(pi, 0, sizeof(diff_print_info));
|
102
107
|
|
103
108
|
pi->flags = patch->diff_opts.flags;
|
109
|
+
pi->oid_type = patch->diff_opts.oid_type;
|
104
110
|
pi->id_strlen = patch->diff_opts.id_abbrev;
|
105
111
|
pi->old_prefix = patch->diff_opts.old_prefix;
|
106
112
|
pi->new_prefix = patch->diff_opts.new_prefix;
|
@@ -212,7 +218,10 @@ static int diff_print_one_raw(
|
|
212
218
|
git_str *out = pi->buf;
|
213
219
|
int id_abbrev;
|
214
220
|
char code = git_diff_status_char(delta->status);
|
215
|
-
char start_oid[
|
221
|
+
char start_oid[GIT_OID_MAX_HEXSIZE + 1],
|
222
|
+
end_oid[GIT_OID_MAX_HEXSIZE + 1];
|
223
|
+
size_t oid_hexsize;
|
224
|
+
bool id_is_abbrev;
|
216
225
|
|
217
226
|
GIT_UNUSED(progress);
|
218
227
|
|
@@ -231,12 +240,21 @@ static int diff_print_one_raw(
|
|
231
240
|
return -1;
|
232
241
|
}
|
233
242
|
|
243
|
+
#ifdef GIT_EXPERIMENTAL_SHA256
|
244
|
+
GIT_ASSERT(delta->old_file.id.type == delta->new_file.id.type);
|
245
|
+
oid_hexsize = git_oid_hexsize(delta->old_file.id.type);
|
246
|
+
#else
|
247
|
+
oid_hexsize = GIT_OID_SHA1_HEXSIZE;
|
248
|
+
#endif
|
249
|
+
|
250
|
+
id_is_abbrev = (pi->id_strlen > 0 &&
|
251
|
+
(size_t)pi->id_strlen <= oid_hexsize);
|
252
|
+
|
234
253
|
git_oid_tostr(start_oid, pi->id_strlen + 1, &delta->old_file.id);
|
235
254
|
git_oid_tostr(end_oid, pi->id_strlen + 1, &delta->new_file.id);
|
236
255
|
|
237
|
-
git_str_printf(
|
238
|
-
|
239
|
-
":%06o %06o %s... %s... %c" : ":%06o %06o %s %s %c",
|
256
|
+
git_str_printf(out,
|
257
|
+
id_is_abbrev ? ":%06o %06o %s... %s... %c" : ":%06o %06o %s %s %c",
|
240
258
|
delta->old_file.mode, delta->new_file.mode, start_oid, end_oid, code);
|
241
259
|
|
242
260
|
if (delta->similarity > 0)
|
@@ -273,7 +291,8 @@ static int diff_print_oid_range(
|
|
273
291
|
git_str *out, const git_diff_delta *delta, int id_strlen,
|
274
292
|
bool print_index)
|
275
293
|
{
|
276
|
-
char start_oid[
|
294
|
+
char start_oid[GIT_OID_MAX_HEXSIZE + 1],
|
295
|
+
end_oid[GIT_OID_MAX_HEXSIZE + 1];
|
277
296
|
|
278
297
|
if (delta->old_file.mode &&
|
279
298
|
id_strlen > delta->old_file.id_abbrev) {
|
@@ -364,6 +364,7 @@ static int insert_delete_side_of_split(
|
|
364
364
|
memset(&deleted->new_file, 0, sizeof(deleted->new_file));
|
365
365
|
deleted->new_file.path = deleted->old_file.path;
|
366
366
|
deleted->new_file.flags |= GIT_DIFF_FLAG_VALID_ID;
|
367
|
+
git_oid_clear(&deleted->new_file.id, diff->opts.oid_type);
|
367
368
|
|
368
369
|
return git_vector_insert(onto, deleted);
|
369
370
|
}
|
@@ -397,6 +398,7 @@ static int apply_splits_and_deletes(
|
|
397
398
|
memset(&delta->old_file, 0, sizeof(delta->old_file));
|
398
399
|
delta->old_file.path = delta->new_file.path;
|
399
400
|
delta->old_file.flags |= GIT_DIFF_FLAG_VALID_ID;
|
401
|
+
git_oid_clear(&delta->old_file.id, diff->opts.oid_type);
|
400
402
|
}
|
401
403
|
|
402
404
|
/* clean up delta before inserting into new list */
|
@@ -995,6 +997,7 @@ find_best_matches:
|
|
995
997
|
memset(&src->new_file, 0, sizeof(src->new_file));
|
996
998
|
src->new_file.path = src->old_file.path;
|
997
999
|
src->new_file.flags |= GIT_DIFF_FLAG_VALID_ID;
|
1000
|
+
git_oid_clear(&src->new_file.id, diff->opts.oid_type);
|
998
1001
|
|
999
1002
|
num_updates++;
|
1000
1003
|
|
@@ -1020,6 +1023,7 @@ find_best_matches:
|
|
1020
1023
|
memset(&src->old_file, 0, sizeof(src->old_file));
|
1021
1024
|
src->old_file.path = src->new_file.path;
|
1022
1025
|
src->old_file.flags |= GIT_DIFF_FLAG_VALID_ID;
|
1026
|
+
git_oid_clear(&src->old_file.id, diff->opts.oid_type);
|
1023
1027
|
|
1024
1028
|
src->flags &= ~GIT_DIFF_FLAG__TO_SPLIT;
|
1025
1029
|
num_rewrites--;
|
@@ -130,11 +130,12 @@ static int append_header(
|
|
130
130
|
const git_signature *author,
|
131
131
|
git_email_create_options *opts)
|
132
132
|
{
|
133
|
-
char id[
|
133
|
+
char id[GIT_OID_MAX_HEXSIZE + 1];
|
134
134
|
int error;
|
135
135
|
|
136
|
-
|
137
|
-
|
136
|
+
git_oid_tostr(id, GIT_OID_MAX_HEXSIZE + 1, commit_id);
|
137
|
+
|
138
|
+
if ((error = git_str_printf(out, "From %s %s\n", id, EMAIL_TIMESTAMP)) < 0 ||
|
138
139
|
(error = git_str_printf(out, "From: %s <%s>\n", author->name, author->email)) < 0 ||
|
139
140
|
(error = append_date(out, &author->when)) < 0 ||
|
140
141
|
(error = append_subject(out, patch_idx, patch_count, summary, opts)) < 0)
|