rugged 0.26.7 → 0.27.0
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/README.md +2 -2
- data/ext/rugged/rugged_blame.c +6 -3
- data/ext/rugged/rugged_branch_collection.c +3 -6
- data/ext/rugged/rugged_commit.c +56 -0
- data/ext/rugged/rugged_config.c +44 -9
- data/ext/rugged/rugged_diff.c +3 -14
- data/ext/rugged/rugged_diff_hunk.c +1 -3
- data/ext/rugged/rugged_index.c +1 -5
- data/ext/rugged/rugged_note.c +1 -4
- data/ext/rugged/rugged_patch.c +1 -4
- data/ext/rugged/rugged_reference_collection.c +1 -7
- data/ext/rugged/rugged_remote.c +5 -8
- data/ext/rugged/rugged_remote_collection.c +1 -6
- data/ext/rugged/rugged_repo.c +16 -48
- data/ext/rugged/rugged_revwalk.c +7 -16
- data/ext/rugged/rugged_settings.c +28 -0
- data/ext/rugged/rugged_submodule_collection.c +3 -4
- data/ext/rugged/rugged_tag_collection.c +1 -5
- data/ext/rugged/rugged_tree.c +2 -3
- data/lib/rugged/repository.rb +43 -0
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/AUTHORS +1 -0
- data/vendor/libgit2/CMakeLists.txt +61 -510
- data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +14 -0
- data/vendor/libgit2/cmake/Modules/FindCoreFoundation.cmake +25 -8
- data/vendor/libgit2/cmake/Modules/FindSecurity.cmake +27 -8
- data/vendor/libgit2/cmake/Modules/FindStatNsec.cmake +20 -0
- data/vendor/libgit2/cmake/Modules/IdeSplitSources.cmake +22 -0
- data/vendor/libgit2/deps/http-parser/CMakeLists.txt +3 -0
- data/vendor/libgit2/deps/regex/CMakeLists.txt +2 -0
- data/vendor/libgit2/deps/winhttp/CMakeLists.txt +26 -0
- data/vendor/libgit2/deps/zlib/CMakeLists.txt +4 -0
- data/vendor/libgit2/include/git2/config.h +29 -2
- data/vendor/libgit2/include/git2/describe.h +1 -1
- data/vendor/libgit2/include/git2/diff.h +59 -8
- data/vendor/libgit2/include/git2/graph.h +3 -0
- data/vendor/libgit2/include/git2/merge.h +6 -0
- data/vendor/libgit2/include/git2/message.h +43 -3
- data/vendor/libgit2/include/git2/notes.h +89 -0
- data/vendor/libgit2/include/git2/odb.h +8 -1
- data/vendor/libgit2/include/git2/patch.h +2 -2
- data/vendor/libgit2/include/git2/pathspec.h +35 -18
- data/vendor/libgit2/include/git2/refs.h +3 -0
- data/vendor/libgit2/include/git2/remote.h +34 -4
- data/vendor/libgit2/include/git2/repository.h +6 -6
- data/vendor/libgit2/include/git2/reset.h +4 -4
- data/vendor/libgit2/include/git2/status.h +4 -0
- data/vendor/libgit2/include/git2/sys/config.h +4 -1
- data/vendor/libgit2/include/git2/sys/odb_backend.h +2 -1
- data/vendor/libgit2/include/git2/tree.h +4 -3
- data/vendor/libgit2/include/git2/types.h +1 -0
- data/vendor/libgit2/include/git2/version.h +4 -4
- data/vendor/libgit2/include/git2/worktree.h +1 -1
- data/vendor/libgit2/src/CMakeLists.txt +463 -0
- data/vendor/libgit2/src/annotated_commit.c +1 -1
- data/vendor/libgit2/src/annotated_commit.h +2 -0
- data/vendor/libgit2/src/apply.c +2 -1
- data/vendor/libgit2/src/apply.h +2 -0
- data/vendor/libgit2/src/attr.c +24 -4
- data/vendor/libgit2/src/attr.h +2 -0
- data/vendor/libgit2/src/attr_file.c +9 -2
- data/vendor/libgit2/src/attr_file.h +2 -0
- data/vendor/libgit2/src/attrcache.c +9 -1
- data/vendor/libgit2/src/attrcache.h +2 -0
- data/vendor/libgit2/src/blame.c +1 -0
- data/vendor/libgit2/src/blame.h +2 -1
- data/vendor/libgit2/src/blame_git.c +1 -0
- data/vendor/libgit2/src/blame_git.h +2 -0
- data/vendor/libgit2/src/blob.c +2 -2
- data/vendor/libgit2/src/blob.h +2 -0
- data/vendor/libgit2/src/branch.c +8 -1
- data/vendor/libgit2/src/branch.h +2 -0
- data/vendor/libgit2/src/buf_text.c +7 -7
- data/vendor/libgit2/src/buf_text.h +3 -3
- data/vendor/libgit2/src/buffer.c +31 -1
- data/vendor/libgit2/src/buffer.h +3 -0
- data/vendor/libgit2/src/cache.c +2 -2
- data/vendor/libgit2/src/cache.h +2 -0
- data/vendor/libgit2/src/cc-compat.h +3 -3
- data/vendor/libgit2/src/checkout.c +30 -19
- data/vendor/libgit2/src/checkout.h +2 -0
- data/vendor/libgit2/src/cherrypick.c +1 -0
- data/vendor/libgit2/src/clone.c +2 -1
- data/vendor/libgit2/src/clone.h +4 -0
- data/vendor/libgit2/src/commit.c +2 -1
- data/vendor/libgit2/src/commit.h +2 -0
- data/vendor/libgit2/src/commit_list.c +1 -1
- data/vendor/libgit2/src/commit_list.h +2 -0
- data/vendor/libgit2/src/common.h +11 -5
- data/vendor/libgit2/src/config.c +12 -10
- data/vendor/libgit2/src/config.h +2 -0
- data/vendor/libgit2/src/config_cache.c +1 -0
- data/vendor/libgit2/src/config_file.c +287 -786
- data/vendor/libgit2/src/config_file.h +4 -3
- data/vendor/libgit2/src/config_parse.c +525 -0
- data/vendor/libgit2/src/config_parse.h +64 -0
- data/vendor/libgit2/src/crlf.c +2 -1
- data/vendor/libgit2/src/delta.c +28 -30
- data/vendor/libgit2/src/delta.h +1 -0
- data/vendor/libgit2/src/describe.c +3 -1
- data/vendor/libgit2/src/diff.c +148 -2
- data/vendor/libgit2/src/diff.h +3 -1
- data/vendor/libgit2/src/diff_driver.c +12 -9
- data/vendor/libgit2/src/diff_driver.h +4 -1
- data/vendor/libgit2/src/diff_file.c +7 -4
- data/vendor/libgit2/src/diff_file.h +1 -0
- data/vendor/libgit2/src/diff_generate.c +6 -3
- data/vendor/libgit2/src/diff_generate.h +6 -1
- data/vendor/libgit2/src/diff_parse.c +5 -4
- data/vendor/libgit2/src/diff_parse.h +2 -0
- data/vendor/libgit2/src/diff_print.c +2 -0
- data/vendor/libgit2/src/diff_stats.c +2 -0
- data/vendor/libgit2/src/diff_tform.c +2 -1
- data/vendor/libgit2/src/diff_tform.h +4 -1
- data/vendor/libgit2/src/diff_xdiff.c +5 -2
- data/vendor/libgit2/src/diff_xdiff.h +2 -0
- data/vendor/libgit2/src/errors.c +2 -0
- data/vendor/libgit2/src/features.h.in +36 -0
- data/vendor/libgit2/src/fetch.c +2 -2
- data/vendor/libgit2/src/fetch.h +4 -0
- data/vendor/libgit2/src/fetchhead.c +3 -3
- data/vendor/libgit2/src/fetchhead.h +3 -0
- data/vendor/libgit2/src/filebuf.c +2 -1
- data/vendor/libgit2/src/filebuf.h +2 -0
- data/vendor/libgit2/src/fileops.c +12 -1
- data/vendor/libgit2/src/fileops.h +7 -1
- data/vendor/libgit2/src/filter.c +2 -1
- data/vendor/libgit2/src/filter.h +1 -0
- data/vendor/libgit2/src/fnmatch.c +2 -2
- data/vendor/libgit2/src/fnmatch.h +3 -4
- data/vendor/libgit2/src/global.c +4 -3
- data/vendor/libgit2/src/global.h +1 -5
- data/vendor/libgit2/src/graph.c +2 -0
- data/vendor/libgit2/src/hash.c +0 -1
- data/vendor/libgit2/src/hash.h +3 -1
- data/vendor/libgit2/src/hash/hash_collisiondetect.h +3 -3
- data/vendor/libgit2/src/hash/hash_common_crypto.h +18 -5
- data/vendor/libgit2/src/hash/hash_generic.c +2 -2
- data/vendor/libgit2/src/hash/hash_generic.h +5 -3
- data/vendor/libgit2/src/hash/hash_openssl.h +3 -3
- data/vendor/libgit2/src/hash/hash_win32.c +57 -14
- data/vendor/libgit2/src/hash/hash_win32.h +4 -3
- data/vendor/libgit2/src/hashsig.c +3 -0
- data/vendor/libgit2/src/ident.c +2 -0
- data/vendor/libgit2/src/idxmap.h +2 -1
- data/vendor/libgit2/src/ignore.c +14 -2
- data/vendor/libgit2/src/ignore.h +2 -0
- data/vendor/libgit2/src/index.c +20 -40
- data/vendor/libgit2/src/index.h +2 -0
- data/vendor/libgit2/src/indexer.c +13 -5
- data/vendor/libgit2/src/indexer.h +5 -1
- data/vendor/libgit2/src/integer.h +1 -1
- data/vendor/libgit2/src/iterator.c +44 -3
- data/vendor/libgit2/src/iterator.h +3 -0
- data/vendor/libgit2/src/map.h +1 -1
- data/vendor/libgit2/src/merge.c +155 -33
- data/vendor/libgit2/src/merge.h +2 -0
- data/vendor/libgit2/src/merge_driver.c +2 -2
- data/vendor/libgit2/src/merge_driver.h +2 -0
- data/vendor/libgit2/src/merge_file.c +3 -0
- data/vendor/libgit2/src/message.h +3 -1
- data/vendor/libgit2/src/mwindow.c +1 -1
- data/vendor/libgit2/src/mwindow.h +2 -0
- data/vendor/libgit2/src/netops.c +75 -62
- data/vendor/libgit2/src/netops.h +2 -1
- data/vendor/libgit2/src/notes.c +164 -48
- data/vendor/libgit2/src/notes.h +1 -1
- data/vendor/libgit2/src/object.c +14 -3
- data/vendor/libgit2/src/object.h +4 -0
- data/vendor/libgit2/src/object_api.c +3 -2
- data/vendor/libgit2/src/odb.c +104 -38
- data/vendor/libgit2/src/odb.h +3 -1
- data/vendor/libgit2/src/odb_loose.c +414 -267
- data/vendor/libgit2/src/odb_mempack.c +1 -0
- data/vendor/libgit2/src/odb_pack.c +2 -1
- data/vendor/libgit2/src/offmap.h +1 -0
- data/vendor/libgit2/src/oid.c +2 -1
- data/vendor/libgit2/src/oid.h +3 -8
- data/vendor/libgit2/src/oidarray.c +2 -1
- data/vendor/libgit2/src/oidarray.h +1 -0
- data/vendor/libgit2/src/oidmap.h +1 -0
- data/vendor/libgit2/src/pack-objects.c +5 -1
- data/vendor/libgit2/src/pack-objects.h +1 -1
- data/vendor/libgit2/src/pack.c +2 -6
- data/vendor/libgit2/src/pack.h +2 -1
- data/vendor/libgit2/src/parse.c +121 -0
- data/vendor/libgit2/src/parse.h +61 -0
- data/vendor/libgit2/src/patch.c +9 -2
- data/vendor/libgit2/src/patch.h +2 -0
- data/vendor/libgit2/src/patch_generate.c +6 -5
- data/vendor/libgit2/src/patch_generate.h +1 -0
- data/vendor/libgit2/src/patch_parse.c +265 -276
- data/vendor/libgit2/src/patch_parse.h +6 -11
- data/vendor/libgit2/src/path.c +24 -181
- data/vendor/libgit2/src/path.h +14 -73
- data/vendor/libgit2/src/pathspec.c +2 -1
- data/vendor/libgit2/src/pathspec.h +2 -1
- data/vendor/libgit2/src/pool.c +8 -0
- data/vendor/libgit2/src/pool.h +1 -0
- data/vendor/libgit2/src/posix.c +2 -1
- data/vendor/libgit2/src/posix.h +1 -0
- data/vendor/libgit2/src/pqueue.c +1 -0
- data/vendor/libgit2/src/pqueue.h +2 -0
- data/vendor/libgit2/src/proxy.c +2 -1
- data/vendor/libgit2/src/proxy.h +3 -1
- data/vendor/libgit2/src/push.c +4 -171
- data/vendor/libgit2/src/push.h +2 -0
- data/vendor/libgit2/src/rebase.c +1 -0
- data/vendor/libgit2/src/refdb.c +2 -3
- data/vendor/libgit2/src/refdb.h +2 -0
- data/vendor/libgit2/src/refdb_fs.c +5 -3
- data/vendor/libgit2/src/refdb_fs.h +4 -0
- data/vendor/libgit2/src/reflog.c +1 -0
- data/vendor/libgit2/src/reflog.h +2 -1
- data/vendor/libgit2/src/refs.c +1 -0
- data/vendor/libgit2/src/refs.h +2 -1
- data/vendor/libgit2/src/refspec.c +2 -2
- data/vendor/libgit2/src/refspec.h +2 -0
- data/vendor/libgit2/src/remote.c +56 -10
- data/vendor/libgit2/src/remote.h +2 -0
- data/vendor/libgit2/src/repository.c +16 -14
- data/vendor/libgit2/src/repository.h +2 -0
- data/vendor/libgit2/src/reset.c +6 -5
- data/vendor/libgit2/src/revert.c +1 -0
- data/vendor/libgit2/src/revparse.c +3 -5
- data/vendor/libgit2/src/revwalk.c +2 -2
- data/vendor/libgit2/src/revwalk.h +2 -0
- data/vendor/libgit2/src/settings.c +6 -8
- data/vendor/libgit2/src/sha1_lookup.c +2 -216
- data/vendor/libgit2/src/sha1_lookup.h +2 -6
- data/vendor/libgit2/src/signature.c +8 -3
- data/vendor/libgit2/src/signature.h +2 -0
- data/vendor/libgit2/src/sortedcache.c +7 -0
- data/vendor/libgit2/src/sortedcache.h +2 -0
- data/vendor/libgit2/src/stash.c +1 -0
- data/vendor/libgit2/src/status.c +14 -9
- data/vendor/libgit2/src/status.h +2 -0
- data/vendor/libgit2/src/{curl_stream.c → streams/curl.c} +2 -0
- data/vendor/libgit2/src/{curl_stream.h → streams/curl.h} +4 -2
- data/vendor/libgit2/src/{openssl_stream.c → streams/openssl.c} +47 -18
- data/vendor/libgit2/src/{openssl_stream.h → streams/openssl.h} +6 -2
- data/vendor/libgit2/src/{socket_stream.c → streams/socket.c} +2 -2
- data/vendor/libgit2/src/{socket_stream.h → streams/socket.h} +4 -2
- data/vendor/libgit2/src/{stransport_stream.c → streams/stransport.c} +4 -2
- data/vendor/libgit2/src/{stransport_stream.h → streams/stransport.h} +4 -2
- data/vendor/libgit2/src/{tls_stream.c → streams/tls.c} +4 -3
- data/vendor/libgit2/src/{tls_stream.h → streams/tls.h} +4 -2
- data/vendor/libgit2/src/submodule.c +28 -80
- data/vendor/libgit2/src/submodule.h +2 -13
- data/vendor/libgit2/src/sysdir.c +75 -8
- data/vendor/libgit2/src/sysdir.h +2 -1
- data/vendor/libgit2/src/tag.c +2 -2
- data/vendor/libgit2/src/tag.h +2 -0
- data/vendor/libgit2/src/thread-utils.c +1 -0
- data/vendor/libgit2/src/thread-utils.h +1 -1
- data/vendor/libgit2/src/trace.c +2 -2
- data/vendor/libgit2/src/trace.h +2 -0
- data/vendor/libgit2/src/trailer.c +416 -0
- data/vendor/libgit2/src/transaction.c +2 -1
- data/vendor/libgit2/src/transport.c +2 -0
- data/vendor/libgit2/src/transports/auth.c +2 -1
- data/vendor/libgit2/src/transports/auth.h +4 -3
- data/vendor/libgit2/src/transports/auth_negotiate.c +2 -1
- data/vendor/libgit2/src/transports/auth_negotiate.h +3 -3
- data/vendor/libgit2/src/transports/cred.c +2 -0
- data/vendor/libgit2/src/transports/cred.h +4 -2
- data/vendor/libgit2/src/transports/cred_helpers.c +1 -0
- data/vendor/libgit2/src/transports/git.c +3 -1
- data/vendor/libgit2/src/transports/http.c +10 -14
- data/vendor/libgit2/src/transports/http.h +23 -0
- data/vendor/libgit2/src/transports/local.c +23 -5
- data/vendor/libgit2/src/transports/smart.c +3 -1
- data/vendor/libgit2/src/transports/smart.h +23 -16
- data/vendor/libgit2/src/transports/smart_pkt.c +114 -130
- data/vendor/libgit2/src/transports/smart_protocol.c +26 -22
- data/vendor/libgit2/src/transports/ssh.c +12 -7
- data/vendor/libgit2/src/transports/ssh.h +4 -2
- data/vendor/libgit2/src/transports/winhttp.c +19 -21
- data/vendor/libgit2/src/tree-cache.c +1 -0
- data/vendor/libgit2/src/tree-cache.h +1 -0
- data/vendor/libgit2/src/tree.c +20 -14
- data/vendor/libgit2/src/tree.h +2 -0
- data/vendor/libgit2/src/tsort.c +0 -1
- data/vendor/libgit2/src/unix/map.c +4 -1
- data/vendor/libgit2/src/unix/posix.h +8 -4
- data/vendor/libgit2/src/unix/pthread.h +1 -1
- data/vendor/libgit2/src/unix/realpath.c +4 -1
- data/vendor/libgit2/src/util.c +6 -5
- data/vendor/libgit2/src/util.h +39 -111
- data/vendor/libgit2/src/varint.c +0 -1
- data/vendor/libgit2/src/varint.h +2 -0
- data/vendor/libgit2/src/vector.c +1 -1
- data/vendor/libgit2/src/win32/dir.c +3 -0
- data/vendor/libgit2/src/win32/dir.h +4 -3
- data/vendor/libgit2/src/win32/error.c +1 -1
- data/vendor/libgit2/src/win32/error.h +4 -2
- data/vendor/libgit2/src/win32/findfile.c +2 -1
- data/vendor/libgit2/src/win32/findfile.h +4 -2
- data/vendor/libgit2/src/win32/map.c +2 -0
- data/vendor/libgit2/src/win32/mingw-compat.h +3 -3
- data/vendor/libgit2/src/win32/msvc-compat.h +3 -3
- data/vendor/libgit2/src/win32/path_w32.c +7 -12
- data/vendor/libgit2/src/win32/path_w32.h +3 -2
- data/vendor/libgit2/src/win32/posix.h +2 -2
- data/vendor/libgit2/src/win32/posix_w32.c +11 -5
- data/vendor/libgit2/src/win32/precompiled.h +2 -1
- data/vendor/libgit2/src/win32/reparse.h +2 -2
- data/vendor/libgit2/src/win32/thread.c +1 -0
- data/vendor/libgit2/src/win32/thread.h +2 -2
- data/vendor/libgit2/src/win32/utf-conv.c +0 -1
- data/vendor/libgit2/src/win32/utf-conv.h +4 -3
- data/vendor/libgit2/src/win32/w32_buffer.c +1 -1
- data/vendor/libgit2/src/win32/w32_buffer.h +4 -2
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +2 -1
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +85 -2
- data/vendor/libgit2/src/win32/w32_stack.c +2 -1
- data/vendor/libgit2/src/win32/w32_stack.h +5 -3
- data/vendor/libgit2/src/win32/w32_util.h +4 -2
- data/vendor/libgit2/src/win32/win32-compat.h +3 -3
- data/vendor/libgit2/src/worktree.c +4 -5
- data/vendor/libgit2/src/worktree.h +2 -0
- data/vendor/libgit2/src/xdiff/xdiff.h +22 -13
- data/vendor/libgit2/src/xdiff/xdiffi.c +523 -81
- data/vendor/libgit2/src/xdiff/xdiffi.h +2 -2
- data/vendor/libgit2/src/xdiff/xemit.c +63 -39
- data/vendor/libgit2/src/xdiff/xemit.h +2 -2
- data/vendor/libgit2/src/xdiff/xhistogram.c +0 -1
- data/vendor/libgit2/src/xdiff/xinclude.h +3 -2
- data/vendor/libgit2/src/xdiff/xmacros.h +2 -2
- data/vendor/libgit2/src/xdiff/xmerge.c +80 -20
- data/vendor/libgit2/src/xdiff/xpatience.c +41 -9
- data/vendor/libgit2/src/xdiff/xprepare.c +2 -2
- data/vendor/libgit2/src/xdiff/xprepare.h +2 -2
- data/vendor/libgit2/src/xdiff/xtypes.h +2 -2
- data/vendor/libgit2/src/xdiff/xutils.c +47 -27
- data/vendor/libgit2/src/xdiff/xutils.h +2 -5
- data/vendor/libgit2/src/zstream.c +65 -45
- data/vendor/libgit2/src/zstream.h +9 -2
- metadata +27 -13
- data/vendor/libgit2/include/git2/sys/remote.h +0 -16
data/vendor/libgit2/src/merge.h
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
* a Linking Exception. For full terms see the included COPYING file.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
#include "
|
|
8
|
+
#include "merge_driver.h"
|
|
9
|
+
|
|
9
10
|
#include "vector.h"
|
|
10
11
|
#include "global.h"
|
|
11
12
|
#include "merge.h"
|
|
12
|
-
#include "merge_driver.h"
|
|
13
13
|
#include "git2/merge.h"
|
|
14
14
|
#include "git2/sys/merge.h"
|
|
15
15
|
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
#include "common.h"
|
|
9
|
+
|
|
9
10
|
#include "repository.h"
|
|
10
11
|
#include "posix.h"
|
|
11
12
|
#include "fileops.h"
|
|
@@ -125,6 +126,8 @@ static int merge_file__xdiff(
|
|
|
125
126
|
if (options.flags & GIT_MERGE_FILE_DIFF_MINIMAL)
|
|
126
127
|
xmparam.xpp.flags |= XDF_NEED_MINIMAL;
|
|
127
128
|
|
|
129
|
+
xmparam.marker_size = options.marker_size;
|
|
130
|
+
|
|
128
131
|
if ((xdl_result = xdl_merge(&ancestor_mmfile, &our_mmfile,
|
|
129
132
|
&their_mmfile, &xmparam, &mmbuffer)) < 0) {
|
|
130
133
|
giterr_set(GITERR_MERGE, "failed to merge files");
|
|
@@ -7,9 +7,11 @@
|
|
|
7
7
|
#ifndef INCLUDE_message_h__
|
|
8
8
|
#define INCLUDE_message_h__
|
|
9
9
|
|
|
10
|
+
#include "common.h"
|
|
11
|
+
|
|
10
12
|
#include "git2/message.h"
|
|
11
13
|
#include "buffer.h"
|
|
12
14
|
|
|
13
15
|
int git_message__prettify(git_buf *message_out, const char *message, int strip_comments);
|
|
14
16
|
|
|
15
|
-
#endif
|
|
17
|
+
#endif
|
data/vendor/libgit2/src/netops.c
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
* a Linking Exception. For full terms see the included COPYING file.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
#include "netops.h"
|
|
9
|
+
|
|
8
10
|
#include <ctype.h>
|
|
9
11
|
#include "git2/errors.h"
|
|
10
12
|
|
|
11
|
-
#include "common.h"
|
|
12
|
-
#include "netops.h"
|
|
13
13
|
#include "posix.h"
|
|
14
14
|
#include "buffer.h"
|
|
15
15
|
#include "http_parser.h"
|
|
@@ -206,83 +206,96 @@ void gitno_connection_data_free_ptrs(gitno_connection_data *d)
|
|
|
206
206
|
git__free(d->pass); d->pass = NULL;
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
-
#define hex2c(c) ((c | 32) % 39 - 9)
|
|
210
|
-
static char* unescape(char *str)
|
|
211
|
-
{
|
|
212
|
-
int x, y;
|
|
213
|
-
int len = (int)strlen(str);
|
|
214
|
-
|
|
215
|
-
for (x=y=0; str[y]; ++x, ++y) {
|
|
216
|
-
if ((str[x] = str[y]) == '%') {
|
|
217
|
-
if (y < len-2 && isxdigit(str[y+1]) && isxdigit(str[y+2])) {
|
|
218
|
-
str[x] = (hex2c(str[y+1]) << 4) + hex2c(str[y+2]);
|
|
219
|
-
y += 2;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
str[x] = '\0';
|
|
224
|
-
return str;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
209
|
int gitno_extract_url_parts(
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
210
|
+
char **host_out,
|
|
211
|
+
char **port_out,
|
|
212
|
+
char **path_out,
|
|
213
|
+
char **username_out,
|
|
214
|
+
char **password_out,
|
|
215
|
+
const char *url,
|
|
216
|
+
const char *default_port)
|
|
235
217
|
{
|
|
236
218
|
struct http_parser_url u = {0};
|
|
237
|
-
|
|
219
|
+
bool has_host, has_port, has_path, has_userinfo;
|
|
220
|
+
git_buf host = GIT_BUF_INIT,
|
|
221
|
+
port = GIT_BUF_INIT,
|
|
222
|
+
path = GIT_BUF_INIT,
|
|
223
|
+
username = GIT_BUF_INIT,
|
|
224
|
+
password = GIT_BUF_INIT;
|
|
225
|
+
int error = 0;
|
|
238
226
|
|
|
239
227
|
if (http_parser_parse_url(url, strlen(url), false, &u)) {
|
|
240
228
|
giterr_set(GITERR_NET, "malformed URL '%s'", url);
|
|
241
|
-
|
|
229
|
+
error = GIT_EINVALIDSPEC;
|
|
230
|
+
goto done;
|
|
242
231
|
}
|
|
243
232
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
233
|
+
has_host = !!(u.field_set & (1 << UF_HOST));
|
|
234
|
+
has_port = !!(u.field_set & (1 << UF_PORT));
|
|
235
|
+
has_path = !!(u.field_set & (1 << UF_PATH));
|
|
236
|
+
has_userinfo = !!(u.field_set & (1 << UF_USERINFO));
|
|
248
237
|
|
|
249
|
-
if (
|
|
250
|
-
*
|
|
251
|
-
|
|
238
|
+
if (has_host) {
|
|
239
|
+
const char *url_host = url + u.field_data[UF_HOST].off;
|
|
240
|
+
size_t url_host_len = u.field_data[UF_HOST].len;
|
|
241
|
+
git_buf_decode_percent(&host, url_host, url_host_len);
|
|
252
242
|
}
|
|
253
243
|
|
|
254
|
-
if (
|
|
255
|
-
*
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
244
|
+
if (has_port) {
|
|
245
|
+
const char *url_port = url + u.field_data[UF_PORT].off;
|
|
246
|
+
size_t url_port_len = u.field_data[UF_PORT].len;
|
|
247
|
+
git_buf_put(&port, url_port, url_port_len);
|
|
248
|
+
} else {
|
|
249
|
+
git_buf_puts(&port, default_port);
|
|
250
|
+
}
|
|
259
251
|
|
|
260
|
-
if (
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
*host = NULL;
|
|
269
|
-
giterr_set(GITERR_NET, "invalid url, missing path");
|
|
270
|
-
return GIT_EINVALIDSPEC;
|
|
271
|
-
}
|
|
252
|
+
if (has_path && path_out) {
|
|
253
|
+
const char *url_path = url + u.field_data[UF_PATH].off;
|
|
254
|
+
size_t url_path_len = u.field_data[UF_PATH].len;
|
|
255
|
+
git_buf_decode_percent(&path, url_path, url_path_len);
|
|
256
|
+
} else if (path_out) {
|
|
257
|
+
giterr_set(GITERR_NET, "invalid url, missing path");
|
|
258
|
+
error = GIT_EINVALIDSPEC;
|
|
259
|
+
goto done;
|
|
272
260
|
}
|
|
273
261
|
|
|
274
|
-
if (
|
|
275
|
-
const char *
|
|
262
|
+
if (has_userinfo) {
|
|
263
|
+
const char *url_userinfo = url + u.field_data[UF_USERINFO].off;
|
|
264
|
+
size_t url_userinfo_len = u.field_data[UF_USERINFO].len;
|
|
265
|
+
const char *colon = memchr(url_userinfo, ':', url_userinfo_len);
|
|
266
|
+
|
|
276
267
|
if (colon) {
|
|
277
|
-
*
|
|
278
|
-
|
|
279
|
-
|
|
268
|
+
const char *url_username = url_userinfo;
|
|
269
|
+
size_t url_username_len = colon - url_userinfo;
|
|
270
|
+
const char *url_password = colon + 1;
|
|
271
|
+
size_t url_password_len = url_userinfo_len - (url_username_len + 1);
|
|
272
|
+
|
|
273
|
+
git_buf_decode_percent(&username, url_username, url_username_len);
|
|
274
|
+
git_buf_decode_percent(&password, url_password, url_password_len);
|
|
280
275
|
} else {
|
|
281
|
-
|
|
276
|
+
git_buf_decode_percent(&username, url_userinfo, url_userinfo_len);
|
|
282
277
|
}
|
|
283
|
-
GITERR_CHECK_ALLOC(*username);
|
|
284
|
-
|
|
285
278
|
}
|
|
286
279
|
|
|
287
|
-
|
|
280
|
+
if (git_buf_oom(&host) ||
|
|
281
|
+
git_buf_oom(&port) ||
|
|
282
|
+
git_buf_oom(&path) ||
|
|
283
|
+
git_buf_oom(&username) ||
|
|
284
|
+
git_buf_oom(&password))
|
|
285
|
+
return -1;
|
|
286
|
+
|
|
287
|
+
*host_out = git_buf_detach(&host);
|
|
288
|
+
*port_out = git_buf_detach(&port);
|
|
289
|
+
if (path_out)
|
|
290
|
+
*path_out = git_buf_detach(&path);
|
|
291
|
+
*username_out = git_buf_detach(&username);
|
|
292
|
+
*password_out = git_buf_detach(&password);
|
|
293
|
+
|
|
294
|
+
done:
|
|
295
|
+
git_buf_free(&host);
|
|
296
|
+
git_buf_free(&port);
|
|
297
|
+
git_buf_free(&path);
|
|
298
|
+
git_buf_free(&username);
|
|
299
|
+
git_buf_free(&password);
|
|
300
|
+
return error;
|
|
288
301
|
}
|
data/vendor/libgit2/src/netops.h
CHANGED
data/vendor/libgit2/src/notes.c
CHANGED
|
@@ -268,7 +268,9 @@ static int insert_note_in_tree_enotfound_cb(git_tree **out,
|
|
|
268
268
|
GIT_FILEMODE_BLOB);
|
|
269
269
|
}
|
|
270
270
|
|
|
271
|
-
static int note_write(
|
|
271
|
+
static int note_write(
|
|
272
|
+
git_oid *notes_commit_out,
|
|
273
|
+
git_oid *notes_blob_out,
|
|
272
274
|
git_repository *repo,
|
|
273
275
|
const git_signature *author,
|
|
274
276
|
const git_signature *committer,
|
|
@@ -294,13 +296,17 @@ static int note_write(git_oid *out,
|
|
|
294
296
|
insert_note_in_tree_enotfound_cb)) < 0)
|
|
295
297
|
goto cleanup;
|
|
296
298
|
|
|
297
|
-
if (
|
|
298
|
-
git_oid_cpy(
|
|
299
|
+
if (notes_blob_out)
|
|
300
|
+
git_oid_cpy(notes_blob_out, &oid);
|
|
301
|
+
|
|
299
302
|
|
|
300
303
|
error = git_commit_create(&oid, repo, notes_ref, author, committer,
|
|
301
304
|
NULL, GIT_NOTES_DEFAULT_MSG_ADD,
|
|
302
305
|
tree, *parents == NULL ? 0 : 1, (const git_commit **) parents);
|
|
303
306
|
|
|
307
|
+
if (notes_commit_out)
|
|
308
|
+
git_oid_cpy(notes_commit_out, &oid);
|
|
309
|
+
|
|
304
310
|
cleanup:
|
|
305
311
|
git_tree_free(tree);
|
|
306
312
|
return error;
|
|
@@ -363,7 +369,9 @@ cleanup:
|
|
|
363
369
|
return error;
|
|
364
370
|
}
|
|
365
371
|
|
|
366
|
-
static int note_remove(
|
|
372
|
+
static int note_remove(
|
|
373
|
+
git_oid *notes_commit_out,
|
|
374
|
+
git_repository *repo,
|
|
367
375
|
const git_signature *author, const git_signature *committer,
|
|
368
376
|
const char *notes_ref, git_tree *tree,
|
|
369
377
|
const char *target, git_commit **parents)
|
|
@@ -383,6 +391,12 @@ static int note_remove(git_repository *repo,
|
|
|
383
391
|
*parents == NULL ? 0 : 1,
|
|
384
392
|
(const git_commit **) parents);
|
|
385
393
|
|
|
394
|
+
if (error < 0)
|
|
395
|
+
goto cleanup;
|
|
396
|
+
|
|
397
|
+
if (notes_commit_out)
|
|
398
|
+
git_oid_cpy(notes_commit_out, &oid);
|
|
399
|
+
|
|
386
400
|
cleanup:
|
|
387
401
|
git_tree_free(tree_after_removal);
|
|
388
402
|
return error;
|
|
@@ -410,8 +424,7 @@ static int normalize_namespace(char **out, git_repository *repo, const char *not
|
|
|
410
424
|
return note_get_default_ref(out, repo);
|
|
411
425
|
}
|
|
412
426
|
|
|
413
|
-
static int
|
|
414
|
-
git_tree **tree_out,
|
|
427
|
+
static int retrieve_note_commit(
|
|
415
428
|
git_commit **commit_out,
|
|
416
429
|
char **notes_ref_out,
|
|
417
430
|
git_repository *repo,
|
|
@@ -429,34 +442,82 @@ static int retrieve_note_tree_and_commit(
|
|
|
429
442
|
if (git_commit_lookup(commit_out, repo, &oid) < 0)
|
|
430
443
|
return error;
|
|
431
444
|
|
|
432
|
-
if ((error = git_commit_tree(tree_out, *commit_out)) < 0)
|
|
433
|
-
return error;
|
|
434
|
-
|
|
435
445
|
return 0;
|
|
436
446
|
}
|
|
437
447
|
|
|
448
|
+
int git_note_commit_read(
|
|
449
|
+
git_note **out,
|
|
450
|
+
git_repository *repo,
|
|
451
|
+
git_commit *notes_commit,
|
|
452
|
+
const git_oid *oid)
|
|
453
|
+
{
|
|
454
|
+
int error;
|
|
455
|
+
git_tree *tree = NULL;
|
|
456
|
+
char target[GIT_OID_HEXSZ + 1];
|
|
457
|
+
|
|
458
|
+
git_oid_tostr(target, sizeof(target), oid);
|
|
459
|
+
|
|
460
|
+
if ((error = git_commit_tree(&tree, notes_commit)) < 0)
|
|
461
|
+
goto cleanup;
|
|
462
|
+
|
|
463
|
+
error = note_lookup(out, repo, notes_commit, tree, target);
|
|
464
|
+
|
|
465
|
+
cleanup:
|
|
466
|
+
git_tree_free(tree);
|
|
467
|
+
return error;
|
|
468
|
+
}
|
|
469
|
+
|
|
438
470
|
int git_note_read(git_note **out, git_repository *repo,
|
|
439
471
|
const char *notes_ref_in, const git_oid *oid)
|
|
440
472
|
{
|
|
441
473
|
int error;
|
|
442
|
-
char *
|
|
443
|
-
git_tree *tree = NULL;
|
|
474
|
+
char *notes_ref = NULL;
|
|
444
475
|
git_commit *commit = NULL;
|
|
445
476
|
|
|
446
|
-
|
|
447
|
-
GITERR_CHECK_ALLOC(target);
|
|
477
|
+
error = retrieve_note_commit(&commit, ¬es_ref, repo, notes_ref_in);
|
|
448
478
|
|
|
449
|
-
if (
|
|
450
|
-
|
|
451
|
-
error = note_lookup(out, repo, commit, tree, target);
|
|
479
|
+
if (error < 0)
|
|
480
|
+
goto cleanup;
|
|
452
481
|
|
|
482
|
+
error = git_note_commit_read(out, repo, commit, oid);
|
|
483
|
+
|
|
484
|
+
cleanup:
|
|
453
485
|
git__free(notes_ref);
|
|
454
|
-
git__free(target);
|
|
455
|
-
git_tree_free(tree);
|
|
456
486
|
git_commit_free(commit);
|
|
457
487
|
return error;
|
|
458
488
|
}
|
|
459
489
|
|
|
490
|
+
int git_note_commit_create(
|
|
491
|
+
git_oid *notes_commit_out,
|
|
492
|
+
git_oid *notes_blob_out,
|
|
493
|
+
git_repository *repo,
|
|
494
|
+
git_commit *parent,
|
|
495
|
+
const git_signature *author,
|
|
496
|
+
const git_signature *committer,
|
|
497
|
+
const git_oid *oid,
|
|
498
|
+
const char *note,
|
|
499
|
+
int allow_note_overwrite)
|
|
500
|
+
{
|
|
501
|
+
int error;
|
|
502
|
+
git_tree *tree = NULL;
|
|
503
|
+
char target[GIT_OID_HEXSZ + 1];
|
|
504
|
+
|
|
505
|
+
git_oid_tostr(target, sizeof(target), oid);
|
|
506
|
+
|
|
507
|
+
if (parent != NULL && (error = git_commit_tree(&tree, parent)) < 0)
|
|
508
|
+
goto cleanup;
|
|
509
|
+
|
|
510
|
+
error = note_write(notes_commit_out, notes_blob_out, repo, author,
|
|
511
|
+
committer, NULL, note, tree, target, &parent, allow_note_overwrite);
|
|
512
|
+
|
|
513
|
+
if (error < 0)
|
|
514
|
+
goto cleanup;
|
|
515
|
+
|
|
516
|
+
cleanup:
|
|
517
|
+
git_tree_free(tree);
|
|
518
|
+
return error;
|
|
519
|
+
}
|
|
520
|
+
|
|
460
521
|
int git_note_create(
|
|
461
522
|
git_oid *out,
|
|
462
523
|
git_repository *repo,
|
|
@@ -468,25 +529,59 @@ int git_note_create(
|
|
|
468
529
|
int allow_note_overwrite)
|
|
469
530
|
{
|
|
470
531
|
int error;
|
|
471
|
-
char *
|
|
472
|
-
git_commit *
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
target = git_oid_allocfmt(oid);
|
|
476
|
-
GITERR_CHECK_ALLOC(target);
|
|
532
|
+
char *notes_ref = NULL;
|
|
533
|
+
git_commit *existing_notes_commit = NULL;
|
|
534
|
+
git_reference *ref = NULL;
|
|
535
|
+
git_oid notes_blob_oid, notes_commit_oid;
|
|
477
536
|
|
|
478
|
-
error =
|
|
537
|
+
error = retrieve_note_commit(&existing_notes_commit, ¬es_ref,
|
|
538
|
+
repo, notes_ref_in);
|
|
479
539
|
|
|
480
540
|
if (error < 0 && error != GIT_ENOTFOUND)
|
|
481
541
|
goto cleanup;
|
|
482
542
|
|
|
483
|
-
error =
|
|
484
|
-
|
|
543
|
+
error = git_note_commit_create(¬es_commit_oid,
|
|
544
|
+
¬es_blob_oid,
|
|
545
|
+
repo, existing_notes_commit, author,
|
|
546
|
+
committer, oid, note,
|
|
547
|
+
allow_note_overwrite);
|
|
548
|
+
if (error < 0)
|
|
549
|
+
goto cleanup;
|
|
550
|
+
|
|
551
|
+
error = git_reference_create(&ref, repo, notes_ref,
|
|
552
|
+
¬es_commit_oid, 1, NULL);
|
|
553
|
+
|
|
554
|
+
if (out != NULL)
|
|
555
|
+
git_oid_cpy(out, ¬es_blob_oid);
|
|
485
556
|
|
|
486
557
|
cleanup:
|
|
487
558
|
git__free(notes_ref);
|
|
488
|
-
|
|
489
|
-
|
|
559
|
+
git_commit_free(existing_notes_commit);
|
|
560
|
+
git_reference_free(ref);
|
|
561
|
+
return error;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
int git_note_commit_remove(
|
|
565
|
+
git_oid *notes_commit_out,
|
|
566
|
+
git_repository *repo,
|
|
567
|
+
git_commit *notes_commit,
|
|
568
|
+
const git_signature *author,
|
|
569
|
+
const git_signature *committer,
|
|
570
|
+
const git_oid *oid)
|
|
571
|
+
{
|
|
572
|
+
int error;
|
|
573
|
+
git_tree *tree = NULL;
|
|
574
|
+
char target[GIT_OID_HEXSZ + 1];
|
|
575
|
+
|
|
576
|
+
git_oid_tostr(target, sizeof(target), oid);
|
|
577
|
+
|
|
578
|
+
if ((error = git_commit_tree(&tree, notes_commit)) < 0)
|
|
579
|
+
goto cleanup;
|
|
580
|
+
|
|
581
|
+
error = note_remove(notes_commit_out,
|
|
582
|
+
repo, author, committer, NULL, tree, target, ¬es_commit);
|
|
583
|
+
|
|
584
|
+
cleanup:
|
|
490
585
|
git_tree_free(tree);
|
|
491
586
|
return error;
|
|
492
587
|
}
|
|
@@ -496,22 +591,29 @@ int git_note_remove(git_repository *repo, const char *notes_ref_in,
|
|
|
496
591
|
const git_oid *oid)
|
|
497
592
|
{
|
|
498
593
|
int error;
|
|
499
|
-
char *
|
|
500
|
-
git_commit *
|
|
501
|
-
|
|
594
|
+
char *notes_ref_target = NULL;
|
|
595
|
+
git_commit *existing_notes_commit = NULL;
|
|
596
|
+
git_oid new_notes_commit;
|
|
597
|
+
git_reference *notes_ref = NULL;
|
|
502
598
|
|
|
503
|
-
|
|
504
|
-
|
|
599
|
+
error = retrieve_note_commit(&existing_notes_commit, ¬es_ref_target,
|
|
600
|
+
repo, notes_ref_in);
|
|
505
601
|
|
|
506
|
-
if (
|
|
507
|
-
|
|
508
|
-
error = note_remove(
|
|
509
|
-
repo, author, committer, notes_ref, tree, target, &commit);
|
|
602
|
+
if (error < 0)
|
|
603
|
+
goto cleanup;
|
|
510
604
|
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
605
|
+
error = git_note_commit_remove(&new_notes_commit, repo,
|
|
606
|
+
existing_notes_commit, author, committer, oid);
|
|
607
|
+
if (error < 0)
|
|
608
|
+
goto cleanup;
|
|
609
|
+
|
|
610
|
+
error = git_reference_create(¬es_ref, repo, notes_ref_target,
|
|
611
|
+
&new_notes_commit, 1, NULL);
|
|
612
|
+
|
|
613
|
+
cleanup:
|
|
614
|
+
git__free(notes_ref_target);
|
|
615
|
+
git_reference_free(notes_ref);
|
|
616
|
+
git_commit_free(existing_notes_commit);
|
|
515
617
|
return error;
|
|
516
618
|
}
|
|
517
619
|
|
|
@@ -639,7 +741,6 @@ int git_note_foreach(
|
|
|
639
741
|
return error;
|
|
640
742
|
}
|
|
641
743
|
|
|
642
|
-
|
|
643
744
|
void git_note_iterator_free(git_note_iterator *it)
|
|
644
745
|
{
|
|
645
746
|
if (it == NULL)
|
|
@@ -648,6 +749,24 @@ void git_note_iterator_free(git_note_iterator *it)
|
|
|
648
749
|
git_iterator_free(it);
|
|
649
750
|
}
|
|
650
751
|
|
|
752
|
+
int git_note_commit_iterator_new(
|
|
753
|
+
git_note_iterator **it,
|
|
754
|
+
git_commit *notes_commit)
|
|
755
|
+
{
|
|
756
|
+
int error;
|
|
757
|
+
git_tree *tree;
|
|
758
|
+
|
|
759
|
+
if ((error = git_commit_tree(&tree, notes_commit)) < 0)
|
|
760
|
+
goto cleanup;
|
|
761
|
+
|
|
762
|
+
if ((error = git_iterator_for_tree(it, tree, NULL)) < 0)
|
|
763
|
+
git_iterator_free(*it);
|
|
764
|
+
|
|
765
|
+
cleanup:
|
|
766
|
+
git_tree_free(tree);
|
|
767
|
+
|
|
768
|
+
return error;
|
|
769
|
+
}
|
|
651
770
|
|
|
652
771
|
int git_note_iterator_new(
|
|
653
772
|
git_note_iterator **it,
|
|
@@ -656,19 +775,16 @@ int git_note_iterator_new(
|
|
|
656
775
|
{
|
|
657
776
|
int error;
|
|
658
777
|
git_commit *commit = NULL;
|
|
659
|
-
git_tree *tree = NULL;
|
|
660
778
|
char *notes_ref;
|
|
661
779
|
|
|
662
|
-
error =
|
|
780
|
+
error = retrieve_note_commit(&commit, ¬es_ref, repo, notes_ref_in);
|
|
663
781
|
if (error < 0)
|
|
664
782
|
goto cleanup;
|
|
665
783
|
|
|
666
|
-
|
|
667
|
-
git_iterator_free(*it);
|
|
784
|
+
error = git_note_commit_iterator_new(it, commit);
|
|
668
785
|
|
|
669
786
|
cleanup:
|
|
670
787
|
git__free(notes_ref);
|
|
671
|
-
git_tree_free(tree);
|
|
672
788
|
git_commit_free(commit);
|
|
673
789
|
|
|
674
790
|
return error;
|