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
@@ -41,8 +41,8 @@ include(SelectHTTPSBackend)
|
|
41
41
|
include(SelectHashes)
|
42
42
|
include(SelectHTTPParser)
|
43
43
|
include(SelectRegex)
|
44
|
+
include(SelectXdiff)
|
44
45
|
include(SelectSSH)
|
45
|
-
include(SelectWinHTTP)
|
46
46
|
include(SelectZlib)
|
47
47
|
|
48
48
|
#
|
@@ -58,20 +58,43 @@ add_feature_info(futimens GIT_USE_FUTIMENS "futimens support")
|
|
58
58
|
|
59
59
|
# qsort
|
60
60
|
|
61
|
-
|
62
|
-
|
63
|
-
|
61
|
+
# old-style FreeBSD qsort_r() has the 'context' parameter as the first argument
|
62
|
+
# of the comparison function:
|
63
|
+
check_prototype_definition_safe(qsort_r
|
64
|
+
"void (qsort_r)(void *base, size_t nmemb, size_t size, void *context, int (*compar)(void *, const void *, const void *))"
|
65
|
+
"" "stdlib.h" GIT_QSORT_BSD)
|
66
|
+
|
67
|
+
# GNU or POSIX qsort_r() has the 'context' parameter as the last argument of the
|
68
|
+
# comparison function:
|
69
|
+
check_prototype_definition_safe(qsort_r
|
70
|
+
"void (qsort_r)(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *, void *), void *context)"
|
71
|
+
"" "stdlib.h" GIT_QSORT_GNU)
|
72
|
+
|
73
|
+
# C11 qsort_s() has the 'context' parameter as the last argument of the
|
74
|
+
# comparison function, and returns an error status:
|
75
|
+
check_prototype_definition_safe(qsort_s
|
76
|
+
"errno_t (qsort_s)(void *base, rsize_t nmemb, rsize_t size, int (*compar)(const void *, const void *, void *), void *context)"
|
77
|
+
"0" "stdlib.h" GIT_QSORT_C11)
|
78
|
+
|
79
|
+
# MSC qsort_s() has the 'context' parameter as the first argument of the
|
80
|
+
# comparison function, and as the last argument of qsort_s():
|
81
|
+
check_prototype_definition_safe(qsort_s
|
82
|
+
"void (qsort_s)(void *base, size_t num, size_t width, int (*compare )(void *, const void *, const void *), void *context)"
|
83
|
+
"" "stdlib.h" GIT_QSORT_MSC)
|
64
84
|
|
65
|
-
|
66
|
-
"void qsort_r(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *, void *), void *arg)"
|
67
|
-
"" "stdlib.h" GIT_QSORT_R_GNU)
|
85
|
+
# random / entropy data
|
68
86
|
|
69
|
-
|
87
|
+
check_symbol_exists(getentropy unistd.h GIT_RAND_GETENTROPY)
|
88
|
+
check_symbol_exists(getloadavg stdlib.h GIT_RAND_GETLOADAVG)
|
70
89
|
|
71
|
-
#
|
90
|
+
# poll
|
72
91
|
|
73
|
-
|
74
|
-
|
92
|
+
if(WIN32)
|
93
|
+
set(GIT_IO_WSAPOLL 1)
|
94
|
+
else()
|
95
|
+
check_symbol_exists(poll poll.h GIT_IO_POLL)
|
96
|
+
check_symbol_exists(select sys/select.h GIT_IO_SELECT)
|
97
|
+
endif()
|
75
98
|
|
76
99
|
# determine architecture of the machine
|
77
100
|
|
@@ -170,12 +193,6 @@ if(ICONV_FOUND)
|
|
170
193
|
endif()
|
171
194
|
add_feature_info(iconv GIT_USE_ICONV "iconv encoding conversion support")
|
172
195
|
|
173
|
-
#
|
174
|
-
# Configure support
|
175
|
-
#
|
176
|
-
|
177
|
-
configure_file(features.h.in git2/sys/features.h)
|
178
|
-
|
179
196
|
#
|
180
197
|
# Include child projects
|
181
198
|
#
|
@@ -1,8 +1,10 @@
|
|
1
1
|
set(CLI_INCLUDES
|
2
|
-
"${libgit2_BINARY_DIR}/src"
|
2
|
+
"${libgit2_BINARY_DIR}/src/util"
|
3
|
+
"${libgit2_BINARY_DIR}/include"
|
3
4
|
"${libgit2_SOURCE_DIR}/src/util"
|
4
5
|
"${libgit2_SOURCE_DIR}/src/cli"
|
5
|
-
"${libgit2_SOURCE_DIR}/include"
|
6
|
+
"${libgit2_SOURCE_DIR}/include"
|
7
|
+
"${LIBGIT2_DEPENDENCY_INCLUDES}")
|
6
8
|
|
7
9
|
if(WIN32 AND NOT CYGWIN)
|
8
10
|
file(GLOB CLI_SRC_OS win32/*.c)
|
@@ -39,6 +41,7 @@ target_link_libraries(git2_cli ${CLI_LIBGIT2_LIBRARY} ${LIBGIT2_SYSTEM_LIBS})
|
|
39
41
|
|
40
42
|
set_target_properties(git2_cli PROPERTIES C_STANDARD 90)
|
41
43
|
set_target_properties(git2_cli PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${libgit2_BINARY_DIR})
|
44
|
+
set_target_properties(git2_cli PROPERTIES OUTPUT_NAME ${LIBGIT2_FILENAME})
|
42
45
|
|
43
46
|
ide_split_sources(git2_cli)
|
44
47
|
|
@@ -18,7 +18,7 @@
|
|
18
18
|
|
19
19
|
#define COMMAND_NAME "clone"
|
20
20
|
|
21
|
-
static char *branch, *remote_path, *local_path;
|
21
|
+
static char *branch, *remote_path, *local_path, *depth;
|
22
22
|
static int show_help, quiet, checkout = 1, bare;
|
23
23
|
static bool local_path_exists;
|
24
24
|
static cli_progress progress = CLI_PROGRESS_INIT;
|
@@ -36,6 +36,8 @@ static const cli_opt_spec opts[] = {
|
|
36
36
|
CLI_OPT_USAGE_DEFAULT, NULL, "don't create a working directory" },
|
37
37
|
{ CLI_OPT_TYPE_VALUE, "branch", 'b', &branch, 0,
|
38
38
|
CLI_OPT_USAGE_DEFAULT, "name", "branch to check out" },
|
39
|
+
{ CLI_OPT_TYPE_VALUE, "depth", 0, &depth, 0,
|
40
|
+
CLI_OPT_USAGE_DEFAULT, "depth", "commit depth to check out " },
|
39
41
|
{ CLI_OPT_TYPE_LITERAL },
|
40
42
|
{ CLI_OPT_TYPE_ARG, "repository", 0, &remote_path, 0,
|
41
43
|
CLI_OPT_USAGE_REQUIRED, "repository", "repository path" },
|
@@ -71,6 +73,22 @@ static char *compute_local_path(const char *orig_path)
|
|
71
73
|
return local_path;
|
72
74
|
}
|
73
75
|
|
76
|
+
static int compute_depth(const char *depth)
|
77
|
+
{
|
78
|
+
int64_t i;
|
79
|
+
const char *endptr;
|
80
|
+
|
81
|
+
if (!depth)
|
82
|
+
return 0;
|
83
|
+
|
84
|
+
if (git__strntol64(&i, depth, strlen(depth), &endptr, 10) < 0 || i < 0 || i > INT_MAX || *endptr) {
|
85
|
+
fprintf(stderr, "fatal: depth '%s' is not valid.\n", depth);
|
86
|
+
exit(128);
|
87
|
+
}
|
88
|
+
|
89
|
+
return (int)i;
|
90
|
+
}
|
91
|
+
|
74
92
|
static bool validate_local_path(const char *path)
|
75
93
|
{
|
76
94
|
if (!git_fs_path_exists(path))
|
@@ -127,11 +145,9 @@ int cmd_clone(int argc, char **argv)
|
|
127
145
|
goto done;
|
128
146
|
}
|
129
147
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
if (branch)
|
134
|
-
clone_opts.checkout_branch = branch;
|
148
|
+
clone_opts.bare = !!bare;
|
149
|
+
clone_opts.checkout_branch = branch;
|
150
|
+
clone_opts.fetch_opts.depth = compute_depth(depth);
|
135
151
|
|
136
152
|
if (!checkout)
|
137
153
|
clone_opts.checkout_opts.checkout_strategy = GIT_CHECKOUT_NONE;
|
@@ -49,23 +49,39 @@ static void print_help(void)
|
|
49
49
|
cli_opt_help_fprint(stdout, opts);
|
50
50
|
}
|
51
51
|
|
52
|
-
static int hash_buf(
|
52
|
+
static int hash_buf(
|
53
|
+
git_odb *odb,
|
54
|
+
git_str *buf,
|
55
|
+
git_object_t object_type,
|
56
|
+
git_oid_t oid_type)
|
53
57
|
{
|
54
58
|
git_oid oid;
|
55
59
|
|
56
60
|
if (!literally) {
|
57
61
|
int valid = 0;
|
58
62
|
|
59
|
-
|
63
|
+
#ifdef GIT_EXPERIMENTAL_SHA256
|
64
|
+
if (git_object_rawcontent_is_valid(&valid, buf->ptr, buf->size, object_type, oid_type) < 0 || !valid)
|
60
65
|
return cli_error_git();
|
66
|
+
#else
|
67
|
+
GIT_UNUSED(oid_type);
|
68
|
+
|
69
|
+
if (git_object_rawcontent_is_valid(&valid, buf->ptr, buf->size, object_type) < 0 || !valid)
|
70
|
+
return cli_error_git();
|
71
|
+
#endif
|
61
72
|
}
|
62
73
|
|
63
74
|
if (write_object) {
|
64
|
-
if (git_odb_write(&oid, odb, buf->ptr, buf->size,
|
75
|
+
if (git_odb_write(&oid, odb, buf->ptr, buf->size, object_type) < 0)
|
65
76
|
return cli_error_git();
|
66
77
|
} else {
|
67
|
-
|
78
|
+
#ifdef GIT_EXPERIMENTAL_SHA256
|
79
|
+
if (git_odb_hash(&oid, buf->ptr, buf->size, object_type, GIT_OID_SHA1) < 0)
|
68
80
|
return cli_error_git();
|
81
|
+
#else
|
82
|
+
if (git_odb_hash(&oid, buf->ptr, buf->size, object_type) < 0)
|
83
|
+
return cli_error_git();
|
84
|
+
#endif
|
69
85
|
}
|
70
86
|
|
71
87
|
if (printf("%s\n", git_oid_tostr_s(&oid)) < 0)
|
@@ -78,9 +94,10 @@ int cmd_hash_object(int argc, char **argv)
|
|
78
94
|
{
|
79
95
|
git_repository *repo = NULL;
|
80
96
|
git_odb *odb = NULL;
|
97
|
+
git_oid_t oid_type;
|
81
98
|
git_str buf = GIT_STR_INIT;
|
82
99
|
cli_opt invalid_opt;
|
83
|
-
git_object_t
|
100
|
+
git_object_t object_type = GIT_OBJECT_BLOB;
|
84
101
|
char **filename;
|
85
102
|
int ret = 0;
|
86
103
|
|
@@ -92,7 +109,7 @@ int cmd_hash_object(int argc, char **argv)
|
|
92
109
|
return 0;
|
93
110
|
}
|
94
111
|
|
95
|
-
if (type_name && (
|
112
|
+
if (type_name && (object_type = git_object_string2type(type_name)) == GIT_OBJECT_INVALID)
|
96
113
|
return cli_error_usage("invalid object type '%s'", type_name);
|
97
114
|
|
98
115
|
if (write_object &&
|
@@ -102,6 +119,8 @@ int cmd_hash_object(int argc, char **argv)
|
|
102
119
|
goto done;
|
103
120
|
}
|
104
121
|
|
122
|
+
oid_type = git_repository_oid_type(repo);
|
123
|
+
|
105
124
|
/*
|
106
125
|
* TODO: we're reading blobs, we shouldn't pull them all into main
|
107
126
|
* memory, we should just stream them into the odb instead.
|
@@ -113,7 +132,7 @@ int cmd_hash_object(int argc, char **argv)
|
|
113
132
|
goto done;
|
114
133
|
}
|
115
134
|
|
116
|
-
if ((ret = hash_buf(odb, &buf,
|
135
|
+
if ((ret = hash_buf(odb, &buf, object_type, oid_type)) != 0)
|
117
136
|
goto done;
|
118
137
|
} else {
|
119
138
|
for (filename = filenames; *filename; filename++) {
|
@@ -122,7 +141,7 @@ int cmd_hash_object(int argc, char **argv)
|
|
122
141
|
goto done;
|
123
142
|
}
|
124
143
|
|
125
|
-
if ((ret = hash_buf(odb, &buf,
|
144
|
+
if ((ret = hash_buf(odb, &buf, object_type, oid_type)) != 0)
|
126
145
|
goto done;
|
127
146
|
}
|
128
147
|
}
|
@@ -15,10 +15,10 @@
|
|
15
15
|
/*
|
16
16
|
* Show updates to the percentage and number of objects received
|
17
17
|
* separately from the throughput to give an accurate progress while
|
18
|
-
* avoiding too much noise on the screen.
|
18
|
+
* avoiding too much noise on the screen. (In milliseconds.)
|
19
19
|
*/
|
20
|
-
#define PROGRESS_UPDATE_TIME
|
21
|
-
#define THROUGHPUT_UPDATE_TIME
|
20
|
+
#define PROGRESS_UPDATE_TIME 60
|
21
|
+
#define THROUGHPUT_UPDATE_TIME 500
|
22
22
|
|
23
23
|
#define is_nl(c) ((c) == '\r' || (c) == '\n')
|
24
24
|
|
@@ -54,7 +54,7 @@ static int progress_write(cli_progress *progress, bool force, git_str *line)
|
|
54
54
|
bool has_nl;
|
55
55
|
size_t no_nl = no_nl_len(line->ptr, line->size);
|
56
56
|
size_t nl = nl_len(&has_nl, line->ptr + no_nl, line->size - no_nl);
|
57
|
-
|
57
|
+
uint64_t now = git_time_monotonic();
|
58
58
|
size_t i;
|
59
59
|
|
60
60
|
/* Avoid spamming the console with progress updates */
|
@@ -191,20 +191,21 @@ static int fetch_receiving(
|
|
191
191
|
{
|
192
192
|
char *recv_units[] = { "B", "KiB", "MiB", "GiB", "TiB", NULL };
|
193
193
|
char *rate_units[] = { "B/s", "KiB/s", "MiB/s", "GiB/s", "TiB/s", NULL };
|
194
|
+
uint64_t now, elapsed;
|
194
195
|
|
195
|
-
double
|
196
|
+
double recv_len, rate;
|
196
197
|
size_t recv_unit_idx = 0, rate_unit_idx = 0;
|
197
198
|
bool done = (stats->received_objects == stats->total_objects);
|
198
199
|
|
199
200
|
if (!progress->action_start)
|
200
|
-
progress->action_start =
|
201
|
+
progress->action_start = git_time_monotonic();
|
201
202
|
|
202
203
|
if (done && progress->action_finish)
|
203
204
|
now = progress->action_finish;
|
204
205
|
else if (done)
|
205
|
-
progress->action_finish = now =
|
206
|
+
progress->action_finish = now = git_time_monotonic();
|
206
207
|
else
|
207
|
-
now =
|
208
|
+
now = git_time_monotonic();
|
208
209
|
|
209
210
|
if (progress->throughput_update &&
|
210
211
|
now - progress->throughput_update < THROUGHPUT_UPDATE_TIME) {
|
@@ -30,11 +30,11 @@ typedef struct {
|
|
30
30
|
cli_progress_t action;
|
31
31
|
|
32
32
|
/* Actions may time themselves (eg fetch) but are not required to */
|
33
|
-
|
34
|
-
|
33
|
+
uint64_t action_start;
|
34
|
+
uint64_t action_finish;
|
35
35
|
|
36
36
|
/* Last console update, avoid too frequent updates. */
|
37
|
-
|
37
|
+
uint64_t last_update;
|
38
38
|
|
39
39
|
/* Accumulators for partial output and deferred updates. */
|
40
40
|
git_str sideband;
|
@@ -42,7 +42,7 @@ typedef struct {
|
|
42
42
|
git_str deferred;
|
43
43
|
|
44
44
|
/* Last update about throughput */
|
45
|
-
|
45
|
+
uint64_t throughput_update;
|
46
46
|
double throughput_bytes;
|
47
47
|
} cli_progress;
|
48
48
|
|
@@ -8,21 +8,12 @@ set_target_properties(libgit2 PROPERTIES C_EXTENSIONS OFF)
|
|
8
8
|
include(PkgBuildConfig)
|
9
9
|
|
10
10
|
set(LIBGIT2_INCLUDES
|
11
|
-
"${PROJECT_BINARY_DIR}/src"
|
11
|
+
"${PROJECT_BINARY_DIR}/src/util"
|
12
|
+
"${PROJECT_BINARY_DIR}/include"
|
12
13
|
"${PROJECT_SOURCE_DIR}/src/libgit2"
|
13
14
|
"${PROJECT_SOURCE_DIR}/src/util"
|
14
15
|
"${PROJECT_SOURCE_DIR}/include")
|
15
16
|
|
16
|
-
if(WIN32 AND EMBED_SSH_PATH)
|
17
|
-
file(GLOB SRC_SSH "${EMBED_SSH_PATH}/src/*.c")
|
18
|
-
list(SORT SRC_SSH)
|
19
|
-
target_sources(libgit2 PRIVATE ${SRC_SSH})
|
20
|
-
|
21
|
-
list(APPEND LIBGIT2_SYSTEM_INCLUDES "${EMBED_SSH_PATH}/include")
|
22
|
-
file(WRITE "${EMBED_SSH_PATH}/src/libssh2_config.h" "#define HAVE_WINCNG\n#define LIBSSH2_WINCNG\n#include \"../win32/libssh2_config.h\"")
|
23
|
-
set(GIT_SSH 1)
|
24
|
-
endif()
|
25
|
-
|
26
17
|
# Collect sourcefiles
|
27
18
|
file(GLOB SRC_H
|
28
19
|
"${PROJECT_SOURCE_DIR}/include/git2.h"
|
@@ -33,8 +24,7 @@ target_sources(libgit2 PRIVATE ${SRC_H})
|
|
33
24
|
|
34
25
|
file(GLOB SRC_GIT2 *.c *.h
|
35
26
|
streams/*.c streams/*.h
|
36
|
-
transports/*.c transports/*.h
|
37
|
-
xdiff/*.c xdiff/*.h)
|
27
|
+
transports/*.c transports/*.h)
|
38
28
|
list(SORT SRC_GIT2)
|
39
29
|
target_sources(libgit2 PRIVATE ${SRC_GIT2})
|
40
30
|
|
@@ -48,25 +38,9 @@ if(APPLE)
|
|
48
38
|
set_source_files_properties(streams/stransport.c PROPERTIES COMPILE_FLAGS -Wno-deprecated)
|
49
39
|
endif()
|
50
40
|
|
51
|
-
# the xdiff dependency is not (yet) warning-free, disable warnings
|
52
|
-
# as errors for the xdiff sources until we've sorted them out
|
53
|
-
if(MSVC)
|
54
|
-
set_source_files_properties(xdiff/xdiffi.c PROPERTIES COMPILE_FLAGS -WX-)
|
55
|
-
set_source_files_properties(xdiff/xemit.c PROPERTIES COMPILE_FLAGS -WX-)
|
56
|
-
set_source_files_properties(xdiff/xhistogram.c PROPERTIES COMPILE_FLAGS -WX-)
|
57
|
-
set_source_files_properties(xdiff/xmerge.c PROPERTIES COMPILE_FLAGS -WX-)
|
58
|
-
set_source_files_properties(xdiff/xutils.c PROPERTIES COMPILE_FLAGS -WX-)
|
59
|
-
set_source_files_properties(xdiff/xpatience.c PROPERTIES COMPILE_FLAGS -WX-)
|
60
|
-
else()
|
61
|
-
set_source_files_properties(xdiff/xdiffi.c PROPERTIES COMPILE_FLAGS "-Wno-sign-compare -Wno-unused-parameter")
|
62
|
-
set_source_files_properties(xdiff/xemit.c PROPERTIES COMPILE_FLAGS "-Wno-sign-compare -Wno-unused-parameter")
|
63
|
-
set_source_files_properties(xdiff/xhistogram.c PROPERTIES COMPILE_FLAGS "-Wno-sign-compare")
|
64
|
-
set_source_files_properties(xdiff/xutils.c PROPERTIES COMPILE_FLAGS "-Wno-sign-compare")
|
65
|
-
set_source_files_properties(xdiff/xpatience.c PROPERTIES COMPILE_FLAGS "-Wno-sign-compare")
|
66
|
-
endif()
|
67
|
-
|
68
41
|
ide_split_sources(libgit2)
|
69
42
|
list(APPEND LIBGIT2_OBJECTS $<TARGET_OBJECTS:util> $<TARGET_OBJECTS:libgit2> ${LIBGIT2_DEPENDENCY_OBJECTS})
|
43
|
+
list(APPEND LIBGIT2_INCLUDES ${LIBGIT2_DEPENDENCY_INCLUDES})
|
70
44
|
|
71
45
|
target_include_directories(libgit2 PRIVATE ${LIBGIT2_INCLUDES} ${LIBGIT2_DEPENDENCY_INCLUDES} PUBLIC ${PROJECT_SOURCE_DIR}/include)
|
72
46
|
target_include_directories(libgit2 SYSTEM PRIVATE ${LIBGIT2_SYSTEM_INCLUDES})
|
@@ -84,6 +58,7 @@ set(LIBGIT2_SYSTEM_LIBS ${LIBGIT2_SYSTEM_LIBS} PARENT_SCOPE)
|
|
84
58
|
|
85
59
|
add_library(libgit2package ${SRC_RC} ${LIBGIT2_OBJECTS})
|
86
60
|
target_link_libraries(libgit2package ${LIBGIT2_SYSTEM_LIBS})
|
61
|
+
target_include_directories(libgit2package SYSTEM PRIVATE ${LIBGIT2_INCLUDES})
|
87
62
|
|
88
63
|
set_target_properties(libgit2package PROPERTIES C_STANDARD 90)
|
89
64
|
set_target_properties(libgit2package PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
|
@@ -109,10 +84,10 @@ if(SONAME)
|
|
109
84
|
endif()
|
110
85
|
endif()
|
111
86
|
|
112
|
-
pkg_build_config(NAME
|
87
|
+
pkg_build_config(NAME "lib${LIBGIT2_FILENAME}"
|
113
88
|
VERSION ${libgit2_VERSION}
|
114
89
|
DESCRIPTION "The git library, take 2"
|
115
|
-
LIBS_SELF
|
90
|
+
LIBS_SELF ${LIBGIT2_FILENAME}
|
116
91
|
PRIVATE_LIBS ${LIBGIT2_PC_LIBS}
|
117
92
|
REQUIRES ${LIBGIT2_PC_REQUIRES})
|
118
93
|
|
@@ -122,10 +97,26 @@ if(MSVC_IDE)
|
|
122
97
|
set_source_files_properties(win32/precompiled.c COMPILE_FLAGS "/Ycprecompiled.h")
|
123
98
|
endif()
|
124
99
|
|
100
|
+
# support experimental features and functionality
|
101
|
+
|
102
|
+
configure_file(experimental.h.in "${PROJECT_BINARY_DIR}/include/git2/experimental.h")
|
103
|
+
|
104
|
+
# translate filenames in the git2.h so that they match the install directory
|
105
|
+
# (allows for side-by-side installs of libgit2 and libgit2-experimental.)
|
106
|
+
|
107
|
+
FILE(READ "${PROJECT_SOURCE_DIR}/include/git2.h" LIBGIT2_INCLUDE)
|
108
|
+
STRING(REGEX REPLACE "#include \"git2\/" "#include \"${LIBGIT2_FILENAME}/" LIBGIT2_INCLUDE "${LIBGIT2_INCLUDE}")
|
109
|
+
FILE(WRITE "${PROJECT_BINARY_DIR}/include/${LIBGIT2_FILENAME}.h" ${LIBGIT2_INCLUDE})
|
110
|
+
|
125
111
|
# Install
|
112
|
+
|
126
113
|
install(TARGETS libgit2package
|
127
114
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
128
115
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
129
116
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
130
|
-
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/git2
|
131
|
-
|
117
|
+
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/git2/
|
118
|
+
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBGIT2_FILENAME}")
|
119
|
+
install(FILES ${PROJECT_BINARY_DIR}/include/git2/experimental.h
|
120
|
+
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBGIT2_FILENAME}")
|
121
|
+
install(FILES "${PROJECT_BINARY_DIR}/include/${LIBGIT2_FILENAME}.h"
|
122
|
+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
@@ -39,8 +39,8 @@ static int annotated_commit_init(
|
|
39
39
|
if ((error = git_commit_dup(&annotated_commit->commit, commit)) < 0)
|
40
40
|
goto done;
|
41
41
|
|
42
|
-
|
43
|
-
|
42
|
+
git_oid_tostr(annotated_commit->id_str, GIT_OID_MAX_HEXSIZE + 1,
|
43
|
+
git_commit_id(commit));
|
44
44
|
|
45
45
|
if (!description)
|
46
46
|
description = annotated_commit->id_str;
|
@@ -19,6 +19,7 @@
|
|
19
19
|
#include "zstream.h"
|
20
20
|
#include "reader.h"
|
21
21
|
#include "index.h"
|
22
|
+
#include "repository.h"
|
22
23
|
#include "apply.h"
|
23
24
|
|
24
25
|
typedef struct {
|
@@ -644,7 +645,7 @@ int git_apply_to_tree(
|
|
644
645
|
* put the current tree into the postimage as-is - the diff will
|
645
646
|
* replace any entries contained therein
|
646
647
|
*/
|
647
|
-
if ((error =
|
648
|
+
if ((error = git_index__new(&postimage, repo->oid_type)) < 0 ||
|
648
649
|
(error = git_index_read_tree(postimage, preimage)) < 0 ||
|
649
650
|
(error = git_reader_for_index(&post_reader, repo, postimage)) < 0)
|
650
651
|
goto done;
|
@@ -851,8 +852,8 @@ int git_apply(
|
|
851
852
|
* having the full repo index, so we will limit our checkout
|
852
853
|
* to only write these files that were affected by the diff.
|
853
854
|
*/
|
854
|
-
if ((error =
|
855
|
-
(error =
|
855
|
+
if ((error = git_index__new(&preimage, repo->oid_type)) < 0 ||
|
856
|
+
(error = git_index__new(&postimage, repo->oid_type)) < 0 ||
|
856
857
|
(error = git_reader_for_index(&post_reader, repo, postimage)) < 0)
|
857
858
|
goto done;
|
858
859
|
|
@@ -135,7 +135,7 @@ int git_attr_file__load(
|
|
135
135
|
break;
|
136
136
|
case GIT_ATTR_FILE_SOURCE_INDEX: {
|
137
137
|
if ((error = attr_file_oid_from_index(&id, repo, entry->path)) < 0 ||
|
138
|
-
|
138
|
+
(error = git_blob_lookup(&blob, repo, &id)) < 0)
|
139
139
|
return error;
|
140
140
|
|
141
141
|
/* Do not assume that data straight from the ODB is NULL-terminated;
|
@@ -300,7 +300,7 @@ static int attr_cache__lookup_path(
|
|
300
300
|
|
301
301
|
/* expand leading ~/ as needed */
|
302
302
|
if (cfgval && cfgval[0] == '~' && cfgval[1] == '/') {
|
303
|
-
if (! (error =
|
303
|
+
if (! (error = git_sysdir_expand_homedir_file(&buf, &cfgval[2])))
|
304
304
|
*out = git_str_detach(&buf);
|
305
305
|
} else if (cfgval) {
|
306
306
|
*out = git__strdup(cfgval);
|
@@ -60,10 +60,11 @@ static bool hunk_starts_at_or_after_line(git_blame_hunk *hunk, size_t line)
|
|
60
60
|
}
|
61
61
|
|
62
62
|
static git_blame_hunk *new_hunk(
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
63
|
+
size_t start,
|
64
|
+
size_t lines,
|
65
|
+
size_t orig_start,
|
66
|
+
const char *path,
|
67
|
+
git_blame *blame)
|
67
68
|
{
|
68
69
|
git_blame_hunk *hunk = git__calloc(1, sizeof(git_blame_hunk));
|
69
70
|
if (!hunk) return NULL;
|
@@ -72,6 +73,8 @@ static git_blame_hunk *new_hunk(
|
|
72
73
|
hunk->final_start_line_number = start;
|
73
74
|
hunk->orig_start_line_number = orig_start;
|
74
75
|
hunk->orig_path = path ? git__strdup(path) : NULL;
|
76
|
+
git_oid_clear(&hunk->orig_commit_id, blame->repository->oid_type);
|
77
|
+
git_oid_clear(&hunk->final_commit_id, blame->repository->oid_type);
|
75
78
|
|
76
79
|
return hunk;
|
77
80
|
}
|
@@ -84,13 +87,14 @@ static void free_hunk(git_blame_hunk *hunk)
|
|
84
87
|
git__free(hunk);
|
85
88
|
}
|
86
89
|
|
87
|
-
static git_blame_hunk *dup_hunk(git_blame_hunk *hunk)
|
90
|
+
static git_blame_hunk *dup_hunk(git_blame_hunk *hunk, git_blame *blame)
|
88
91
|
{
|
89
92
|
git_blame_hunk *newhunk = new_hunk(
|
90
93
|
hunk->final_start_line_number,
|
91
94
|
hunk->lines_in_hunk,
|
92
95
|
hunk->orig_start_line_number,
|
93
|
-
hunk->orig_path
|
96
|
+
hunk->orig_path,
|
97
|
+
blame);
|
94
98
|
|
95
99
|
if (!newhunk)
|
96
100
|
return NULL;
|
@@ -235,7 +239,8 @@ static git_blame_hunk *split_hunk_in_vector(
|
|
235
239
|
git_vector *vec,
|
236
240
|
git_blame_hunk *hunk,
|
237
241
|
size_t rel_line,
|
238
|
-
bool return_new
|
242
|
+
bool return_new,
|
243
|
+
git_blame *blame)
|
239
244
|
{
|
240
245
|
size_t new_line_count;
|
241
246
|
git_blame_hunk *nh;
|
@@ -248,8 +253,9 @@ static git_blame_hunk *split_hunk_in_vector(
|
|
248
253
|
}
|
249
254
|
|
250
255
|
new_line_count = hunk->lines_in_hunk - rel_line;
|
251
|
-
nh = new_hunk(hunk->final_start_line_number + rel_line,
|
252
|
-
|
256
|
+
nh = new_hunk(hunk->final_start_line_number + rel_line,
|
257
|
+
new_line_count, hunk->orig_start_line_number + rel_line,
|
258
|
+
hunk->orig_path, blame);
|
253
259
|
|
254
260
|
if (!nh)
|
255
261
|
return NULL;
|
@@ -302,7 +308,8 @@ static int index_blob_lines(git_blame *blame)
|
|
302
308
|
static git_blame_hunk *hunk_from_entry(git_blame__entry *e, git_blame *blame)
|
303
309
|
{
|
304
310
|
git_blame_hunk *h = new_hunk(
|
305
|
-
|
311
|
+
e->lno+1, e->num_lines, e->s_lno+1, e->suspect->path,
|
312
|
+
blame);
|
306
313
|
|
307
314
|
if (!h)
|
308
315
|
return NULL;
|
@@ -443,14 +450,16 @@ static int buffer_hunk_cb(
|
|
443
450
|
blame->current_hunk = (git_blame_hunk*)git_blame_get_hunk_byline(blame, wedge_line);
|
444
451
|
if (!blame->current_hunk) {
|
445
452
|
/* Line added at the end of the file */
|
446
|
-
blame->current_hunk = new_hunk(wedge_line, 0, wedge_line,
|
453
|
+
blame->current_hunk = new_hunk(wedge_line, 0, wedge_line,
|
454
|
+
blame->path, blame);
|
447
455
|
GIT_ERROR_CHECK_ALLOC(blame->current_hunk);
|
448
456
|
|
449
457
|
git_vector_insert(&blame->hunks, blame->current_hunk);
|
450
458
|
} else if (!hunk_starts_at_or_after_line(blame->current_hunk, wedge_line)){
|
451
459
|
/* If this hunk doesn't start between existing hunks, split a hunk up so it does */
|
452
460
|
blame->current_hunk = split_hunk_in_vector(&blame->hunks, blame->current_hunk,
|
453
|
-
wedge_line - blame->current_hunk->orig_start_line_number, true
|
461
|
+
wedge_line - blame->current_hunk->orig_start_line_number, true,
|
462
|
+
blame);
|
454
463
|
GIT_ERROR_CHECK_ALLOC(blame->current_hunk);
|
455
464
|
}
|
456
465
|
|
@@ -479,7 +488,7 @@ static int buffer_line_cb(
|
|
479
488
|
} else {
|
480
489
|
/* Create a new buffer-blame hunk with this line */
|
481
490
|
shift_hunks_by(&blame->hunks, blame->current_diff_line, 1);
|
482
|
-
blame->current_hunk = new_hunk(blame->current_diff_line, 1, 0, blame->path);
|
491
|
+
blame->current_hunk = new_hunk(blame->current_diff_line, 1, 0, blame->path, blame);
|
483
492
|
GIT_ERROR_CHECK_ALLOC(blame->current_hunk);
|
484
493
|
|
485
494
|
git_vector_insert_sorted(&blame->hunks, blame->current_hunk, NULL);
|
@@ -527,7 +536,7 @@ int git_blame_buffer(
|
|
527
536
|
|
528
537
|
/* Duplicate all of the hunk structures in the reference blame */
|
529
538
|
git_vector_foreach(&reference->hunks, i, hunk) {
|
530
|
-
git_blame_hunk *h = dup_hunk(hunk);
|
539
|
+
git_blame_hunk *h = dup_hunk(hunk, blame);
|
531
540
|
GIT_ERROR_CHECK_ALLOC(h);
|
532
541
|
|
533
542
|
git_vector_insert(&blame->hunks, h);
|
@@ -52,11 +52,12 @@ void git_blob__free(void *_blob)
|
|
52
52
|
git__free(blob);
|
53
53
|
}
|
54
54
|
|
55
|
-
int git_blob__parse_raw(void *_blob, const char *data, size_t size)
|
55
|
+
int git_blob__parse_raw(void *_blob, const char *data, size_t size, git_oid_t oid_type)
|
56
56
|
{
|
57
57
|
git_blob *blob = (git_blob *) _blob;
|
58
58
|
|
59
59
|
GIT_ASSERT_ARG(blob);
|
60
|
+
GIT_UNUSED(oid_type);
|
60
61
|
|
61
62
|
blob->raw = 1;
|
62
63
|
blob->data.raw.data = data;
|
@@ -64,11 +65,12 @@ int git_blob__parse_raw(void *_blob, const char *data, size_t size)
|
|
64
65
|
return 0;
|
65
66
|
}
|
66
67
|
|
67
|
-
int git_blob__parse(void *_blob, git_odb_object *odb_obj)
|
68
|
+
int git_blob__parse(void *_blob, git_odb_object *odb_obj, git_oid_t oid_type)
|
68
69
|
{
|
69
70
|
git_blob *blob = (git_blob *) _blob;
|
70
71
|
|
71
72
|
GIT_ASSERT_ARG(blob);
|
73
|
+
GIT_UNUSED(oid_type);
|
72
74
|
|
73
75
|
git_cached_obj_incref((git_cached_obj *)odb_obj);
|
74
76
|
blob->raw = 0;
|
@@ -36,8 +36,8 @@ struct git_blob {
|
|
36
36
|
} while(0)
|
37
37
|
|
38
38
|
void git_blob__free(void *blob);
|
39
|
-
int git_blob__parse(void *blob, git_odb_object *obj);
|
40
|
-
int git_blob__parse_raw(void *blob, const char *data, size_t size);
|
39
|
+
int git_blob__parse(void *blob, git_odb_object *obj, git_oid_t oid_type);
|
40
|
+
int git_blob__parse_raw(void *blob, const char *data, size_t size, git_oid_t oid_type);
|
41
41
|
int git_blob__getbuf(git_str *buffer, git_blob *blob);
|
42
42
|
|
43
43
|
extern int git_blob__create_from_paths(
|