rugged 0.26.7 → 0.27.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -5,8 +5,10 @@
|
|
5
5
|
* a Linking Exception. For full terms see the included COPYING file.
|
6
6
|
*/
|
7
7
|
|
8
|
-
#ifndef
|
9
|
-
#define
|
8
|
+
#ifndef INCLUDE_transports_auth_h__
|
9
|
+
#define INCLUDE_transports_auth_h__
|
10
|
+
|
11
|
+
#include "common.h"
|
10
12
|
|
11
13
|
#include "git2.h"
|
12
14
|
#include "netops.h"
|
@@ -60,4 +62,3 @@ int git_http_auth_basic(
|
|
60
62
|
const gitno_connection_data *connection_data);
|
61
63
|
|
62
64
|
#endif
|
63
|
-
|
@@ -5,9 +5,10 @@
|
|
5
5
|
* a Linking Exception. For full terms see the included COPYING file.
|
6
6
|
*/
|
7
7
|
|
8
|
-
#ifndef
|
9
|
-
#define
|
8
|
+
#ifndef INCLUDE_transports_auth_negotiate_h__
|
9
|
+
#define INCLUDE_transports_auth_negotiate_h__
|
10
10
|
|
11
|
+
#include "common.h"
|
11
12
|
#include "git2.h"
|
12
13
|
#include "auth.h"
|
13
14
|
|
@@ -24,4 +25,3 @@ extern int git_http_auth_negotiate(
|
|
24
25
|
#endif /* GIT_GSSAPI */
|
25
26
|
|
26
27
|
#endif
|
27
|
-
|
@@ -4,8 +4,10 @@
|
|
4
4
|
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
5
|
* a Linking Exception. For full terms see the included COPYING file.
|
6
6
|
*/
|
7
|
-
#ifndef
|
8
|
-
#define
|
7
|
+
#ifndef INCLUDE_transports_cred_h__
|
8
|
+
#define INCLUDE_transports_cred_h__
|
9
|
+
|
10
|
+
#include "common.h"
|
9
11
|
|
10
12
|
#include "git2/transport.h"
|
11
13
|
|
@@ -5,12 +5,14 @@
|
|
5
5
|
* a Linking Exception. For full terms see the included COPYING file.
|
6
6
|
*/
|
7
7
|
|
8
|
+
#include "common.h"
|
9
|
+
|
8
10
|
#include "git2.h"
|
9
11
|
#include "buffer.h"
|
10
12
|
#include "netops.h"
|
11
13
|
#include "git2/sys/transport.h"
|
12
14
|
#include "stream.h"
|
13
|
-
#include "
|
15
|
+
#include "streams/socket.h"
|
14
16
|
|
15
17
|
#define OWNING_SUBTRANSPORT(s) ((git_subtransport *)(s)->parent.subtransport)
|
16
18
|
|
@@ -4,6 +4,9 @@
|
|
4
4
|
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
5
|
* a Linking Exception. For full terms see the included COPYING file.
|
6
6
|
*/
|
7
|
+
|
8
|
+
#include "common.h"
|
9
|
+
|
7
10
|
#ifndef GIT_WINHTTP
|
8
11
|
|
9
12
|
#include "git2.h"
|
@@ -14,10 +17,11 @@
|
|
14
17
|
#include "remote.h"
|
15
18
|
#include "smart.h"
|
16
19
|
#include "auth.h"
|
20
|
+
#include "http.h"
|
17
21
|
#include "auth_negotiate.h"
|
18
|
-
#include "
|
19
|
-
#include "
|
20
|
-
#include "
|
22
|
+
#include "streams/tls.h"
|
23
|
+
#include "streams/socket.h"
|
24
|
+
#include "streams/curl.h"
|
21
25
|
|
22
26
|
git_http_auth_scheme auth_schemes[] = {
|
23
27
|
{ GIT_AUTHTYPE_NEGOTIATE, "Negotiate", GIT_CREDTYPE_DEFAULT, git_http_auth_negotiate },
|
@@ -187,16 +191,6 @@ static int apply_credentials(git_buf *buf, http_subtransport *t)
|
|
187
191
|
return context->next_token(buf, context, cred);
|
188
192
|
}
|
189
193
|
|
190
|
-
static const char *user_agent(void)
|
191
|
-
{
|
192
|
-
const char *custom = git_libgit2__user_agent();
|
193
|
-
|
194
|
-
if (custom)
|
195
|
-
return custom;
|
196
|
-
|
197
|
-
return "libgit2 " LIBGIT2_VERSION;
|
198
|
-
}
|
199
|
-
|
200
194
|
static int gen_request(
|
201
195
|
git_buf *buf,
|
202
196
|
http_stream *s,
|
@@ -208,7 +202,9 @@ static int gen_request(
|
|
208
202
|
|
209
203
|
git_buf_printf(buf, "%s %s%s HTTP/1.1\r\n", s->verb, path, s->service_url);
|
210
204
|
|
211
|
-
|
205
|
+
git_buf_puts(buf, "User-Agent: ");
|
206
|
+
git_http__user_agent(buf);
|
207
|
+
git_buf_puts(buf, "\r\n");
|
212
208
|
git_buf_printf(buf, "Host: %s\r\n", t->connection_data.host);
|
213
209
|
|
214
210
|
if (s->chunked || content_length > 0) {
|
@@ -0,0 +1,23 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) the libgit2 contributors. All rights reserved.
|
3
|
+
*
|
4
|
+
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
|
+
* a Linking Exception. For full terms see the included COPYING file.
|
6
|
+
*/
|
7
|
+
|
8
|
+
#ifndef INCLUDE_transports_http_h__
|
9
|
+
#define INCLUDE_transports_http_h__
|
10
|
+
|
11
|
+
#include "buffer.h"
|
12
|
+
|
13
|
+
GIT_INLINE(int) git_http__user_agent(git_buf *buf)
|
14
|
+
{
|
15
|
+
const char *ua = git_libgit2__user_agent();
|
16
|
+
|
17
|
+
if (!ua)
|
18
|
+
ua = "libgit2 " LIBGIT2_VERSION;
|
19
|
+
|
20
|
+
return git_buf_printf(buf, "git/2.0 (%s)", ua);
|
21
|
+
}
|
22
|
+
|
23
|
+
#endif
|
@@ -4,7 +4,9 @@
|
|
4
4
|
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
5
|
* a Linking Exception. For full terms see the included COPYING file.
|
6
6
|
*/
|
7
|
+
|
7
8
|
#include "common.h"
|
9
|
+
|
8
10
|
#include "git2/types.h"
|
9
11
|
#include "git2/net.h"
|
10
12
|
#include "git2/repository.h"
|
@@ -16,6 +18,7 @@
|
|
16
18
|
#include "git2/pack.h"
|
17
19
|
#include "git2/commit.h"
|
18
20
|
#include "git2/revparse.h"
|
21
|
+
|
19
22
|
#include "pack-objects.h"
|
20
23
|
#include "refs.h"
|
21
24
|
#include "posix.h"
|
@@ -504,6 +507,23 @@ static int local_counting(int stage, unsigned int current, unsigned int total, v
|
|
504
507
|
return error;
|
505
508
|
}
|
506
509
|
|
510
|
+
static int foreach_reference_cb(git_reference *reference, void *payload)
|
511
|
+
{
|
512
|
+
git_revwalk *walk = (git_revwalk *)payload;
|
513
|
+
|
514
|
+
int error = git_revwalk_hide(walk, git_reference_target(reference));
|
515
|
+
/* The reference is in the local repository, so the target may not
|
516
|
+
* exist on the remote. It also may not be a commit. */
|
517
|
+
if (error == GIT_ENOTFOUND || error == GITERR_INVALID) {
|
518
|
+
giterr_clear();
|
519
|
+
error = 0;
|
520
|
+
}
|
521
|
+
|
522
|
+
git_reference_free(reference);
|
523
|
+
|
524
|
+
return error;
|
525
|
+
}
|
526
|
+
|
507
527
|
static int local_download_pack(
|
508
528
|
git_transport *transport,
|
509
529
|
git_repository *repo,
|
@@ -543,11 +563,6 @@ static int local_download_pack(
|
|
543
563
|
if (git_object_type(obj) == GIT_OBJ_COMMIT) {
|
544
564
|
/* Revwalker includes only wanted commits */
|
545
565
|
error = git_revwalk_push(walk, &rhead->oid);
|
546
|
-
if (!error && !git_oid_iszero(&rhead->loid)) {
|
547
|
-
error = git_revwalk_hide(walk, &rhead->loid);
|
548
|
-
if (error == GIT_ENOTFOUND)
|
549
|
-
error = 0;
|
550
|
-
}
|
551
566
|
} else {
|
552
567
|
/* Tag or some other wanted object. Add it on its own */
|
553
568
|
error = git_packbuilder_insert_recur(pack, &rhead->oid, rhead->name);
|
@@ -557,6 +572,9 @@ static int local_download_pack(
|
|
557
572
|
goto cleanup;
|
558
573
|
}
|
559
574
|
|
575
|
+
if ((error = git_reference_foreach(repo, foreach_reference_cb, walk)))
|
576
|
+
goto cleanup;
|
577
|
+
|
560
578
|
if ((error = git_packbuilder_insert_walk(pack, walk)))
|
561
579
|
goto cleanup;
|
562
580
|
|
@@ -4,8 +4,10 @@
|
|
4
4
|
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
5
|
* a Linking Exception. For full terms see the included COPYING file.
|
6
6
|
*/
|
7
|
-
|
7
|
+
|
8
8
|
#include "smart.h"
|
9
|
+
|
10
|
+
#include "git2.h"
|
9
11
|
#include "refs.h"
|
10
12
|
#include "refspec.h"
|
11
13
|
#include "proxy.h"
|
@@ -4,6 +4,11 @@
|
|
4
4
|
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
5
|
* a Linking Exception. For full terms see the included COPYING file.
|
6
6
|
*/
|
7
|
+
#ifndef INCLUDE_transports_smart_h__
|
8
|
+
#define INCLUDE_transports_smart_h__
|
9
|
+
|
10
|
+
#include "common.h"
|
11
|
+
|
7
12
|
#include "git2.h"
|
8
13
|
#include "vector.h"
|
9
14
|
#include "netops.h"
|
@@ -28,14 +33,14 @@
|
|
28
33
|
|
29
34
|
extern bool git_smart__ofs_delta_enabled;
|
30
35
|
|
31
|
-
|
36
|
+
enum git_pkt_type {
|
32
37
|
GIT_PKT_CMD,
|
33
38
|
GIT_PKT_FLUSH,
|
34
39
|
GIT_PKT_REF,
|
35
40
|
GIT_PKT_HAVE,
|
36
41
|
GIT_PKT_ACK,
|
37
42
|
GIT_PKT_NAK,
|
38
|
-
|
43
|
+
GIT_PKT_PACK,
|
39
44
|
GIT_PKT_COMMENT,
|
40
45
|
GIT_PKT_ERR,
|
41
46
|
GIT_PKT_DATA,
|
@@ -43,7 +48,7 @@ typedef enum {
|
|
43
48
|
GIT_PKT_OK,
|
44
49
|
GIT_PKT_NG,
|
45
50
|
GIT_PKT_UNPACK,
|
46
|
-
}
|
51
|
+
};
|
47
52
|
|
48
53
|
/* Used for multi_ack and mutli_ack_detailed */
|
49
54
|
enum git_ack_status {
|
@@ -55,11 +60,11 @@ enum git_ack_status {
|
|
55
60
|
|
56
61
|
/* This would be a flush pkt */
|
57
62
|
typedef struct {
|
58
|
-
git_pkt_type type;
|
63
|
+
enum git_pkt_type type;
|
59
64
|
} git_pkt;
|
60
65
|
|
61
66
|
struct git_pkt_cmd {
|
62
|
-
git_pkt_type type;
|
67
|
+
enum git_pkt_type type;
|
63
68
|
char *cmd;
|
64
69
|
char *path;
|
65
70
|
char *host;
|
@@ -67,50 +72,50 @@ struct git_pkt_cmd {
|
|
67
72
|
|
68
73
|
/* This is a pkt-line with some info in it */
|
69
74
|
typedef struct {
|
70
|
-
git_pkt_type type;
|
75
|
+
enum git_pkt_type type;
|
71
76
|
git_remote_head head;
|
72
77
|
char *capabilities;
|
73
78
|
} git_pkt_ref;
|
74
79
|
|
75
80
|
/* Useful later */
|
76
81
|
typedef struct {
|
77
|
-
git_pkt_type type;
|
82
|
+
enum git_pkt_type type;
|
78
83
|
git_oid oid;
|
79
84
|
enum git_ack_status status;
|
80
85
|
} git_pkt_ack;
|
81
86
|
|
82
87
|
typedef struct {
|
83
|
-
git_pkt_type type;
|
88
|
+
enum git_pkt_type type;
|
84
89
|
char comment[GIT_FLEX_ARRAY];
|
85
90
|
} git_pkt_comment;
|
86
91
|
|
87
92
|
typedef struct {
|
88
|
-
git_pkt_type type;
|
89
|
-
|
93
|
+
enum git_pkt_type type;
|
94
|
+
int len;
|
90
95
|
char data[GIT_FLEX_ARRAY];
|
91
96
|
} git_pkt_data;
|
92
97
|
|
93
98
|
typedef git_pkt_data git_pkt_progress;
|
94
99
|
|
95
100
|
typedef struct {
|
96
|
-
git_pkt_type type;
|
97
|
-
|
101
|
+
enum git_pkt_type type;
|
102
|
+
int len;
|
98
103
|
char error[GIT_FLEX_ARRAY];
|
99
104
|
} git_pkt_err;
|
100
105
|
|
101
106
|
typedef struct {
|
102
|
-
git_pkt_type type;
|
107
|
+
enum git_pkt_type type;
|
103
108
|
char *ref;
|
104
109
|
} git_pkt_ok;
|
105
110
|
|
106
111
|
typedef struct {
|
107
|
-
git_pkt_type type;
|
112
|
+
enum git_pkt_type type;
|
108
113
|
char *ref;
|
109
114
|
char *msg;
|
110
115
|
} git_pkt_ng;
|
111
116
|
|
112
117
|
typedef struct {
|
113
|
-
git_pkt_type type;
|
118
|
+
enum git_pkt_type type;
|
114
119
|
int unpack_ok;
|
115
120
|
} git_pkt_unpack;
|
116
121
|
|
@@ -184,10 +189,12 @@ int git_smart__get_push_stream(transport_smart *t, git_smart_subtransport_stream
|
|
184
189
|
int git_smart__update_heads(transport_smart *t, git_vector *symrefs);
|
185
190
|
|
186
191
|
/* smart_pkt.c */
|
187
|
-
int git_pkt_parse_line(git_pkt **head, const char
|
192
|
+
int git_pkt_parse_line(git_pkt **head, const char *line, const char **out, size_t len);
|
188
193
|
int git_pkt_buffer_flush(git_buf *buf);
|
189
194
|
int git_pkt_send_flush(GIT_SOCKET s);
|
190
195
|
int git_pkt_buffer_done(git_buf *buf);
|
191
196
|
int git_pkt_buffer_wants(const git_remote_head * const *refs, size_t count, transport_smart_caps *caps, git_buf *buf);
|
192
197
|
int git_pkt_buffer_have(git_oid *oid, git_buf *buf);
|
193
198
|
void git_pkt_free(git_pkt *pkt);
|
199
|
+
|
200
|
+
#endif
|
@@ -43,43 +43,34 @@ static int flush_pkt(git_pkt **out)
|
|
43
43
|
static int ack_pkt(git_pkt **out, const char *line, size_t len)
|
44
44
|
{
|
45
45
|
git_pkt_ack *pkt;
|
46
|
+
GIT_UNUSED(line);
|
47
|
+
GIT_UNUSED(len);
|
46
48
|
|
47
49
|
pkt = git__calloc(1, sizeof(git_pkt_ack));
|
48
50
|
GITERR_CHECK_ALLOC(pkt);
|
49
|
-
pkt->type = GIT_PKT_ACK;
|
50
|
-
|
51
|
-
if (git__prefixncmp(line, len, "ACK "))
|
52
|
-
goto out_err;
|
53
|
-
line += 4;
|
54
|
-
len -= 4;
|
55
51
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
len -= GIT_OID_HEXSZ;
|
52
|
+
pkt->type = GIT_PKT_ACK;
|
53
|
+
line += 3;
|
54
|
+
len -= 3;
|
60
55
|
|
61
|
-
if (len
|
62
|
-
line
|
63
|
-
|
56
|
+
if (len >= GIT_OID_HEXSZ) {
|
57
|
+
git_oid_fromstr(&pkt->oid, line + 1);
|
58
|
+
line += GIT_OID_HEXSZ + 1;
|
59
|
+
len -= GIT_OID_HEXSZ + 1;
|
60
|
+
}
|
64
61
|
|
65
|
-
|
62
|
+
if (len >= 7) {
|
63
|
+
if (!git__prefixcmp(line + 1, "continue"))
|
66
64
|
pkt->status = GIT_ACK_CONTINUE;
|
67
|
-
|
65
|
+
if (!git__prefixcmp(line + 1, "common"))
|
68
66
|
pkt->status = GIT_ACK_COMMON;
|
69
|
-
|
67
|
+
if (!git__prefixcmp(line + 1, "ready"))
|
70
68
|
pkt->status = GIT_ACK_READY;
|
71
|
-
else
|
72
|
-
goto out_err;
|
73
69
|
}
|
74
70
|
|
75
71
|
*out = (git_pkt *) pkt;
|
76
72
|
|
77
73
|
return 0;
|
78
|
-
|
79
|
-
out_err:
|
80
|
-
giterr_set(GITERR_NET, "error parsing ACK pkt-line");
|
81
|
-
git__free(pkt);
|
82
|
-
return -1;
|
83
74
|
}
|
84
75
|
|
85
76
|
static int nak_pkt(git_pkt **out)
|
@@ -95,6 +86,19 @@ static int nak_pkt(git_pkt **out)
|
|
95
86
|
return 0;
|
96
87
|
}
|
97
88
|
|
89
|
+
static int pack_pkt(git_pkt **out)
|
90
|
+
{
|
91
|
+
git_pkt *pkt;
|
92
|
+
|
93
|
+
pkt = git__malloc(sizeof(git_pkt));
|
94
|
+
GITERR_CHECK_ALLOC(pkt);
|
95
|
+
|
96
|
+
pkt->type = GIT_PKT_PACK;
|
97
|
+
*out = pkt;
|
98
|
+
|
99
|
+
return 0;
|
100
|
+
}
|
101
|
+
|
98
102
|
static int comment_pkt(git_pkt **out, const char *line, size_t len)
|
99
103
|
{
|
100
104
|
git_pkt_comment *pkt;
|
@@ -116,12 +120,10 @@ static int comment_pkt(git_pkt **out, const char *line, size_t len)
|
|
116
120
|
|
117
121
|
static int err_pkt(git_pkt **out, const char *line, size_t len)
|
118
122
|
{
|
119
|
-
git_pkt_err *pkt
|
123
|
+
git_pkt_err *pkt;
|
120
124
|
size_t alloclen;
|
121
125
|
|
122
126
|
/* Remove "ERR " from the line */
|
123
|
-
if (git__prefixncmp(line, len, "ERR "))
|
124
|
-
goto out_err;
|
125
127
|
line += 4;
|
126
128
|
len -= 4;
|
127
129
|
|
@@ -129,20 +131,15 @@ static int err_pkt(git_pkt **out, const char *line, size_t len)
|
|
129
131
|
GITERR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1);
|
130
132
|
pkt = git__malloc(alloclen);
|
131
133
|
GITERR_CHECK_ALLOC(pkt);
|
132
|
-
pkt->type = GIT_PKT_ERR;
|
133
|
-
pkt->len = len;
|
134
134
|
|
135
|
+
pkt->type = GIT_PKT_ERR;
|
136
|
+
pkt->len = (int)len;
|
135
137
|
memcpy(pkt->error, line, len);
|
136
138
|
pkt->error[len] = '\0';
|
137
139
|
|
138
140
|
*out = (git_pkt *) pkt;
|
139
141
|
|
140
142
|
return 0;
|
141
|
-
|
142
|
-
out_err:
|
143
|
-
giterr_set(GITERR_NET, "error parsing ERR pkt-line");
|
144
|
-
git__free(pkt);
|
145
|
-
return -1;
|
146
143
|
}
|
147
144
|
|
148
145
|
static int data_pkt(git_pkt **out, const char *line, size_t len)
|
@@ -158,7 +155,7 @@ static int data_pkt(git_pkt **out, const char *line, size_t len)
|
|
158
155
|
GITERR_CHECK_ALLOC(pkt);
|
159
156
|
|
160
157
|
pkt->type = GIT_PKT_DATA;
|
161
|
-
pkt->len = len;
|
158
|
+
pkt->len = (int) len;
|
162
159
|
memcpy(pkt->data, line, len);
|
163
160
|
|
164
161
|
*out = (git_pkt *) pkt;
|
@@ -179,7 +176,7 @@ static int sideband_progress_pkt(git_pkt **out, const char *line, size_t len)
|
|
179
176
|
GITERR_CHECK_ALLOC(pkt);
|
180
177
|
|
181
178
|
pkt->type = GIT_PKT_PROGRESS;
|
182
|
-
pkt->len = len;
|
179
|
+
pkt->len = (int) len;
|
183
180
|
memcpy(pkt->data, line, len);
|
184
181
|
|
185
182
|
*out = (git_pkt *) pkt;
|
@@ -215,25 +212,28 @@ static int sideband_error_pkt(git_pkt **out, const char *line, size_t len)
|
|
215
212
|
*/
|
216
213
|
static int ref_pkt(git_pkt **out, const char *line, size_t len)
|
217
214
|
{
|
215
|
+
int error;
|
218
216
|
git_pkt_ref *pkt;
|
219
217
|
size_t alloclen;
|
220
218
|
|
221
|
-
pkt =
|
219
|
+
pkt = git__malloc(sizeof(git_pkt_ref));
|
222
220
|
GITERR_CHECK_ALLOC(pkt);
|
223
|
-
pkt->type = GIT_PKT_REF;
|
224
221
|
|
225
|
-
|
226
|
-
|
227
|
-
line
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
222
|
+
memset(pkt, 0x0, sizeof(git_pkt_ref));
|
223
|
+
pkt->type = GIT_PKT_REF;
|
224
|
+
if ((error = git_oid_fromstr(&pkt->head.oid, line)) < 0)
|
225
|
+
goto error_out;
|
226
|
+
|
227
|
+
/* Check for a bit of consistency */
|
228
|
+
if (line[GIT_OID_HEXSZ] != ' ') {
|
229
|
+
giterr_set(GITERR_NET, "error parsing pkt-line");
|
230
|
+
error = -1;
|
231
|
+
goto error_out;
|
232
|
+
}
|
234
233
|
|
235
|
-
|
236
|
-
|
234
|
+
/* Jump from the name */
|
235
|
+
line += GIT_OID_HEXSZ + 1;
|
236
|
+
len -= (GIT_OID_HEXSZ + 1);
|
237
237
|
|
238
238
|
if (line[len - 1] == '\n')
|
239
239
|
--len;
|
@@ -245,36 +245,36 @@ static int ref_pkt(git_pkt **out, const char *line, size_t len)
|
|
245
245
|
memcpy(pkt->head.name, line, len);
|
246
246
|
pkt->head.name[len] = '\0';
|
247
247
|
|
248
|
-
if (strlen(pkt->head.name) < len)
|
248
|
+
if (strlen(pkt->head.name) < len) {
|
249
249
|
pkt->capabilities = strchr(pkt->head.name, '\0') + 1;
|
250
|
+
}
|
250
251
|
|
251
252
|
*out = (git_pkt *)pkt;
|
252
253
|
return 0;
|
253
254
|
|
254
|
-
|
255
|
-
giterr_set(GITERR_NET, "error parsing REF pkt-line");
|
256
|
-
if (pkt)
|
257
|
-
git__free(pkt->head.name);
|
255
|
+
error_out:
|
258
256
|
git__free(pkt);
|
259
|
-
return
|
257
|
+
return error;
|
260
258
|
}
|
261
259
|
|
262
260
|
static int ok_pkt(git_pkt **out, const char *line, size_t len)
|
263
261
|
{
|
264
262
|
git_pkt_ok *pkt;
|
263
|
+
const char *ptr;
|
265
264
|
size_t alloc_len;
|
266
265
|
|
267
266
|
pkt = git__malloc(sizeof(*pkt));
|
268
267
|
GITERR_CHECK_ALLOC(pkt);
|
269
|
-
pkt->type = GIT_PKT_OK;
|
270
268
|
|
271
|
-
|
272
|
-
goto out_err;
|
273
|
-
line += 3;
|
274
|
-
len -= 3;
|
269
|
+
pkt->type = GIT_PKT_OK;
|
275
270
|
|
276
|
-
|
277
|
-
|
271
|
+
line += 3; /* skip "ok " */
|
272
|
+
if (!(ptr = strchr(line, '\n'))) {
|
273
|
+
giterr_set(GITERR_NET, "invalid packet line");
|
274
|
+
git__free(pkt);
|
275
|
+
return -1;
|
276
|
+
}
|
277
|
+
len = ptr - line;
|
278
278
|
|
279
279
|
GITERR_CHECK_ALLOC_ADD(&alloc_len, len, 1);
|
280
280
|
pkt->ref = git__malloc(alloc_len);
|
@@ -285,17 +285,12 @@ static int ok_pkt(git_pkt **out, const char *line, size_t len)
|
|
285
285
|
|
286
286
|
*out = (git_pkt *)pkt;
|
287
287
|
return 0;
|
288
|
-
|
289
|
-
out_err:
|
290
|
-
giterr_set(GITERR_NET, "error parsing OK pkt-line");
|
291
|
-
git__free(pkt);
|
292
|
-
return -1;
|
293
288
|
}
|
294
289
|
|
295
290
|
static int ng_pkt(git_pkt **out, const char *line, size_t len)
|
296
291
|
{
|
297
292
|
git_pkt_ng *pkt;
|
298
|
-
const char *ptr
|
293
|
+
const char *ptr;
|
299
294
|
size_t alloclen;
|
300
295
|
|
301
296
|
pkt = git__malloc(sizeof(*pkt));
|
@@ -304,13 +299,8 @@ static int ng_pkt(git_pkt **out, const char *line, size_t len)
|
|
304
299
|
pkt->ref = NULL;
|
305
300
|
pkt->type = GIT_PKT_NG;
|
306
301
|
|
307
|
-
|
308
|
-
|
309
|
-
if (git__prefixncmp(line, len, "ng "))
|
310
|
-
goto out_err;
|
311
|
-
line += 3;
|
312
|
-
|
313
|
-
if (!(ptr = memchr(line, ' ', eol - line)))
|
302
|
+
line += 3; /* skip "ng " */
|
303
|
+
if (!(ptr = strchr(line, ' ')))
|
314
304
|
goto out_err;
|
315
305
|
len = ptr - line;
|
316
306
|
|
@@ -322,10 +312,7 @@ static int ng_pkt(git_pkt **out, const char *line, size_t len)
|
|
322
312
|
pkt->ref[len] = '\0';
|
323
313
|
|
324
314
|
line = ptr + 1;
|
325
|
-
if (line
|
326
|
-
goto out_err;
|
327
|
-
|
328
|
-
if (!(ptr = memchr(line, '\n', eol - line)))
|
315
|
+
if (!(ptr = strchr(line, '\n')))
|
329
316
|
goto out_err;
|
330
317
|
len = ptr - line;
|
331
318
|
|
@@ -350,11 +337,13 @@ static int unpack_pkt(git_pkt **out, const char *line, size_t len)
|
|
350
337
|
{
|
351
338
|
git_pkt_unpack *pkt;
|
352
339
|
|
340
|
+
GIT_UNUSED(len);
|
341
|
+
|
353
342
|
pkt = git__malloc(sizeof(*pkt));
|
354
343
|
GITERR_CHECK_ALLOC(pkt);
|
355
|
-
pkt->type = GIT_PKT_UNPACK;
|
356
344
|
|
357
|
-
|
345
|
+
pkt->type = GIT_PKT_UNPACK;
|
346
|
+
if (!git__prefixcmp(line, "unpack ok"))
|
358
347
|
pkt->unpack_ok = 1;
|
359
348
|
else
|
360
349
|
pkt->unpack_ok = 0;
|
@@ -363,17 +352,13 @@ static int unpack_pkt(git_pkt **out, const char *line, size_t len)
|
|
363
352
|
return 0;
|
364
353
|
}
|
365
354
|
|
366
|
-
static
|
355
|
+
static int32_t parse_len(const char *line)
|
367
356
|
{
|
368
357
|
char num[PKT_LEN_SIZE + 1];
|
369
358
|
int i, k, error;
|
370
359
|
int32_t len;
|
371
360
|
const char *num_end;
|
372
361
|
|
373
|
-
/* Not even enough for the length */
|
374
|
-
if (linelen < PKT_LEN_SIZE)
|
375
|
-
return GIT_EBUFS;
|
376
|
-
|
377
362
|
memcpy(num, line, PKT_LEN_SIZE);
|
378
363
|
num[PKT_LEN_SIZE] = '\0';
|
379
364
|
|
@@ -385,7 +370,7 @@ static int parse_len(size_t *out, const char *line, size_t linelen)
|
|
385
370
|
num[k] = '.';
|
386
371
|
}
|
387
372
|
}
|
388
|
-
|
373
|
+
|
389
374
|
giterr_set(GITERR_NET, "invalid hex digit in length: '%s'", num);
|
390
375
|
return -1;
|
391
376
|
}
|
@@ -394,11 +379,7 @@ static int parse_len(size_t *out, const char *line, size_t linelen)
|
|
394
379
|
if ((error = git__strtol32(&len, num, &num_end, 16)) < 0)
|
395
380
|
return error;
|
396
381
|
|
397
|
-
|
398
|
-
return -1;
|
399
|
-
|
400
|
-
*out = (size_t) len;
|
401
|
-
return 0;
|
382
|
+
return len;
|
402
383
|
}
|
403
384
|
|
404
385
|
/*
|
@@ -415,32 +396,35 @@ static int parse_len(size_t *out, const char *line, size_t linelen)
|
|
415
396
|
*/
|
416
397
|
|
417
398
|
int git_pkt_parse_line(
|
418
|
-
git_pkt **
|
399
|
+
git_pkt **head, const char *line, const char **out, size_t bufflen)
|
419
400
|
{
|
420
|
-
int
|
421
|
-
|
401
|
+
int ret;
|
402
|
+
int32_t len;
|
422
403
|
|
423
|
-
|
404
|
+
/* Not even enough for the length */
|
405
|
+
if (bufflen > 0 && bufflen < PKT_LEN_SIZE)
|
406
|
+
return GIT_EBUFS;
|
407
|
+
|
408
|
+
len = parse_len(line);
|
409
|
+
if (len < 0) {
|
424
410
|
/*
|
425
|
-
* If we fail to parse the length, it might be
|
426
|
-
*
|
427
|
-
* packfile already or because we do not yet have
|
428
|
-
* enough data.
|
411
|
+
* If we fail to parse the length, it might be because the
|
412
|
+
* server is trying to send us the packfile already.
|
429
413
|
*/
|
430
|
-
if (
|
431
|
-
;
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
return
|
414
|
+
if (bufflen >= 4 && !git__prefixcmp(line, "PACK")) {
|
415
|
+
giterr_clear();
|
416
|
+
*out = line;
|
417
|
+
return pack_pkt(head);
|
418
|
+
}
|
419
|
+
|
420
|
+
return (int)len;
|
437
421
|
}
|
438
422
|
|
439
423
|
/*
|
440
|
-
*
|
441
|
-
* this line
|
424
|
+
* If we were given a buffer length, then make sure there is
|
425
|
+
* enough in the buffer to satisfy this line
|
442
426
|
*/
|
443
|
-
if (
|
427
|
+
if (bufflen > 0 && bufflen < (size_t)len)
|
444
428
|
return GIT_EBUFS;
|
445
429
|
|
446
430
|
/*
|
@@ -463,38 +447,38 @@ int git_pkt_parse_line(
|
|
463
447
|
}
|
464
448
|
|
465
449
|
if (len == 0) { /* Flush pkt */
|
466
|
-
*
|
467
|
-
return flush_pkt(
|
450
|
+
*out = line;
|
451
|
+
return flush_pkt(head);
|
468
452
|
}
|
469
453
|
|
470
454
|
len -= PKT_LEN_SIZE; /* the encoded length includes its own size */
|
471
455
|
|
472
456
|
if (*line == GIT_SIDE_BAND_DATA)
|
473
|
-
|
457
|
+
ret = data_pkt(head, line, len);
|
474
458
|
else if (*line == GIT_SIDE_BAND_PROGRESS)
|
475
|
-
|
459
|
+
ret = sideband_progress_pkt(head, line, len);
|
476
460
|
else if (*line == GIT_SIDE_BAND_ERROR)
|
477
|
-
|
478
|
-
else if (!
|
479
|
-
|
480
|
-
else if (!
|
481
|
-
|
482
|
-
else if (!
|
483
|
-
|
461
|
+
ret = sideband_error_pkt(head, line, len);
|
462
|
+
else if (!git__prefixcmp(line, "ACK"))
|
463
|
+
ret = ack_pkt(head, line, len);
|
464
|
+
else if (!git__prefixcmp(line, "NAK"))
|
465
|
+
ret = nak_pkt(head);
|
466
|
+
else if (!git__prefixcmp(line, "ERR "))
|
467
|
+
ret = err_pkt(head, line, len);
|
484
468
|
else if (*line == '#')
|
485
|
-
|
486
|
-
else if (!
|
487
|
-
|
488
|
-
else if (!
|
489
|
-
|
490
|
-
else if (!
|
491
|
-
|
469
|
+
ret = comment_pkt(head, line, len);
|
470
|
+
else if (!git__prefixcmp(line, "ok"))
|
471
|
+
ret = ok_pkt(head, line, len);
|
472
|
+
else if (!git__prefixcmp(line, "ng"))
|
473
|
+
ret = ng_pkt(head, line, len);
|
474
|
+
else if (!git__prefixcmp(line, "unpack"))
|
475
|
+
ret = unpack_pkt(head, line, len);
|
492
476
|
else
|
493
|
-
|
477
|
+
ret = ref_pkt(head, line, len);
|
494
478
|
|
495
|
-
*
|
479
|
+
*out = line + len;
|
496
480
|
|
497
|
-
return
|
481
|
+
return ret;
|
498
482
|
}
|
499
483
|
|
500
484
|
void git_pkt_free(git_pkt *pkt)
|