rugged 0.27.10 → 0.27.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/AUTHORS +0 -1
- data/vendor/libgit2/CMakeLists.txt +54 -98
- data/vendor/libgit2/COPYING +0 -28
- data/vendor/libgit2/cmake/Modules/AddCFlagIfSupported.cmake +1 -15
- data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +8 -9
- data/vendor/libgit2/cmake/Modules/FindCoreFoundation.cmake +2 -2
- data/vendor/libgit2/cmake/Modules/FindGSSAPI.cmake +1 -1
- data/vendor/libgit2/cmake/Modules/FindSecurity.cmake +2 -2
- data/vendor/libgit2/cmake/Modules/FindStatNsec.cmake +0 -6
- data/vendor/libgit2/deps/http-parser/CMakeLists.txt +0 -2
- data/vendor/libgit2/deps/http-parser/{COPYING → LICENSE-MIT} +0 -0
- data/vendor/libgit2/deps/http-parser/http_parser.c +6 -11
- data/vendor/libgit2/deps/regex/CMakeLists.txt +2 -0
- data/vendor/libgit2/deps/regex/config.h +7 -0
- data/vendor/libgit2/deps/regex/regcomp.c +3857 -0
- data/vendor/libgit2/deps/regex/regex.c +92 -0
- data/vendor/libgit2/deps/regex/regex.h +582 -0
- data/vendor/libgit2/deps/regex/regex_internal.c +1744 -0
- data/vendor/libgit2/deps/regex/regex_internal.h +819 -0
- data/vendor/libgit2/deps/regex/regexec.c +4369 -0
- data/vendor/libgit2/deps/zlib/CMakeLists.txt +0 -1
- data/vendor/libgit2/deps/zlib/adler32.c +7 -0
- data/vendor/libgit2/deps/zlib/crc32.c +7 -0
- data/vendor/libgit2/include/git2.h +0 -5
- data/vendor/libgit2/include/git2/annotated_commit.h +0 -9
- data/vendor/libgit2/include/git2/attr.h +20 -38
- data/vendor/libgit2/include/git2/blame.h +25 -42
- data/vendor/libgit2/include/git2/blob.h +13 -45
- data/vendor/libgit2/include/git2/branch.h +1 -1
- data/vendor/libgit2/include/git2/buffer.h +16 -22
- data/vendor/libgit2/include/git2/checkout.h +32 -65
- data/vendor/libgit2/include/git2/cherrypick.h +7 -9
- data/vendor/libgit2/include/git2/clone.h +10 -12
- data/vendor/libgit2/include/git2/commit.h +3 -53
- data/vendor/libgit2/include/git2/common.h +8 -60
- data/vendor/libgit2/include/git2/config.h +19 -30
- data/vendor/libgit2/include/git2/describe.h +9 -32
- data/vendor/libgit2/include/git2/diff.h +156 -208
- data/vendor/libgit2/include/git2/errors.h +46 -54
- data/vendor/libgit2/include/git2/filter.h +0 -8
- data/vendor/libgit2/include/git2/ignore.h +2 -2
- data/vendor/libgit2/include/git2/index.h +52 -74
- data/vendor/libgit2/include/git2/indexer.h +6 -76
- data/vendor/libgit2/include/git2/inttypes.h +309 -0
- data/vendor/libgit2/include/git2/merge.h +18 -35
- data/vendor/libgit2/include/git2/net.h +5 -0
- data/vendor/libgit2/include/git2/notes.h +1 -1
- data/vendor/libgit2/include/git2/object.h +29 -17
- data/vendor/libgit2/include/git2/odb.h +11 -12
- data/vendor/libgit2/include/git2/odb_backend.h +9 -10
- data/vendor/libgit2/include/git2/oid.h +2 -2
- data/vendor/libgit2/include/git2/pack.h +3 -14
- data/vendor/libgit2/include/git2/proxy.h +8 -14
- data/vendor/libgit2/include/git2/rebase.h +6 -53
- data/vendor/libgit2/include/git2/refs.h +15 -33
- data/vendor/libgit2/include/git2/refspec.h +0 -17
- data/vendor/libgit2/include/git2/remote.h +24 -123
- data/vendor/libgit2/include/git2/repository.h +39 -76
- data/vendor/libgit2/include/git2/revert.h +4 -6
- data/vendor/libgit2/include/git2/revwalk.h +7 -7
- data/vendor/libgit2/include/git2/signature.h +2 -2
- data/vendor/libgit2/include/git2/stash.h +12 -15
- data/vendor/libgit2/include/git2/status.h +20 -33
- data/vendor/libgit2/include/git2/submodule.h +12 -30
- data/vendor/libgit2/include/git2/sys/commit.h +1 -1
- data/vendor/libgit2/include/git2/sys/config.h +13 -13
- data/vendor/libgit2/include/git2/sys/filter.h +6 -6
- data/vendor/libgit2/include/git2/sys/index.h +0 -3
- data/vendor/libgit2/include/git2/sys/mempack.h +35 -35
- data/vendor/libgit2/include/git2/sys/merge.h +4 -9
- data/vendor/libgit2/include/git2/sys/odb_backend.h +22 -66
- data/vendor/libgit2/include/git2/sys/refdb_backend.h +40 -76
- data/vendor/libgit2/include/git2/sys/repository.h +1 -5
- data/vendor/libgit2/include/git2/sys/stream.h +12 -92
- data/vendor/libgit2/include/git2/sys/time.h +31 -0
- data/vendor/libgit2/include/git2/sys/transport.h +83 -129
- data/vendor/libgit2/include/git2/tag.h +4 -13
- data/vendor/libgit2/include/git2/trace.h +2 -2
- data/vendor/libgit2/include/git2/transaction.h +0 -1
- data/vendor/libgit2/include/git2/transport.h +311 -11
- data/vendor/libgit2/include/git2/tree.h +4 -4
- data/vendor/libgit2/include/git2/types.h +111 -33
- data/vendor/libgit2/include/git2/version.h +4 -4
- data/vendor/libgit2/include/git2/worktree.h +13 -48
- data/vendor/libgit2/libgit2.pc.in +13 -0
- data/vendor/libgit2/src/CMakeLists.txt +164 -96
- data/vendor/libgit2/src/annotated_commit.c +8 -15
- data/vendor/libgit2/src/apply.c +31 -537
- data/vendor/libgit2/src/apply.h +1 -3
- data/vendor/libgit2/src/array.h +2 -2
- data/vendor/libgit2/src/attr.c +75 -81
- data/vendor/libgit2/src/attr_file.c +121 -207
- data/vendor/libgit2/src/attr_file.h +9 -9
- data/vendor/libgit2/src/attrcache.c +53 -51
- data/vendor/libgit2/src/attrcache.h +1 -2
- data/vendor/libgit2/src/blame.c +20 -47
- data/vendor/libgit2/src/blame.h +1 -2
- data/vendor/libgit2/src/blame_git.c +20 -37
- data/vendor/libgit2/src/blob.c +42 -128
- data/vendor/libgit2/src/blob.h +2 -19
- data/vendor/libgit2/src/branch.c +43 -67
- data/vendor/libgit2/src/buf_text.c +6 -7
- data/vendor/libgit2/src/buffer.c +57 -69
- data/vendor/libgit2/src/buffer.h +1 -1
- data/vendor/libgit2/src/cache.c +45 -38
- data/vendor/libgit2/src/cache.h +3 -3
- data/vendor/libgit2/src/cc-compat.h +3 -20
- data/vendor/libgit2/src/checkout.c +90 -109
- data/vendor/libgit2/src/cherrypick.c +9 -15
- data/vendor/libgit2/src/clone.c +27 -49
- data/vendor/libgit2/src/clone.h +0 -4
- data/vendor/libgit2/src/commit.c +49 -117
- data/vendor/libgit2/src/commit.h +0 -7
- data/vendor/libgit2/src/commit_list.c +78 -30
- data/vendor/libgit2/src/commit_list.h +2 -2
- data/vendor/libgit2/src/common.h +91 -27
- data/vendor/libgit2/src/config.c +176 -194
- data/vendor/libgit2/src/config.h +20 -8
- data/vendor/libgit2/src/config_cache.c +35 -41
- data/vendor/libgit2/src/config_file.c +753 -439
- data/vendor/libgit2/src/config_file.h +73 -0
- data/vendor/libgit2/src/config_parse.c +63 -114
- data/vendor/libgit2/src/config_parse.h +16 -17
- data/vendor/libgit2/src/crlf.c +190 -219
- data/vendor/libgit2/src/delta.c +18 -25
- data/vendor/libgit2/src/describe.c +41 -42
- data/vendor/libgit2/src/diff.c +68 -53
- data/vendor/libgit2/src/diff.h +1 -2
- data/vendor/libgit2/src/diff_driver.c +49 -47
- data/vendor/libgit2/src/diff_file.c +17 -19
- data/vendor/libgit2/src/diff_file.h +1 -1
- data/vendor/libgit2/src/diff_generate.c +106 -162
- data/vendor/libgit2/src/diff_generate.h +3 -3
- data/vendor/libgit2/src/diff_parse.c +4 -4
- data/vendor/libgit2/src/diff_print.c +30 -42
- data/vendor/libgit2/src/diff_stats.c +7 -22
- data/vendor/libgit2/src/diff_tform.c +16 -16
- data/vendor/libgit2/src/diff_xdiff.c +3 -15
- data/vendor/libgit2/src/errors.c +39 -51
- data/vendor/libgit2/src/features.h.in +3 -11
- data/vendor/libgit2/src/fetch.c +5 -10
- data/vendor/libgit2/src/fetchhead.c +17 -17
- data/vendor/libgit2/src/filebuf.c +36 -32
- data/vendor/libgit2/src/filebuf.h +2 -2
- data/vendor/libgit2/src/{futils.c → fileops.c} +73 -80
- data/vendor/libgit2/src/{futils.h → fileops.h} +6 -6
- data/vendor/libgit2/src/filter.c +38 -46
- data/vendor/libgit2/src/filter.h +10 -0
- data/vendor/libgit2/src/fnmatch.c +248 -0
- data/vendor/libgit2/src/fnmatch.h +48 -0
- data/vendor/libgit2/src/global.c +63 -48
- data/vendor/libgit2/src/global.h +2 -0
- data/vendor/libgit2/src/hash.c +0 -61
- data/vendor/libgit2/src/hash.h +19 -20
- data/vendor/libgit2/src/hash/hash_collisiondetect.h +47 -0
- data/vendor/libgit2/src/hash/{sha1/common_crypto.c → hash_common_crypto.h} +17 -17
- data/vendor/libgit2/src/hash/{sha1/generic.c → hash_generic.c} +10 -22
- data/vendor/libgit2/src/hash/{sha1/generic.h → hash_generic.h} +10 -4
- data/vendor/libgit2/src/hash/hash_openssl.h +59 -0
- data/vendor/libgit2/src/hash/{sha1/win32.c → hash_win32.c} +37 -47
- data/vendor/libgit2/src/hash/{sha1/win32.h → hash_win32.h} +19 -6
- data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/sha1.c +3 -14
- data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/sha1.h +0 -0
- data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/ubc_check.c +0 -0
- data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/ubc_check.h +0 -0
- data/vendor/libgit2/src/hashsig.c +5 -5
- data/vendor/libgit2/src/idxmap.c +61 -107
- data/vendor/libgit2/src/idxmap.h +31 -153
- data/vendor/libgit2/src/ignore.c +47 -43
- data/vendor/libgit2/src/index.c +232 -337
- data/vendor/libgit2/src/index.h +1 -17
- data/vendor/libgit2/src/indexer.c +175 -346
- data/vendor/libgit2/src/integer.h +26 -71
- data/vendor/libgit2/src/iterator.c +70 -142
- data/vendor/libgit2/src/iterator.h +0 -15
- data/vendor/libgit2/src/khash.h +1 -3
- data/vendor/libgit2/src/map.h +1 -1
- data/vendor/libgit2/src/merge.c +100 -144
- data/vendor/libgit2/src/merge_driver.c +11 -11
- data/vendor/libgit2/src/merge_file.c +2 -2
- data/vendor/libgit2/src/mwindow.c +29 -24
- data/vendor/libgit2/src/mwindow.h +4 -4
- data/vendor/libgit2/src/netops.c +156 -55
- data/vendor/libgit2/src/netops.h +23 -3
- data/vendor/libgit2/src/notes.c +11 -16
- data/vendor/libgit2/src/object.c +69 -120
- data/vendor/libgit2/src/object.h +9 -22
- data/vendor/libgit2/src/object_api.c +8 -8
- data/vendor/libgit2/src/odb.c +93 -116
- data/vendor/libgit2/src/odb.h +7 -8
- data/vendor/libgit2/src/odb_loose.c +55 -62
- data/vendor/libgit2/src/odb_mempack.c +34 -21
- data/vendor/libgit2/src/odb_pack.c +14 -18
- data/vendor/libgit2/src/offmap.c +35 -53
- data/vendor/libgit2/src/offmap.h +21 -108
- data/vendor/libgit2/src/oid.c +7 -12
- data/vendor/libgit2/src/oidmap.c +47 -49
- data/vendor/libgit2/src/oidmap.h +24 -101
- data/vendor/libgit2/src/pack-objects.c +87 -88
- data/vendor/libgit2/src/pack-objects.h +8 -2
- data/vendor/libgit2/src/pack.c +101 -99
- data/vendor/libgit2/src/pack.h +19 -17
- data/vendor/libgit2/src/parse.c +0 -10
- data/vendor/libgit2/src/parse.h +3 -3
- data/vendor/libgit2/src/patch.c +4 -4
- data/vendor/libgit2/src/patch_generate.c +20 -20
- data/vendor/libgit2/src/patch_parse.c +63 -151
- data/vendor/libgit2/src/path.c +104 -117
- data/vendor/libgit2/src/path.h +71 -3
- data/vendor/libgit2/src/pathspec.c +19 -19
- data/vendor/libgit2/src/pool.c +22 -26
- data/vendor/libgit2/src/pool.h +7 -7
- data/vendor/libgit2/src/posix.c +10 -10
- data/vendor/libgit2/src/posix.h +1 -12
- data/vendor/libgit2/src/proxy.c +3 -8
- data/vendor/libgit2/src/push.c +31 -37
- data/vendor/libgit2/src/push.h +1 -2
- data/vendor/libgit2/src/rebase.c +59 -115
- data/vendor/libgit2/src/refdb.c +3 -15
- data/vendor/libgit2/src/refdb_fs.c +254 -381
- data/vendor/libgit2/src/reflog.c +15 -13
- data/vendor/libgit2/src/refs.c +88 -118
- data/vendor/libgit2/src/refs.h +3 -5
- data/vendor/libgit2/src/refspec.c +37 -56
- data/vendor/libgit2/src/refspec.h +1 -1
- data/vendor/libgit2/src/remote.c +215 -266
- data/vendor/libgit2/src/remote.h +2 -11
- data/vendor/libgit2/src/repository.c +225 -280
- data/vendor/libgit2/src/repository.h +40 -52
- data/vendor/libgit2/src/reset.c +8 -8
- data/vendor/libgit2/src/revert.c +9 -14
- data/vendor/libgit2/src/revparse.c +48 -47
- data/vendor/libgit2/src/revwalk.c +57 -120
- data/vendor/libgit2/src/revwalk.h +1 -22
- data/vendor/libgit2/src/settings.c +10 -47
- data/vendor/libgit2/src/signature.c +11 -11
- data/vendor/libgit2/src/sortedcache.c +36 -22
- data/vendor/libgit2/src/sortedcache.h +1 -1
- data/vendor/libgit2/src/stash.c +99 -125
- data/vendor/libgit2/src/status.c +22 -28
- data/vendor/libgit2/src/stream.h +2 -17
- data/vendor/libgit2/src/streams/curl.c +385 -0
- data/vendor/libgit2/src/{allocators/stdalloc.h → streams/curl.h} +5 -5
- data/vendor/libgit2/src/streams/openssl.c +114 -224
- data/vendor/libgit2/src/streams/openssl.h +108 -4
- data/vendor/libgit2/src/streams/socket.c +30 -55
- data/vendor/libgit2/src/streams/stransport.c +32 -57
- data/vendor/libgit2/src/streams/stransport.h +0 -5
- data/vendor/libgit2/src/streams/tls.c +19 -50
- data/vendor/libgit2/src/streams/tls.h +4 -12
- data/vendor/libgit2/src/strmap.c +74 -47
- data/vendor/libgit2/src/strmap.h +33 -108
- data/vendor/libgit2/src/submodule.c +216 -272
- data/vendor/libgit2/src/submodule.h +1 -1
- data/vendor/libgit2/src/sysdir.c +19 -29
- data/vendor/libgit2/src/tag.c +28 -41
- data/vendor/libgit2/src/tag.h +1 -2
- data/vendor/libgit2/src/trace.c +2 -2
- data/vendor/libgit2/src/trace.h +3 -3
- data/vendor/libgit2/src/trailer.c +38 -52
- data/vendor/libgit2/src/transaction.c +29 -30
- data/vendor/libgit2/src/transport.c +5 -5
- data/vendor/libgit2/src/transports/auth.c +11 -15
- data/vendor/libgit2/src/transports/auth.h +3 -10
- data/vendor/libgit2/src/transports/auth_negotiate.c +18 -33
- data/vendor/libgit2/src/transports/auth_negotiate.h +2 -2
- data/vendor/libgit2/src/transports/cred.c +24 -24
- data/vendor/libgit2/src/{allocators/win32_crtdbg.h → transports/cred.h} +4 -5
- data/vendor/libgit2/src/transports/git.c +31 -26
- data/vendor/libgit2/src/transports/http.c +348 -881
- data/vendor/libgit2/src/transports/http.h +0 -2
- data/vendor/libgit2/src/transports/local.c +35 -35
- data/vendor/libgit2/src/transports/smart.c +47 -70
- data/vendor/libgit2/src/transports/smart.h +4 -3
- data/vendor/libgit2/src/transports/smart_pkt.c +40 -43
- data/vendor/libgit2/src/transports/smart_protocol.c +116 -96
- data/vendor/libgit2/src/transports/ssh.c +66 -77
- data/vendor/libgit2/src/transports/winhttp.c +314 -318
- data/vendor/libgit2/src/tree-cache.c +12 -19
- data/vendor/libgit2/src/tree.c +142 -103
- data/vendor/libgit2/src/tree.h +12 -1
- data/vendor/libgit2/src/unix/map.c +3 -3
- data/vendor/libgit2/src/unix/posix.h +11 -1
- data/vendor/libgit2/src/userdiff.h +1 -3
- data/vendor/libgit2/src/util.c +56 -70
- data/vendor/libgit2/src/util.h +156 -28
- data/vendor/libgit2/src/vector.c +4 -4
- data/vendor/libgit2/src/win32/dir.c +3 -3
- data/vendor/libgit2/src/win32/findfile.c +3 -3
- data/vendor/libgit2/src/win32/map.c +11 -9
- data/vendor/libgit2/src/win32/msvc-compat.h +0 -6
- data/vendor/libgit2/src/win32/path_w32.c +9 -113
- data/vendor/libgit2/src/win32/path_w32.h +29 -18
- data/vendor/libgit2/src/win32/posix.h +4 -1
- data/vendor/libgit2/src/win32/posix_w32.c +45 -70
- data/vendor/libgit2/src/win32/precompiled.h +2 -0
- data/vendor/libgit2/src/win32/thread.c +10 -5
- data/vendor/libgit2/src/win32/w32_buffer.c +5 -9
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +2 -3
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +75 -26
- data/vendor/libgit2/src/win32/w32_stack.c +11 -6
- data/vendor/libgit2/src/win32/w32_stack.h +3 -3
- data/vendor/libgit2/src/win32/w32_util.c +64 -27
- data/vendor/libgit2/src/win32/w32_util.h +49 -5
- data/vendor/libgit2/src/worktree.c +60 -95
- data/vendor/libgit2/src/worktree.h +0 -2
- data/vendor/libgit2/src/xdiff/xdiffi.c +5 -7
- data/vendor/libgit2/src/xdiff/xhistogram.c +1 -1
- data/vendor/libgit2/src/xdiff/xmerge.c +15 -27
- data/vendor/libgit2/src/xdiff/xpatience.c +0 -3
- data/vendor/libgit2/src/zstream.c +4 -4
- metadata +33 -122
- data/vendor/libgit2/cmake/Modules/FindGSSFramework.cmake +0 -28
- data/vendor/libgit2/cmake/Modules/FindPCRE.cmake +0 -38
- data/vendor/libgit2/cmake/Modules/FindPCRE2.cmake +0 -37
- data/vendor/libgit2/cmake/Modules/FindmbedTLS.cmake +0 -93
- data/vendor/libgit2/cmake/Modules/PkgBuildConfig.cmake +0 -110
- data/vendor/libgit2/cmake/Modules/SelectGSSAPI.cmake +0 -53
- data/vendor/libgit2/cmake/Modules/SelectHTTPSBackend.cmake +0 -124
- data/vendor/libgit2/cmake/Modules/SelectHashes.cmake +0 -66
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +0 -21
- data/vendor/libgit2/deps/ntlmclient/compat.h +0 -33
- data/vendor/libgit2/deps/ntlmclient/crypt.h +0 -64
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +0 -120
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.h +0 -18
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +0 -145
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.h +0 -18
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +0 -130
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.h +0 -21
- data/vendor/libgit2/deps/ntlmclient/ntlm.c +0 -1420
- data/vendor/libgit2/deps/ntlmclient/ntlm.h +0 -174
- data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +0 -320
- data/vendor/libgit2/deps/ntlmclient/unicode.h +0 -36
- data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +0 -445
- data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +0 -201
- data/vendor/libgit2/deps/ntlmclient/utf8.h +0 -1257
- data/vendor/libgit2/deps/ntlmclient/util.c +0 -21
- data/vendor/libgit2/deps/ntlmclient/util.h +0 -14
- data/vendor/libgit2/deps/pcre/CMakeLists.txt +0 -140
- data/vendor/libgit2/deps/pcre/COPYING +0 -5
- data/vendor/libgit2/deps/pcre/cmake/COPYING-CMAKE-SCRIPTS +0 -22
- data/vendor/libgit2/deps/pcre/cmake/FindEditline.cmake +0 -17
- data/vendor/libgit2/deps/pcre/cmake/FindPackageHandleStandardArgs.cmake +0 -58
- data/vendor/libgit2/deps/pcre/cmake/FindReadline.cmake +0 -29
- data/vendor/libgit2/deps/pcre/config.h.in +0 -57
- data/vendor/libgit2/deps/pcre/pcre.h +0 -641
- data/vendor/libgit2/deps/pcre/pcre_byte_order.c +0 -319
- data/vendor/libgit2/deps/pcre/pcre_chartables.c +0 -198
- data/vendor/libgit2/deps/pcre/pcre_compile.c +0 -9800
- data/vendor/libgit2/deps/pcre/pcre_config.c +0 -190
- data/vendor/libgit2/deps/pcre/pcre_dfa_exec.c +0 -3676
- data/vendor/libgit2/deps/pcre/pcre_exec.c +0 -7173
- data/vendor/libgit2/deps/pcre/pcre_fullinfo.c +0 -245
- data/vendor/libgit2/deps/pcre/pcre_get.c +0 -669
- data/vendor/libgit2/deps/pcre/pcre_globals.c +0 -86
- data/vendor/libgit2/deps/pcre/pcre_internal.h +0 -2787
- data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +0 -11913
- data/vendor/libgit2/deps/pcre/pcre_maketables.c +0 -156
- data/vendor/libgit2/deps/pcre/pcre_newline.c +0 -210
- data/vendor/libgit2/deps/pcre/pcre_ord2utf8.c +0 -94
- data/vendor/libgit2/deps/pcre/pcre_printint.c +0 -834
- data/vendor/libgit2/deps/pcre/pcre_refcount.c +0 -92
- data/vendor/libgit2/deps/pcre/pcre_string_utils.c +0 -211
- data/vendor/libgit2/deps/pcre/pcre_study.c +0 -1686
- data/vendor/libgit2/deps/pcre/pcre_tables.c +0 -727
- data/vendor/libgit2/deps/pcre/pcre_ucd.c +0 -3644
- data/vendor/libgit2/deps/pcre/pcre_valid_utf8.c +0 -301
- data/vendor/libgit2/deps/pcre/pcre_version.c +0 -98
- data/vendor/libgit2/deps/pcre/pcre_xclass.c +0 -268
- data/vendor/libgit2/deps/pcre/pcreposix.c +0 -421
- data/vendor/libgit2/deps/pcre/pcreposix.h +0 -117
- data/vendor/libgit2/deps/pcre/ucp.h +0 -224
- data/vendor/libgit2/deps/winhttp/COPYING.GPL +0 -993
- data/vendor/libgit2/deps/winhttp/COPYING.LGPL +0 -502
- data/vendor/libgit2/deps/zlib/COPYING +0 -27
- data/vendor/libgit2/include/git2/apply.h +0 -149
- data/vendor/libgit2/include/git2/cert.h +0 -135
- data/vendor/libgit2/include/git2/cred.h +0 -308
- data/vendor/libgit2/include/git2/deprecated.h +0 -493
- data/vendor/libgit2/include/git2/mailmap.h +0 -115
- data/vendor/libgit2/include/git2/sys/alloc.h +0 -101
- data/vendor/libgit2/include/git2/sys/cred.h +0 -90
- data/vendor/libgit2/include/git2/sys/path.h +0 -64
- data/vendor/libgit2/src/alloc.c +0 -43
- data/vendor/libgit2/src/alloc.h +0 -40
- data/vendor/libgit2/src/allocators/stdalloc.c +0 -119
- data/vendor/libgit2/src/allocators/win32_crtdbg.c +0 -118
- data/vendor/libgit2/src/config_backend.h +0 -96
- data/vendor/libgit2/src/config_entries.c +0 -229
- data/vendor/libgit2/src/config_entries.h +0 -24
- data/vendor/libgit2/src/config_mem.c +0 -220
- data/vendor/libgit2/src/config_snapshot.c +0 -206
- data/vendor/libgit2/src/errors.h +0 -81
- data/vendor/libgit2/src/hash/sha1.h +0 -38
- data/vendor/libgit2/src/hash/sha1/collisiondetect.c +0 -48
- data/vendor/libgit2/src/hash/sha1/collisiondetect.h +0 -19
- data/vendor/libgit2/src/hash/sha1/common_crypto.h +0 -19
- data/vendor/libgit2/src/hash/sha1/mbedtls.c +0 -46
- data/vendor/libgit2/src/hash/sha1/mbedtls.h +0 -19
- data/vendor/libgit2/src/hash/sha1/openssl.c +0 -59
- data/vendor/libgit2/src/hash/sha1/openssl.h +0 -19
- data/vendor/libgit2/src/mailmap.c +0 -485
- data/vendor/libgit2/src/mailmap.h +0 -35
- data/vendor/libgit2/src/net.c +0 -184
- data/vendor/libgit2/src/net.h +0 -36
- data/vendor/libgit2/src/reader.c +0 -265
- data/vendor/libgit2/src/reader.h +0 -107
- data/vendor/libgit2/src/regexp.c +0 -221
- data/vendor/libgit2/src/regexp.h +0 -97
- data/vendor/libgit2/src/streams/mbedtls.c +0 -483
- data/vendor/libgit2/src/streams/mbedtls.h +0 -23
- data/vendor/libgit2/src/streams/registry.c +0 -118
- data/vendor/libgit2/src/streams/registry.h +0 -19
- data/vendor/libgit2/src/transports/auth_ntlm.c +0 -223
- data/vendor/libgit2/src/transports/auth_ntlm.h +0 -35
- data/vendor/libgit2/src/wildmatch.c +0 -320
- data/vendor/libgit2/src/wildmatch.h +0 -23
- data/vendor/libgit2/src/win32/w32_common.h +0 -39
data/vendor/libgit2/src/remote.h
CHANGED
@@ -29,23 +29,14 @@ struct git_remote {
|
|
29
29
|
git_transport *transport;
|
30
30
|
git_repository *repo;
|
31
31
|
git_push *push;
|
32
|
-
|
32
|
+
git_transfer_progress stats;
|
33
33
|
unsigned int need_pack;
|
34
34
|
git_remote_autotag_option_t download_tags;
|
35
35
|
int prune_refs;
|
36
36
|
int passed_refspecs;
|
37
37
|
};
|
38
38
|
|
39
|
-
|
40
|
-
const git_strarray *custom_headers;
|
41
|
-
const git_proxy_options *proxy;
|
42
|
-
} git_remote_connection_opts;
|
43
|
-
|
44
|
-
#define GIT_REMOTE_CONNECTION_OPTIONS_INIT { NULL, NULL }
|
45
|
-
|
46
|
-
int git_remote__connect(git_remote *remote, git_direction direction, const git_remote_callbacks *callbacks, const git_remote_connection_opts *conn);
|
47
|
-
|
48
|
-
int git_remote__urlfordirection(git_buf *url_out, struct git_remote *remote, int direction, const git_remote_callbacks *callbacks);
|
39
|
+
const char* git_remote__urlfordirection(struct git_remote *remote, int direction);
|
49
40
|
int git_remote__get_http_proxy(git_remote *remote, bool use_ssl, char **proxy_url);
|
50
41
|
|
51
42
|
git_refspec *git_remote__matching_refspec(git_remote *remote, const char *refname);
|
@@ -16,7 +16,7 @@
|
|
16
16
|
#include "commit.h"
|
17
17
|
#include "tag.h"
|
18
18
|
#include "blob.h"
|
19
|
-
#include "
|
19
|
+
#include "fileops.h"
|
20
20
|
#include "sysdir.h"
|
21
21
|
#include "filebuf.h"
|
22
22
|
#include "index.h"
|
@@ -42,24 +42,23 @@ bool git_repository__fsync_gitdir = false;
|
|
42
42
|
|
43
43
|
static const struct {
|
44
44
|
git_repository_item_t parent;
|
45
|
-
git_repository_item_t fallback;
|
46
45
|
const char *name;
|
47
46
|
bool directory;
|
48
47
|
} items[] = {
|
49
|
-
{ GIT_REPOSITORY_ITEM_GITDIR,
|
50
|
-
{ GIT_REPOSITORY_ITEM_WORKDIR,
|
51
|
-
{ GIT_REPOSITORY_ITEM_COMMONDIR,
|
52
|
-
{ GIT_REPOSITORY_ITEM_GITDIR,
|
53
|
-
{ GIT_REPOSITORY_ITEM_COMMONDIR,
|
54
|
-
{ GIT_REPOSITORY_ITEM_COMMONDIR,
|
55
|
-
{ GIT_REPOSITORY_ITEM_COMMONDIR,
|
56
|
-
{ GIT_REPOSITORY_ITEM_COMMONDIR,
|
57
|
-
{ GIT_REPOSITORY_ITEM_COMMONDIR,
|
58
|
-
{ GIT_REPOSITORY_ITEM_COMMONDIR,
|
59
|
-
{ GIT_REPOSITORY_ITEM_COMMONDIR,
|
60
|
-
{ GIT_REPOSITORY_ITEM_COMMONDIR,
|
61
|
-
{ GIT_REPOSITORY_ITEM_GITDIR,
|
62
|
-
{ GIT_REPOSITORY_ITEM_COMMONDIR,
|
48
|
+
{ GIT_REPOSITORY_ITEM_GITDIR, NULL, true },
|
49
|
+
{ GIT_REPOSITORY_ITEM_WORKDIR, NULL, true },
|
50
|
+
{ GIT_REPOSITORY_ITEM_COMMONDIR, NULL, true },
|
51
|
+
{ GIT_REPOSITORY_ITEM_GITDIR, "index", false },
|
52
|
+
{ GIT_REPOSITORY_ITEM_COMMONDIR, "objects", true },
|
53
|
+
{ GIT_REPOSITORY_ITEM_COMMONDIR, "refs", true },
|
54
|
+
{ GIT_REPOSITORY_ITEM_COMMONDIR, "packed-refs", false },
|
55
|
+
{ GIT_REPOSITORY_ITEM_COMMONDIR, "remotes", true },
|
56
|
+
{ GIT_REPOSITORY_ITEM_COMMONDIR, "config", false },
|
57
|
+
{ GIT_REPOSITORY_ITEM_COMMONDIR, "info", true },
|
58
|
+
{ GIT_REPOSITORY_ITEM_COMMONDIR, "hooks", true },
|
59
|
+
{ GIT_REPOSITORY_ITEM_COMMONDIR, "logs", true },
|
60
|
+
{ GIT_REPOSITORY_ITEM_GITDIR, "modules", true },
|
61
|
+
{ GIT_REPOSITORY_ITEM_COMMONDIR, "worktrees", true }
|
63
62
|
};
|
64
63
|
|
65
64
|
static int check_repositoryformatversion(git_config *config);
|
@@ -122,7 +121,7 @@ static void set_config(git_repository *repo, git_config *config)
|
|
122
121
|
git_config_free(config);
|
123
122
|
}
|
124
123
|
|
125
|
-
|
124
|
+
git_repository__cvar_cache_clear(repo);
|
126
125
|
}
|
127
126
|
|
128
127
|
static void set_index(git_repository *repo, git_index *index)
|
@@ -161,13 +160,13 @@ void git_repository_free(git_repository *repo)
|
|
161
160
|
|
162
161
|
git_repository__cleanup(repo);
|
163
162
|
|
164
|
-
|
163
|
+
git_cache_free(&repo->objects);
|
165
164
|
|
166
165
|
git_diff_driver_registry_free(repo->diff_drivers);
|
167
166
|
repo->diff_drivers = NULL;
|
168
167
|
|
169
168
|
for (i = 0; i < repo->reserved_names.size; i++)
|
170
|
-
|
169
|
+
git_buf_free(git_array_get(repo->reserved_names, i));
|
171
170
|
git_array_clear(repo->reserved_names);
|
172
171
|
|
173
172
|
git__free(repo->gitlink);
|
@@ -204,7 +203,7 @@ static bool valid_repository_path(git_buf *repository_path, git_buf *common_path
|
|
204
203
|
git_buf_swap(common_path, &common_link);
|
205
204
|
}
|
206
205
|
|
207
|
-
|
206
|
+
git_buf_free(&common_link);
|
208
207
|
}
|
209
208
|
else {
|
210
209
|
git_buf_set(common_path, repository_path->ptr, repository_path->size);
|
@@ -239,14 +238,14 @@ static git_repository *repository_alloc(void)
|
|
239
238
|
if (!repo->reserved_names.ptr)
|
240
239
|
goto on_error;
|
241
240
|
|
242
|
-
/* set all the entries in the
|
243
|
-
|
241
|
+
/* set all the entries in the cvar cache to `unset` */
|
242
|
+
git_repository__cvar_cache_clear(repo);
|
244
243
|
|
245
244
|
return repo;
|
246
245
|
|
247
246
|
on_error:
|
248
247
|
if (repo)
|
249
|
-
|
248
|
+
git_cache_free(&repo->objects);
|
250
249
|
|
251
250
|
git__free(repo);
|
252
251
|
return NULL;
|
@@ -257,7 +256,7 @@ int git_repository_new(git_repository **out)
|
|
257
256
|
git_repository *repo;
|
258
257
|
|
259
258
|
*out = repo = repository_alloc();
|
260
|
-
|
259
|
+
GITERR_CHECK_ALLOC(repo);
|
261
260
|
|
262
261
|
repo->is_bare = 1;
|
263
262
|
repo->is_worktree = 0;
|
@@ -332,9 +331,9 @@ static int load_workdir(git_repository *repo, git_config *config, git_buf *paren
|
|
332
331
|
repo->workdir = git_buf_detach(&worktree);
|
333
332
|
}
|
334
333
|
|
335
|
-
|
334
|
+
GITERR_CHECK_ALLOC(repo->workdir);
|
336
335
|
cleanup:
|
337
|
-
|
336
|
+
git_buf_free(&path);
|
338
337
|
git_config_entry_free(ce);
|
339
338
|
return error;
|
340
339
|
}
|
@@ -414,7 +413,7 @@ static int read_gitfile(git_buf *path_out, const char *file_path)
|
|
414
413
|
if (git_buf_len(&file) <= prefix_len ||
|
415
414
|
memcmp(git_buf_cstr(&file), GIT_FILE_CONTENT_PREFIX, prefix_len) != 0)
|
416
415
|
{
|
417
|
-
|
416
|
+
giterr_set(GITERR_REPOSITORY,
|
418
417
|
"the `.git` file at '%s' is malformed", file_path);
|
419
418
|
error = -1;
|
420
419
|
}
|
@@ -426,7 +425,7 @@ static int read_gitfile(git_buf *path_out, const char *file_path)
|
|
426
425
|
path_out, gitlink, git_buf_cstr(path_out));
|
427
426
|
}
|
428
427
|
|
429
|
-
|
428
|
+
git_buf_free(&file);
|
430
429
|
return error;
|
431
430
|
}
|
432
431
|
|
@@ -552,14 +551,14 @@ static int find_repo(
|
|
552
551
|
/* If we didn't find the repository, and we don't have any other error
|
553
552
|
* to report, report that. */
|
554
553
|
if (!git_buf_len(gitdir_path) && !error) {
|
555
|
-
|
554
|
+
giterr_set(GITERR_REPOSITORY,
|
556
555
|
"could not find repository from '%s'", start_path);
|
557
556
|
error = GIT_ENOTFOUND;
|
558
557
|
}
|
559
558
|
|
560
|
-
|
561
|
-
|
562
|
-
|
559
|
+
git_buf_free(&path);
|
560
|
+
git_buf_free(&repo_link);
|
561
|
+
git_buf_free(&common_link);
|
563
562
|
return error;
|
564
563
|
}
|
565
564
|
|
@@ -575,19 +574,19 @@ int git_repository_open_bare(
|
|
575
574
|
return error;
|
576
575
|
|
577
576
|
if (!valid_repository_path(&path, &common_path)) {
|
578
|
-
|
579
|
-
|
580
|
-
|
577
|
+
git_buf_free(&path);
|
578
|
+
git_buf_free(&common_path);
|
579
|
+
giterr_set(GITERR_REPOSITORY, "path is not a repository: %s", bare_path);
|
581
580
|
return GIT_ENOTFOUND;
|
582
581
|
}
|
583
582
|
|
584
583
|
repo = repository_alloc();
|
585
|
-
|
584
|
+
GITERR_CHECK_ALLOC(repo);
|
586
585
|
|
587
586
|
repo->gitdir = git_buf_detach(&path);
|
588
|
-
|
587
|
+
GITERR_CHECK_ALLOC(repo->gitdir);
|
589
588
|
repo->commondir = git_buf_detach(&common_path);
|
590
|
-
|
589
|
+
GITERR_CHECK_ALLOC(repo->commondir);
|
591
590
|
|
592
591
|
/* of course we're bare! */
|
593
592
|
repo->is_bare = 1;
|
@@ -621,7 +620,7 @@ static int _git_repository_open_ext_from_env(
|
|
621
620
|
if (!start_path) {
|
622
621
|
error = git__getenv(&dir_buf, "GIT_DIR");
|
623
622
|
if (error == GIT_ENOTFOUND) {
|
624
|
-
|
623
|
+
giterr_clear();
|
625
624
|
start_path = ".";
|
626
625
|
} else if (error < 0)
|
627
626
|
goto error;
|
@@ -634,7 +633,7 @@ static int _git_repository_open_ext_from_env(
|
|
634
633
|
|
635
634
|
error = git__getenv(&ceiling_dirs_buf, "GIT_CEILING_DIRECTORIES");
|
636
635
|
if (error == GIT_ENOTFOUND)
|
637
|
-
|
636
|
+
giterr_clear();
|
638
637
|
else if (error < 0)
|
639
638
|
goto error;
|
640
639
|
else
|
@@ -642,7 +641,7 @@ static int _git_repository_open_ext_from_env(
|
|
642
641
|
|
643
642
|
error = git__getenv(&across_fs_buf, "GIT_DISCOVERY_ACROSS_FILESYSTEM");
|
644
643
|
if (error == GIT_ENOTFOUND)
|
645
|
-
|
644
|
+
giterr_clear();
|
646
645
|
else if (error < 0)
|
647
646
|
goto error;
|
648
647
|
else {
|
@@ -656,7 +655,7 @@ static int _git_repository_open_ext_from_env(
|
|
656
655
|
|
657
656
|
error = git__getenv(&index_file_buf, "GIT_INDEX_FILE");
|
658
657
|
if (error == GIT_ENOTFOUND)
|
659
|
-
|
658
|
+
giterr_clear();
|
660
659
|
else if (error < 0)
|
661
660
|
goto error;
|
662
661
|
else {
|
@@ -667,13 +666,13 @@ static int _git_repository_open_ext_from_env(
|
|
667
666
|
|
668
667
|
error = git__getenv(&namespace_buf, "GIT_NAMESPACE");
|
669
668
|
if (error == GIT_ENOTFOUND)
|
670
|
-
|
669
|
+
giterr_clear();
|
671
670
|
else if (error < 0)
|
672
671
|
goto error;
|
673
672
|
|
674
673
|
error = git__getenv(&object_dir_buf, "GIT_OBJECT_DIRECTORY");
|
675
674
|
if (error == GIT_ENOTFOUND)
|
676
|
-
|
675
|
+
giterr_clear();
|
677
676
|
else if (error < 0)
|
678
677
|
goto error;
|
679
678
|
else {
|
@@ -684,22 +683,22 @@ static int _git_repository_open_ext_from_env(
|
|
684
683
|
|
685
684
|
error = git__getenv(&work_tree_buf, "GIT_WORK_TREE");
|
686
685
|
if (error == GIT_ENOTFOUND)
|
687
|
-
|
686
|
+
giterr_clear();
|
688
687
|
else if (error < 0)
|
689
688
|
goto error;
|
690
689
|
else {
|
691
|
-
|
690
|
+
giterr_set(GITERR_INVALID, "GIT_WORK_TREE unimplemented");
|
692
691
|
error = GIT_ERROR;
|
693
692
|
goto error;
|
694
693
|
}
|
695
694
|
|
696
695
|
error = git__getenv(&work_tree_buf, "GIT_COMMON_DIR");
|
697
696
|
if (error == GIT_ENOTFOUND)
|
698
|
-
|
697
|
+
giterr_clear();
|
699
698
|
else if (error < 0)
|
700
699
|
goto error;
|
701
700
|
else {
|
702
|
-
|
701
|
+
giterr_set(GITERR_INVALID, "GIT_COMMON_DIR unimplemented");
|
703
702
|
error = GIT_ERROR;
|
704
703
|
goto error;
|
705
704
|
}
|
@@ -713,7 +712,7 @@ static int _git_repository_open_ext_from_env(
|
|
713
712
|
|
714
713
|
error = git__getenv(&alts_buf, "GIT_ALTERNATE_OBJECT_DIRECTORIES");
|
715
714
|
if (error == GIT_ENOTFOUND) {
|
716
|
-
|
715
|
+
giterr_clear();
|
717
716
|
error = 0;
|
718
717
|
} else if (error < 0)
|
719
718
|
goto error;
|
@@ -755,15 +754,15 @@ error:
|
|
755
754
|
success:
|
756
755
|
git_odb_free(odb);
|
757
756
|
git_index_free(index);
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
757
|
+
git_buf_free(&common_dir_buf);
|
758
|
+
git_buf_free(&work_tree_buf);
|
759
|
+
git_buf_free(&alts_buf);
|
760
|
+
git_buf_free(&object_dir_buf);
|
761
|
+
git_buf_free(&namespace_buf);
|
762
|
+
git_buf_free(&index_file_buf);
|
763
|
+
git_buf_free(&across_fs_buf);
|
764
|
+
git_buf_free(&ceiling_dirs_buf);
|
765
|
+
git_buf_free(&dir_buf);
|
767
766
|
return error;
|
768
767
|
}
|
769
768
|
|
@@ -786,7 +785,7 @@ static int repo_is_worktree(unsigned *out, const git_repository *repo)
|
|
786
785
|
* only used when the repository is a working tree. */
|
787
786
|
*out = !!git_path_exists(gitdir_link.ptr);
|
788
787
|
|
789
|
-
|
788
|
+
git_buf_free(&gitdir_link);
|
790
789
|
return error;
|
791
790
|
}
|
792
791
|
|
@@ -800,7 +799,7 @@ int git_repository_open_ext(
|
|
800
799
|
unsigned is_worktree;
|
801
800
|
git_buf gitdir = GIT_BUF_INIT, workdir = GIT_BUF_INIT,
|
802
801
|
gitlink = GIT_BUF_INIT, commondir = GIT_BUF_INIT;
|
803
|
-
git_repository *repo
|
802
|
+
git_repository *repo;
|
804
803
|
git_config *config = NULL;
|
805
804
|
|
806
805
|
if (flags & GIT_REPOSITORY_OPEN_FROM_ENV)
|
@@ -813,21 +812,21 @@ int git_repository_open_ext(
|
|
813
812
|
&gitdir, &workdir, &gitlink, &commondir, start_path, flags, ceiling_dirs);
|
814
813
|
|
815
814
|
if (error < 0 || !repo_ptr)
|
816
|
-
|
815
|
+
return error;
|
817
816
|
|
818
817
|
repo = repository_alloc();
|
819
|
-
|
818
|
+
GITERR_CHECK_ALLOC(repo);
|
820
819
|
|
821
820
|
repo->gitdir = git_buf_detach(&gitdir);
|
822
|
-
|
821
|
+
GITERR_CHECK_ALLOC(repo->gitdir);
|
823
822
|
|
824
823
|
if (gitlink.size) {
|
825
824
|
repo->gitlink = git_buf_detach(&gitlink);
|
826
|
-
|
825
|
+
GITERR_CHECK_ALLOC(repo->gitlink);
|
827
826
|
}
|
828
827
|
if (commondir.size) {
|
829
828
|
repo->commondir = git_buf_detach(&commondir);
|
830
|
-
|
829
|
+
GITERR_CHECK_ALLOC(repo->commondir);
|
831
830
|
}
|
832
831
|
|
833
832
|
if ((error = repo_is_worktree(&is_worktree, repo)) < 0)
|
@@ -857,16 +856,13 @@ int git_repository_open_ext(
|
|
857
856
|
}
|
858
857
|
|
859
858
|
cleanup:
|
860
|
-
|
861
|
-
|
862
|
-
git_buf_dispose(&gitlink);
|
863
|
-
git_buf_dispose(&commondir);
|
859
|
+
git_buf_free(&gitdir);
|
860
|
+
git_buf_free(&workdir);
|
864
861
|
git_config_free(config);
|
865
862
|
|
866
863
|
if (error < 0)
|
867
864
|
git_repository_free(repo);
|
868
|
-
|
869
|
-
if (repo_ptr)
|
865
|
+
else
|
870
866
|
*repo_ptr = repo;
|
871
867
|
|
872
868
|
return error;
|
@@ -882,8 +878,7 @@ int git_repository_open_from_worktree(git_repository **repo_out, git_worktree *w
|
|
882
878
|
{
|
883
879
|
git_buf path = GIT_BUF_INIT;
|
884
880
|
git_repository *repo = NULL;
|
885
|
-
|
886
|
-
int err;
|
881
|
+
int len, err;
|
887
882
|
|
888
883
|
assert(repo_out && wt);
|
889
884
|
|
@@ -904,7 +899,7 @@ int git_repository_open_from_worktree(git_repository **repo_out, git_worktree *w
|
|
904
899
|
*repo_out = repo;
|
905
900
|
|
906
901
|
out:
|
907
|
-
|
902
|
+
git_buf_free(&path);
|
908
903
|
|
909
904
|
return err;
|
910
905
|
}
|
@@ -914,7 +909,7 @@ int git_repository_wrap_odb(git_repository **repo_out, git_odb *odb)
|
|
914
909
|
git_repository *repo;
|
915
910
|
|
916
911
|
repo = repository_alloc();
|
917
|
-
|
912
|
+
GITERR_CHECK_ALLOC(repo);
|
918
913
|
|
919
914
|
git_repository_set_odb(repo, odb);
|
920
915
|
*repo_out = repo;
|
@@ -949,20 +944,18 @@ static int load_config(
|
|
949
944
|
git_buf config_path = GIT_BUF_INIT;
|
950
945
|
git_config *cfg = NULL;
|
951
946
|
|
952
|
-
assert(out);
|
947
|
+
assert(repo && out);
|
953
948
|
|
954
949
|
if ((error = git_config_new(&cfg)) < 0)
|
955
950
|
return error;
|
956
951
|
|
957
|
-
if (repo)
|
958
|
-
|
959
|
-
error = git_config_add_file_ondisk(cfg, config_path.ptr, GIT_CONFIG_LEVEL_LOCAL, repo, 0);
|
952
|
+
if ((error = git_repository_item_path(&config_path, repo, GIT_REPOSITORY_ITEM_CONFIG)) == 0)
|
953
|
+
error = git_config_add_file_ondisk(cfg, config_path.ptr, GIT_CONFIG_LEVEL_LOCAL, repo, 0);
|
960
954
|
|
961
|
-
|
962
|
-
|
955
|
+
if (error && error != GIT_ENOTFOUND)
|
956
|
+
goto on_error;
|
963
957
|
|
964
|
-
|
965
|
-
}
|
958
|
+
git_buf_free(&config_path);
|
966
959
|
|
967
960
|
if (global_config_path != NULL &&
|
968
961
|
(error = git_config_add_file_ondisk(
|
@@ -988,13 +981,13 @@ static int load_config(
|
|
988
981
|
error != GIT_ENOTFOUND)
|
989
982
|
goto on_error;
|
990
983
|
|
991
|
-
|
984
|
+
giterr_clear(); /* clear any lingering ENOTFOUND errors */
|
992
985
|
|
993
986
|
*out = cfg;
|
994
987
|
return 0;
|
995
988
|
|
996
989
|
on_error:
|
997
|
-
|
990
|
+
git_buf_free(&config_path);
|
998
991
|
git_config_free(cfg);
|
999
992
|
*out = NULL;
|
1000
993
|
return error;
|
@@ -1041,10 +1034,10 @@ int git_repository_config__weakptr(git_config **out, git_repository *repo)
|
|
1041
1034
|
}
|
1042
1035
|
}
|
1043
1036
|
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1037
|
+
git_buf_free(&global_buf);
|
1038
|
+
git_buf_free(&xdg_buf);
|
1039
|
+
git_buf_free(&system_buf);
|
1040
|
+
git_buf_free(&programdata_buf);
|
1048
1041
|
}
|
1049
1042
|
|
1050
1043
|
*out = repo->_config;
|
@@ -1106,7 +1099,7 @@ int git_repository_odb__weakptr(git_odb **out, git_repository *repo)
|
|
1106
1099
|
git_odb_free(odb);
|
1107
1100
|
}
|
1108
1101
|
|
1109
|
-
|
1102
|
+
git_buf_free(&odb_path);
|
1110
1103
|
}
|
1111
1104
|
|
1112
1105
|
*out = repo->_odb;
|
@@ -1191,11 +1184,10 @@ int git_repository_index__weakptr(git_index **out, git_repository *repo)
|
|
1191
1184
|
git_index_free(index);
|
1192
1185
|
}
|
1193
1186
|
|
1194
|
-
error = git_index_set_caps(repo->_index,
|
1195
|
-
GIT_INDEX_CAPABILITY_FROM_OWNER);
|
1187
|
+
error = git_index_set_caps(repo->_index, GIT_INDEXCAP_FROM_OWNER);
|
1196
1188
|
}
|
1197
1189
|
|
1198
|
-
|
1190
|
+
git_buf_free(&index_path);
|
1199
1191
|
}
|
1200
1192
|
|
1201
1193
|
*out = repo->_index;
|
@@ -1290,8 +1282,8 @@ bool git_repository__reserved_names(
|
|
1290
1282
|
int (*prefixcmp)(const char *, const char *);
|
1291
1283
|
int error, ignorecase;
|
1292
1284
|
|
1293
|
-
error =
|
1294
|
-
&ignorecase, repo,
|
1285
|
+
error = git_repository__cvar(
|
1286
|
+
&ignorecase, repo, GIT_CVAR_IGNORECASE);
|
1295
1287
|
prefixcmp = (error || ignorecase) ? git__prefixcmp_icase :
|
1296
1288
|
git__prefixcmp;
|
1297
1289
|
|
@@ -1349,7 +1341,7 @@ static int check_repositoryformatversion(git_config *config)
|
|
1349
1341
|
return -1;
|
1350
1342
|
|
1351
1343
|
if (GIT_REPO_VERSION < version) {
|
1352
|
-
|
1344
|
+
giterr_set(GITERR_REPOSITORY,
|
1353
1345
|
"unsupported repository version %d. Only versions up to %d are supported.",
|
1354
1346
|
version, GIT_REPO_VERSION);
|
1355
1347
|
return -1;
|
@@ -1363,11 +1355,10 @@ int git_repository_create_head(const char *git_dir, const char *ref_name)
|
|
1363
1355
|
git_buf ref_path = GIT_BUF_INIT;
|
1364
1356
|
git_filebuf ref = GIT_FILEBUF_INIT;
|
1365
1357
|
const char *fmt;
|
1366
|
-
int error;
|
1367
1358
|
|
1368
|
-
if (
|
1369
|
-
|
1370
|
-
goto
|
1359
|
+
if (git_buf_joinpath(&ref_path, git_dir, GIT_HEAD_FILE) < 0 ||
|
1360
|
+
git_filebuf_open(&ref, ref_path.ptr, 0, GIT_REFS_FILE_MODE) < 0)
|
1361
|
+
goto fail;
|
1371
1362
|
|
1372
1363
|
if (!ref_name)
|
1373
1364
|
ref_name = GIT_BRANCH_MASTER;
|
@@ -1377,14 +1368,17 @@ int git_repository_create_head(const char *git_dir, const char *ref_name)
|
|
1377
1368
|
else
|
1378
1369
|
fmt = "ref: " GIT_REFS_HEADS_DIR "%s\n";
|
1379
1370
|
|
1380
|
-
if (
|
1381
|
-
|
1382
|
-
goto
|
1371
|
+
if (git_filebuf_printf(&ref, fmt, ref_name) < 0 ||
|
1372
|
+
git_filebuf_commit(&ref) < 0)
|
1373
|
+
goto fail;
|
1383
1374
|
|
1384
|
-
|
1385
|
-
|
1375
|
+
git_buf_free(&ref_path);
|
1376
|
+
return 0;
|
1377
|
+
|
1378
|
+
fail:
|
1379
|
+
git_buf_free(&ref_path);
|
1386
1380
|
git_filebuf_cleanup(&ref);
|
1387
|
-
return
|
1381
|
+
return -1;
|
1388
1382
|
}
|
1389
1383
|
|
1390
1384
|
static bool is_chmod_supported(const char *file_path)
|
@@ -1411,53 +1405,30 @@ static bool is_filesystem_case_insensitive(const char *gitdir_path)
|
|
1411
1405
|
if (!git_buf_joinpath(&path, gitdir_path, "CoNfIg"))
|
1412
1406
|
is_insensitive = git_path_exists(git_buf_cstr(&path));
|
1413
1407
|
|
1414
|
-
|
1408
|
+
git_buf_free(&path);
|
1415
1409
|
return is_insensitive;
|
1416
1410
|
}
|
1417
1411
|
|
1418
1412
|
static bool are_symlinks_supported(const char *wd_path)
|
1419
1413
|
{
|
1420
|
-
|
1421
|
-
|
1422
|
-
|
1423
|
-
|
1424
|
-
|
1425
|
-
|
1426
|
-
|
1427
|
-
|
1428
|
-
|
1429
|
-
|
1430
|
-
|
1431
|
-
|
1432
|
-
|
1433
|
-
*/
|
1434
|
-
#ifdef GIT_WIN32
|
1435
|
-
git_config_find_global(&global_buf);
|
1436
|
-
git_config_find_xdg(&xdg_buf);
|
1437
|
-
git_config_find_system(&system_buf);
|
1438
|
-
git_config_find_programdata(&programdata_buf);
|
1439
|
-
|
1440
|
-
if (load_config(&config, NULL,
|
1441
|
-
path_unless_empty(&global_buf),
|
1442
|
-
path_unless_empty(&xdg_buf),
|
1443
|
-
path_unless_empty(&system_buf),
|
1444
|
-
path_unless_empty(&programdata_buf)) < 0)
|
1445
|
-
goto done;
|
1446
|
-
|
1447
|
-
if (git_config_get_bool(&symlinks, config, "core.symlinks") < 0 || !symlinks)
|
1448
|
-
goto done;
|
1449
|
-
#endif
|
1414
|
+
git_buf path = GIT_BUF_INIT;
|
1415
|
+
int fd;
|
1416
|
+
struct stat st;
|
1417
|
+
int symlinks_supported = -1;
|
1418
|
+
|
1419
|
+
if ((fd = git_futils_mktmp(&path, wd_path, 0666)) < 0 ||
|
1420
|
+
p_close(fd) < 0 ||
|
1421
|
+
p_unlink(path.ptr) < 0 ||
|
1422
|
+
p_symlink("testing", path.ptr) < 0 ||
|
1423
|
+
p_lstat(path.ptr, &st) < 0)
|
1424
|
+
symlinks_supported = false;
|
1425
|
+
else
|
1426
|
+
symlinks_supported = (S_ISLNK(st.st_mode) != 0);
|
1450
1427
|
|
1451
|
-
|
1452
|
-
|
1428
|
+
(void)p_unlink(path.ptr);
|
1429
|
+
git_buf_free(&path);
|
1453
1430
|
|
1454
|
-
|
1455
|
-
git_buf_dispose(&global_buf);
|
1456
|
-
git_buf_dispose(&xdg_buf);
|
1457
|
-
git_buf_dispose(&system_buf);
|
1458
|
-
git_buf_dispose(&programdata_buf);
|
1459
|
-
git_config_free(config);
|
1460
|
-
return symlinks != 0;
|
1431
|
+
return symlinks_supported;
|
1461
1432
|
}
|
1462
1433
|
|
1463
1434
|
static int create_empty_file(const char *path, mode_t mode)
|
@@ -1465,12 +1436,12 @@ static int create_empty_file(const char *path, mode_t mode)
|
|
1465
1436
|
int fd;
|
1466
1437
|
|
1467
1438
|
if ((fd = p_creat(path, mode)) < 0) {
|
1468
|
-
|
1439
|
+
giterr_set(GITERR_OS, "error while creating '%s'", path);
|
1469
1440
|
return -1;
|
1470
1441
|
}
|
1471
1442
|
|
1472
1443
|
if (p_close(fd) < 0) {
|
1473
|
-
|
1444
|
+
giterr_set(GITERR_OS, "error while closing '%s'", path);
|
1474
1445
|
return -1;
|
1475
1446
|
}
|
1476
1447
|
|
@@ -1505,7 +1476,7 @@ static int repo_local_config(
|
|
1505
1476
|
return error;
|
1506
1477
|
|
1507
1478
|
if (git_config_open_level(out, parent, GIT_CONFIG_LEVEL_LOCAL) < 0) {
|
1508
|
-
|
1479
|
+
giterr_clear();
|
1509
1480
|
|
1510
1481
|
if (!(error = git_config_add_file_ondisk(
|
1511
1482
|
parent, cfg_path, GIT_CONFIG_LEVEL_LOCAL, repo, false)))
|
@@ -1537,14 +1508,14 @@ static int repo_init_fs_configs(
|
|
1537
1508
|
if ((error = git_config_set_bool(cfg, "core.symlinks", false)) < 0)
|
1538
1509
|
return error;
|
1539
1510
|
} else if (git_config_delete_entry(cfg, "core.symlinks") < 0)
|
1540
|
-
|
1511
|
+
giterr_clear();
|
1541
1512
|
|
1542
1513
|
if (update_ignorecase) {
|
1543
1514
|
if (is_filesystem_case_insensitive(repo_dir)) {
|
1544
1515
|
if ((error = git_config_set_bool(cfg, "core.ignorecase", true)) < 0)
|
1545
1516
|
return error;
|
1546
1517
|
} else if (git_config_delete_entry(cfg, "core.ignorecase") < 0)
|
1547
|
-
|
1518
|
+
giterr_clear();
|
1548
1519
|
}
|
1549
1520
|
|
1550
1521
|
#ifdef GIT_USE_ICONV
|
@@ -1601,7 +1572,7 @@ static int repo_init_config(
|
|
1601
1572
|
SET_REPO_CONFIG(string, "core.worktree", worktree_path.ptr);
|
1602
1573
|
} else if (is_reinit) {
|
1603
1574
|
if (git_config_delete_entry(config, "core.worktree") < 0)
|
1604
|
-
|
1575
|
+
giterr_clear();
|
1605
1576
|
}
|
1606
1577
|
}
|
1607
1578
|
|
@@ -1615,8 +1586,8 @@ static int repo_init_config(
|
|
1615
1586
|
}
|
1616
1587
|
|
1617
1588
|
cleanup:
|
1618
|
-
|
1619
|
-
|
1589
|
+
git_buf_free(&cfg_path);
|
1590
|
+
git_buf_free(&worktree_path);
|
1620
1591
|
git_config_free(config);
|
1621
1592
|
|
1622
1593
|
return error;
|
@@ -1629,7 +1600,7 @@ static int repo_reinit_submodule_fs(git_submodule *sm, const char *n, void *p)
|
|
1629
1600
|
|
1630
1601
|
if (git_submodule_open(&smrepo, sm) < 0 ||
|
1631
1602
|
git_repository_reinit_filesystem(smrepo, true) < 0)
|
1632
|
-
|
1603
|
+
giterr_clear();
|
1633
1604
|
git_repository_free(smrepo);
|
1634
1605
|
|
1635
1606
|
return 0;
|
@@ -1647,9 +1618,9 @@ int git_repository_reinit_filesystem(git_repository *repo, int recurse)
|
|
1647
1618
|
config, path.ptr, repo_dir, git_repository_workdir(repo), true);
|
1648
1619
|
|
1649
1620
|
git_config_free(config);
|
1650
|
-
|
1621
|
+
git_buf_free(&path);
|
1651
1622
|
|
1652
|
-
|
1623
|
+
git_repository__cvar_cache_clear(repo);
|
1653
1624
|
|
1654
1625
|
if (!repo->is_bare && recurse)
|
1655
1626
|
(void)git_submodule_foreach(repo, repo_reinit_submodule_fs, NULL);
|
@@ -1695,10 +1666,10 @@ static int repo_write_template(
|
|
1695
1666
|
GIT_UNUSED(hidden);
|
1696
1667
|
#endif
|
1697
1668
|
|
1698
|
-
|
1669
|
+
git_buf_free(&path);
|
1699
1670
|
|
1700
1671
|
if (error)
|
1701
|
-
|
1672
|
+
giterr_set(GITERR_OS,
|
1702
1673
|
"failed to initialize repository with template '%s'", file);
|
1703
1674
|
|
1704
1675
|
return error;
|
@@ -1729,7 +1700,7 @@ static int repo_write_gitlink(
|
|
1729
1700
|
goto cleanup;
|
1730
1701
|
|
1731
1702
|
if (!p_stat(buf.ptr, &st) && !S_ISREG(st.st_mode)) {
|
1732
|
-
|
1703
|
+
giterr_set(GITERR_REPOSITORY,
|
1733
1704
|
"cannot overwrite gitlink file into path '%s'", in_dir);
|
1734
1705
|
error = GIT_EEXISTS;
|
1735
1706
|
goto cleanup;
|
@@ -1749,8 +1720,8 @@ static int repo_write_gitlink(
|
|
1749
1720
|
error = repo_write_template(in_dir, true, DOT_GIT, 0666, true, buf.ptr);
|
1750
1721
|
|
1751
1722
|
cleanup:
|
1752
|
-
|
1753
|
-
|
1723
|
+
git_buf_free(&buf);
|
1724
|
+
git_buf_free(&path_to_repo);
|
1754
1725
|
return error;
|
1755
1726
|
}
|
1756
1727
|
|
@@ -1783,7 +1754,7 @@ static int repo_init_structure(
|
|
1783
1754
|
#ifdef GIT_WIN32
|
1784
1755
|
if ((opts->flags & GIT_REPOSITORY_INIT__HAS_DOTGIT) != 0) {
|
1785
1756
|
if (git_win32__set_hidden(repo_dir, true) < 0) {
|
1786
|
-
|
1757
|
+
giterr_set(GITERR_OS,
|
1787
1758
|
"failed to mark Git repository folder as hidden");
|
1788
1759
|
return -1;
|
1789
1760
|
}
|
@@ -1810,7 +1781,7 @@ static int repo_init_structure(
|
|
1810
1781
|
else if ((error = git_config_open_default(&cfg)) >= 0) {
|
1811
1782
|
if (!git_config_get_path(&template_buf, cfg, "init.templatedir"))
|
1812
1783
|
tdir = template_buf.ptr;
|
1813
|
-
|
1784
|
+
giterr_clear();
|
1814
1785
|
}
|
1815
1786
|
|
1816
1787
|
if (!tdir) {
|
@@ -1834,7 +1805,7 @@ static int repo_init_structure(
|
|
1834
1805
|
error = git_futils_cp_r(tdir, repo_dir, cpflags, dmode);
|
1835
1806
|
}
|
1836
1807
|
|
1837
|
-
|
1808
|
+
git_buf_free(&template_buf);
|
1838
1809
|
git_config_free(cfg);
|
1839
1810
|
|
1840
1811
|
if (error < 0) {
|
@@ -1842,7 +1813,7 @@ static int repo_init_structure(
|
|
1842
1813
|
return error;
|
1843
1814
|
|
1844
1815
|
/* if template was default, ignore error and use internal */
|
1845
|
-
|
1816
|
+
giterr_clear();
|
1846
1817
|
external_tpl = false;
|
1847
1818
|
error = 0;
|
1848
1819
|
}
|
@@ -1944,7 +1915,7 @@ static int repo_init_directories(
|
|
1944
1915
|
if (git_path_dirname_r(wd_path, repo_path->ptr) < 0)
|
1945
1916
|
return -1;
|
1946
1917
|
} else {
|
1947
|
-
|
1918
|
+
giterr_set(GITERR_REPOSITORY, "cannot pick working directory"
|
1948
1919
|
" for non-bare repository that isn't a '.git' directory");
|
1949
1920
|
return -1;
|
1950
1921
|
}
|
@@ -2047,62 +2018,56 @@ int git_repository_init_ext(
|
|
2047
2018
|
const char *given_repo,
|
2048
2019
|
git_repository_init_options *opts)
|
2049
2020
|
{
|
2021
|
+
int error;
|
2050
2022
|
git_buf repo_path = GIT_BUF_INIT, wd_path = GIT_BUF_INIT,
|
2051
|
-
common_path = GIT_BUF_INIT
|
2023
|
+
common_path = GIT_BUF_INIT;
|
2052
2024
|
const char *wd;
|
2053
|
-
int error;
|
2054
2025
|
|
2055
2026
|
assert(out && given_repo && opts);
|
2056
2027
|
|
2057
|
-
|
2028
|
+
GITERR_CHECK_VERSION(opts, GIT_REPOSITORY_INIT_OPTIONS_VERSION, "git_repository_init_options");
|
2058
2029
|
|
2059
|
-
|
2060
|
-
|
2030
|
+
error = repo_init_directories(&repo_path, &wd_path, given_repo, opts);
|
2031
|
+
if (error < 0)
|
2032
|
+
goto cleanup;
|
2061
2033
|
|
2062
2034
|
wd = (opts->flags & GIT_REPOSITORY_INIT_BARE) ? NULL : git_buf_cstr(&wd_path);
|
2063
|
-
|
2064
2035
|
if (valid_repository_path(&repo_path, &common_path)) {
|
2036
|
+
|
2065
2037
|
if ((opts->flags & GIT_REPOSITORY_INIT_NO_REINIT) != 0) {
|
2066
|
-
|
2038
|
+
giterr_set(GITERR_REPOSITORY,
|
2067
2039
|
"attempt to reinitialize '%s'", given_repo);
|
2068
2040
|
error = GIT_EEXISTS;
|
2069
|
-
goto
|
2041
|
+
goto cleanup;
|
2070
2042
|
}
|
2071
2043
|
|
2072
2044
|
opts->flags |= GIT_REPOSITORY_INIT__IS_REINIT;
|
2073
2045
|
|
2074
|
-
|
2075
|
-
|
2046
|
+
error = repo_init_config(
|
2047
|
+
repo_path.ptr, wd, opts->flags, opts->mode);
|
2076
2048
|
|
2077
2049
|
/* TODO: reinitialize the templates */
|
2078
|
-
} else {
|
2079
|
-
if ((error = repo_init_structure(repo_path.ptr, wd, opts)) < 0 ||
|
2080
|
-
(error = repo_init_config(repo_path.ptr, wd, opts->flags, opts->mode)) < 0 ||
|
2081
|
-
(error = git_buf_joinpath(&head_path, repo_path.ptr, GIT_HEAD_FILE)) < 0)
|
2082
|
-
goto out;
|
2083
|
-
|
2084
|
-
/*
|
2085
|
-
* Only set the new HEAD if the file does not exist already via
|
2086
|
-
* a template or if the caller has explicitly supplied an
|
2087
|
-
* initial HEAD value.
|
2088
|
-
*/
|
2089
|
-
if ((!git_path_exists(head_path.ptr) || opts->initial_head) &&
|
2090
|
-
(error = git_repository_create_head(repo_path.ptr, opts->initial_head)) < 0)
|
2091
|
-
goto out;
|
2092
2050
|
}
|
2051
|
+
else {
|
2052
|
+
if (!(error = repo_init_structure(
|
2053
|
+
repo_path.ptr, wd, opts)) &&
|
2054
|
+
!(error = repo_init_config(
|
2055
|
+
repo_path.ptr, wd, opts->flags, opts->mode)))
|
2056
|
+
error = git_repository_create_head(
|
2057
|
+
repo_path.ptr, opts->initial_head);
|
2058
|
+
}
|
2059
|
+
if (error < 0)
|
2060
|
+
goto cleanup;
|
2093
2061
|
|
2094
|
-
|
2095
|
-
goto out;
|
2062
|
+
error = git_repository_open(out, repo_path.ptr);
|
2096
2063
|
|
2097
|
-
if (opts->origin_url
|
2098
|
-
|
2099
|
-
goto out;
|
2064
|
+
if (!error && opts->origin_url)
|
2065
|
+
error = repo_init_create_origin(*out, opts->origin_url);
|
2100
2066
|
|
2101
|
-
|
2102
|
-
|
2103
|
-
|
2104
|
-
|
2105
|
-
git_buf_dispose(&wd_path);
|
2067
|
+
cleanup:
|
2068
|
+
git_buf_free(&common_path);
|
2069
|
+
git_buf_free(&repo_path);
|
2070
|
+
git_buf_free(&wd_path);
|
2106
2071
|
|
2107
2072
|
return error;
|
2108
2073
|
}
|
@@ -2119,7 +2084,7 @@ int git_repository_head_detached(git_repository *repo)
|
|
2119
2084
|
if (git_reference_lookup(&ref, repo, GIT_HEAD_FILE) < 0)
|
2120
2085
|
return -1;
|
2121
2086
|
|
2122
|
-
if (git_reference_type(ref) ==
|
2087
|
+
if (git_reference_type(ref) == GIT_REF_SYMBOLIC) {
|
2123
2088
|
git_reference_free(ref);
|
2124
2089
|
return 0;
|
2125
2090
|
}
|
@@ -2146,7 +2111,7 @@ int git_repository_head_detached_for_worktree(git_repository *repo, const char *
|
|
2146
2111
|
if ((error = git_repository_head_for_worktree(&ref, repo, name)) < 0)
|
2147
2112
|
goto out;
|
2148
2113
|
|
2149
|
-
error = (git_reference_type(ref) !=
|
2114
|
+
error = (git_reference_type(ref) != GIT_REF_SYMBOLIC);
|
2150
2115
|
out:
|
2151
2116
|
git_reference_free(ref);
|
2152
2117
|
|
@@ -2158,12 +2123,10 @@ int git_repository_head(git_reference **head_out, git_repository *repo)
|
|
2158
2123
|
git_reference *head;
|
2159
2124
|
int error;
|
2160
2125
|
|
2161
|
-
assert(head_out);
|
2162
|
-
|
2163
2126
|
if ((error = git_reference_lookup(&head, repo, GIT_HEAD_FILE)) < 0)
|
2164
2127
|
return error;
|
2165
2128
|
|
2166
|
-
if (git_reference_type(head) ==
|
2129
|
+
if (git_reference_type(head) == GIT_REF_OID) {
|
2167
2130
|
*head_out = head;
|
2168
2131
|
return 0;
|
2169
2132
|
}
|
@@ -2188,7 +2151,7 @@ int git_repository_head_for_worktree(git_reference **out, git_repository *repo,
|
|
2188
2151
|
(error = git_reference__read_head(&head, repo, path.ptr)) < 0)
|
2189
2152
|
goto out;
|
2190
2153
|
|
2191
|
-
if (git_reference_type(head) !=
|
2154
|
+
if (git_reference_type(head) != GIT_REF_OID) {
|
2192
2155
|
git_reference *resolved;
|
2193
2156
|
|
2194
2157
|
error = git_reference_lookup_resolved(&resolved, repo, git_reference_symbolic_target(head), -1);
|
@@ -2202,46 +2165,39 @@ out:
|
|
2202
2165
|
if (error)
|
2203
2166
|
git_reference_free(head);
|
2204
2167
|
|
2205
|
-
|
2168
|
+
git_buf_free(&path);
|
2206
2169
|
|
2207
2170
|
return error;
|
2208
2171
|
}
|
2209
2172
|
|
2210
|
-
int git_repository_foreach_head(git_repository *repo,
|
2211
|
-
git_repository_foreach_head_cb cb,
|
2212
|
-
int flags, void *payload)
|
2173
|
+
int git_repository_foreach_head(git_repository *repo, git_repository_foreach_head_cb cb, void *payload)
|
2213
2174
|
{
|
2214
2175
|
git_strarray worktrees = GIT_VECTOR_INIT;
|
2215
2176
|
git_buf path = GIT_BUF_INIT;
|
2216
|
-
int error
|
2177
|
+
int error;
|
2217
2178
|
size_t i;
|
2218
2179
|
|
2180
|
+
/* Execute callback for HEAD of commondir */
|
2181
|
+
if ((error = git_buf_joinpath(&path, repo->commondir, GIT_HEAD_FILE)) < 0 ||
|
2182
|
+
(error = cb(repo, path.ptr, payload) != 0))
|
2183
|
+
goto out;
|
2219
2184
|
|
2220
|
-
if (
|
2221
|
-
|
2222
|
-
|
2223
|
-
(error = cb(repo, path.ptr, payload) != 0))
|
2224
|
-
goto out;
|
2185
|
+
if ((error = git_worktree_list(&worktrees, repo)) < 0) {
|
2186
|
+
error = 0;
|
2187
|
+
goto out;
|
2225
2188
|
}
|
2226
2189
|
|
2227
|
-
|
2228
|
-
|
2229
|
-
|
2230
|
-
|
2231
|
-
}
|
2232
|
-
|
2233
|
-
/* Gather HEADs of all worktrees */
|
2234
|
-
for (i = 0; i < worktrees.count; i++) {
|
2235
|
-
if (get_worktree_file_path(&path, repo, worktrees.strings[i], GIT_HEAD_FILE) < 0)
|
2236
|
-
continue;
|
2190
|
+
/* Execute callback for all worktree HEADs */
|
2191
|
+
for (i = 0; i < worktrees.count; i++) {
|
2192
|
+
if (get_worktree_file_path(&path, repo, worktrees.strings[i], GIT_HEAD_FILE) < 0)
|
2193
|
+
continue;
|
2237
2194
|
|
2238
|
-
|
2239
|
-
|
2240
|
-
}
|
2195
|
+
if ((error = cb(repo, path.ptr, payload)) != 0)
|
2196
|
+
goto out;
|
2241
2197
|
}
|
2242
2198
|
|
2243
2199
|
out:
|
2244
|
-
|
2200
|
+
git_buf_free(&path);
|
2245
2201
|
git_strarray_free(&worktrees);
|
2246
2202
|
return error;
|
2247
2203
|
}
|
@@ -2255,7 +2211,7 @@ int git_repository_head_unborn(git_repository *repo)
|
|
2255
2211
|
git_reference_free(ref);
|
2256
2212
|
|
2257
2213
|
if (error == GIT_EUNBORNBRANCH) {
|
2258
|
-
|
2214
|
+
giterr_clear();
|
2259
2215
|
return 1;
|
2260
2216
|
}
|
2261
2217
|
|
@@ -2293,7 +2249,7 @@ int git_repository_is_empty(git_repository *repo)
|
|
2293
2249
|
if (git_reference_lookup(&head, repo, GIT_HEAD_FILE) < 0)
|
2294
2250
|
return -1;
|
2295
2251
|
|
2296
|
-
if (git_reference_type(head) ==
|
2252
|
+
if (git_reference_type(head) == GIT_REF_SYMBOLIC)
|
2297
2253
|
is_empty =
|
2298
2254
|
(strcmp(git_reference_symbolic_target(head),
|
2299
2255
|
GIT_REFS_HEADS_DIR "master") == 0) &&
|
@@ -2304,11 +2260,11 @@ int git_repository_is_empty(git_repository *repo)
|
|
2304
2260
|
return is_empty;
|
2305
2261
|
}
|
2306
2262
|
|
2307
|
-
|
2263
|
+
int git_repository_item_path(git_buf *out, const git_repository *repo, git_repository_item_t item)
|
2308
2264
|
{
|
2309
2265
|
const char *parent;
|
2310
2266
|
|
2311
|
-
switch (item) {
|
2267
|
+
switch (items[item].parent) {
|
2312
2268
|
case GIT_REPOSITORY_ITEM_GITDIR:
|
2313
2269
|
parent = git_repository_path(repo);
|
2314
2270
|
break;
|
@@ -2319,20 +2275,12 @@ static const char *resolved_parent_path(const git_repository *repo, git_reposito
|
|
2319
2275
|
parent = git_repository_commondir(repo);
|
2320
2276
|
break;
|
2321
2277
|
default:
|
2322
|
-
|
2323
|
-
return
|
2278
|
+
giterr_set(GITERR_INVALID, "invalid item directory");
|
2279
|
+
return -1;
|
2324
2280
|
}
|
2325
|
-
if (!parent && fallback != GIT_REPOSITORY_ITEM__LAST)
|
2326
|
-
return resolved_parent_path(repo, fallback, GIT_REPOSITORY_ITEM__LAST);
|
2327
|
-
|
2328
|
-
return parent;
|
2329
|
-
}
|
2330
2281
|
|
2331
|
-
int git_repository_item_path(git_buf *out, const git_repository *repo, git_repository_item_t item)
|
2332
|
-
{
|
2333
|
-
const char *parent = resolved_parent_path(repo, items[item].parent, items[item].fallback);
|
2334
2282
|
if (parent == NULL) {
|
2335
|
-
|
2283
|
+
giterr_set(GITERR_INVALID, "path cannot exist in repository");
|
2336
2284
|
return GIT_ENOTFOUND;
|
2337
2285
|
}
|
2338
2286
|
|
@@ -2465,7 +2413,7 @@ int git_repository_head_tree(git_tree **tree, git_repository *repo)
|
|
2465
2413
|
if ((error = git_repository_head(&head, repo)) < 0)
|
2466
2414
|
return error;
|
2467
2415
|
|
2468
|
-
if ((error = git_reference_peel(&obj, head,
|
2416
|
+
if ((error = git_reference_peel(&obj, head, GIT_OBJ_TREE)) < 0)
|
2469
2417
|
goto cleanup;
|
2470
2418
|
|
2471
2419
|
*tree = (git_tree *)obj;
|
@@ -2485,14 +2433,14 @@ int git_repository__set_orig_head(git_repository *repo, const git_oid *orig_head
|
|
2485
2433
|
git_oid_fmt(orig_head_str, orig_head);
|
2486
2434
|
|
2487
2435
|
if ((error = git_buf_joinpath(&file_path, repo->gitdir, GIT_ORIG_HEAD_FILE)) == 0 &&
|
2488
|
-
(error = git_filebuf_open(&file, file_path.ptr,
|
2436
|
+
(error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_FORCE, GIT_MERGE_FILE_MODE)) == 0 &&
|
2489
2437
|
(error = git_filebuf_printf(&file, "%.*s\n", GIT_OID_HEXSZ, orig_head_str)) == 0)
|
2490
2438
|
error = git_filebuf_commit(&file);
|
2491
2439
|
|
2492
2440
|
if (error < 0)
|
2493
2441
|
git_filebuf_cleanup(&file);
|
2494
2442
|
|
2495
|
-
|
2443
|
+
git_buf_free(&file_path);
|
2496
2444
|
|
2497
2445
|
return error;
|
2498
2446
|
}
|
@@ -2511,12 +2459,12 @@ int git_repository_message(git_buf *out, git_repository *repo)
|
|
2511
2459
|
if ((error = p_stat(git_buf_cstr(&path), &st)) < 0) {
|
2512
2460
|
if (errno == ENOENT)
|
2513
2461
|
error = GIT_ENOTFOUND;
|
2514
|
-
|
2462
|
+
giterr_set(GITERR_OS, "could not access message file");
|
2515
2463
|
} else {
|
2516
2464
|
error = git_futils_readbuffer(out, git_buf_cstr(&path));
|
2517
2465
|
}
|
2518
2466
|
|
2519
|
-
|
2467
|
+
git_buf_free(&path);
|
2520
2468
|
|
2521
2469
|
return error;
|
2522
2470
|
}
|
@@ -2530,7 +2478,7 @@ int git_repository_message_remove(git_repository *repo)
|
|
2530
2478
|
return -1;
|
2531
2479
|
|
2532
2480
|
error = p_unlink(git_buf_cstr(&path));
|
2533
|
-
|
2481
|
+
git_buf_free(&path);
|
2534
2482
|
|
2535
2483
|
return error;
|
2536
2484
|
}
|
@@ -2539,13 +2487,13 @@ int git_repository_hashfile(
|
|
2539
2487
|
git_oid *out,
|
2540
2488
|
git_repository *repo,
|
2541
2489
|
const char *path,
|
2542
|
-
|
2490
|
+
git_otype type,
|
2543
2491
|
const char *as_path)
|
2544
2492
|
{
|
2545
2493
|
int error;
|
2546
2494
|
git_filter_list *fl = NULL;
|
2547
2495
|
git_file fd = -1;
|
2548
|
-
|
2496
|
+
git_off_t len;
|
2549
2497
|
git_buf full_path = GIT_BUF_INIT;
|
2550
2498
|
|
2551
2499
|
assert(out && path && repo); /* as_path can be NULL */
|
@@ -2582,11 +2530,14 @@ int git_repository_hashfile(
|
|
2582
2530
|
goto cleanup;
|
2583
2531
|
}
|
2584
2532
|
|
2585
|
-
|
2533
|
+
len = git_futils_filesize(fd);
|
2534
|
+
if (len < 0) {
|
2535
|
+
error = (int)len;
|
2586
2536
|
goto cleanup;
|
2537
|
+
}
|
2587
2538
|
|
2588
2539
|
if (!git__is_sizet(len)) {
|
2589
|
-
|
2540
|
+
giterr_set(GITERR_OS, "file size overflow for 32-bit systems");
|
2590
2541
|
error = -1;
|
2591
2542
|
goto cleanup;
|
2592
2543
|
}
|
@@ -2597,7 +2548,7 @@ cleanup:
|
|
2597
2548
|
if (fd >= 0)
|
2598
2549
|
p_close(fd);
|
2599
2550
|
git_filter_list_free(fl);
|
2600
|
-
|
2551
|
+
git_buf_free(&full_path);
|
2601
2552
|
|
2602
2553
|
return error;
|
2603
2554
|
}
|
@@ -2606,7 +2557,7 @@ static int checkout_message(git_buf *out, git_reference *old, const char *new)
|
|
2606
2557
|
{
|
2607
2558
|
git_buf_puts(out, "checkout: moving from ");
|
2608
2559
|
|
2609
|
-
if (git_reference_type(old) ==
|
2560
|
+
if (git_reference_type(old) == GIT_REF_SYMBOLIC)
|
2610
2561
|
git_buf_puts(out, git_reference__shorthand(git_reference_symbolic_target(old)));
|
2611
2562
|
else
|
2612
2563
|
git_buf_puts(out, git_oid_tostr_s(git_reference_target(old)));
|
@@ -2638,10 +2589,10 @@ static int detach(git_repository *repo, const git_oid *id, const char *new)
|
|
2638
2589
|
if ((error = git_reference_lookup(¤t, repo, GIT_HEAD_FILE)) < 0)
|
2639
2590
|
return error;
|
2640
2591
|
|
2641
|
-
if ((error = git_object_lookup(&object, repo, id,
|
2592
|
+
if ((error = git_object_lookup(&object, repo, id, GIT_OBJ_ANY)) < 0)
|
2642
2593
|
goto cleanup;
|
2643
2594
|
|
2644
|
-
if ((error = git_object_peel(&peeled, object,
|
2595
|
+
if ((error = git_object_peel(&peeled, object, GIT_OBJ_COMMIT)) < 0)
|
2645
2596
|
goto cleanup;
|
2646
2597
|
|
2647
2598
|
if (new == NULL)
|
@@ -2653,7 +2604,7 @@ static int detach(git_repository *repo, const git_oid *id, const char *new)
|
|
2653
2604
|
error = git_reference_create(&new_head, repo, GIT_HEAD_FILE, git_object_id(peeled), true, git_buf_cstr(&log_message));
|
2654
2605
|
|
2655
2606
|
cleanup:
|
2656
|
-
|
2607
|
+
git_buf_free(&log_message);
|
2657
2608
|
git_object_free(object);
|
2658
2609
|
git_object_free(peeled);
|
2659
2610
|
git_reference_free(current);
|
@@ -2681,9 +2632,9 @@ int git_repository_set_head(
|
|
2681
2632
|
if (error < 0 && error != GIT_ENOTFOUND)
|
2682
2633
|
goto cleanup;
|
2683
2634
|
|
2684
|
-
if (ref && current->type ==
|
2635
|
+
if (ref && current->type == GIT_REF_SYMBOLIC && git__strcmp(current->target.symbolic, ref->name) &&
|
2685
2636
|
git_reference_is_branch(ref) && git_branch_is_checked_out(ref)) {
|
2686
|
-
|
2637
|
+
giterr_set(GITERR_REPOSITORY, "cannot set HEAD to reference '%s' as it is the current HEAD "
|
2687
2638
|
"of a linked repository.", git_reference_name(ref));
|
2688
2639
|
error = -1;
|
2689
2640
|
goto cleanup;
|
@@ -2703,7 +2654,7 @@ int git_repository_set_head(
|
|
2703
2654
|
}
|
2704
2655
|
|
2705
2656
|
cleanup:
|
2706
|
-
|
2657
|
+
git_buf_free(&log_message);
|
2707
2658
|
git_reference_free(current);
|
2708
2659
|
git_reference_free(ref);
|
2709
2660
|
git_reference_free(new_head);
|
@@ -2741,7 +2692,7 @@ int git_repository_detach_head(git_repository* repo)
|
|
2741
2692
|
if ((error = git_repository_head(&old_head, repo)) < 0)
|
2742
2693
|
goto cleanup;
|
2743
2694
|
|
2744
|
-
if ((error = git_object_lookup(&object, repo, git_reference_target(old_head),
|
2695
|
+
if ((error = git_object_lookup(&object, repo, git_reference_target(old_head), GIT_OBJ_COMMIT)) < 0)
|
2745
2696
|
goto cleanup;
|
2746
2697
|
|
2747
2698
|
if ((error = checkout_message(&log_message, current, git_oid_tostr_s(git_object_id(object)))) < 0)
|
@@ -2751,7 +2702,7 @@ int git_repository_detach_head(git_repository* repo)
|
|
2751
2702
|
1, git_buf_cstr(&log_message));
|
2752
2703
|
|
2753
2704
|
cleanup:
|
2754
|
-
|
2705
|
+
git_buf_free(&log_message);
|
2755
2706
|
git_object_free(object);
|
2756
2707
|
git_reference_free(old_head);
|
2757
2708
|
git_reference_free(new_head);
|
@@ -2798,7 +2749,7 @@ int git_repository_state(git_repository *repo)
|
|
2798
2749
|
} else if (git_path_contains_file(&repo_path, GIT_BISECT_LOG_FILE))
|
2799
2750
|
state = GIT_REPOSITORY_STATE_BISECT;
|
2800
2751
|
|
2801
|
-
|
2752
|
+
git_buf_free(&repo_path);
|
2802
2753
|
return state;
|
2803
2754
|
}
|
2804
2755
|
|
@@ -2827,7 +2778,7 @@ int git_repository__cleanup_files(
|
|
2827
2778
|
git_buf_clear(&buf);
|
2828
2779
|
}
|
2829
2780
|
|
2830
|
-
|
2781
|
+
git_buf_free(&buf);
|
2831
2782
|
return error;
|
2832
2783
|
}
|
2833
2784
|
|
@@ -2860,10 +2811,10 @@ int git_repository_is_shallow(git_repository *repo)
|
|
2860
2811
|
return error;
|
2861
2812
|
|
2862
2813
|
error = git_path_lstat(path.ptr, &st);
|
2863
|
-
|
2814
|
+
git_buf_free(&path);
|
2864
2815
|
|
2865
2816
|
if (error == GIT_ENOTFOUND) {
|
2866
|
-
|
2817
|
+
giterr_clear();
|
2867
2818
|
return 0;
|
2868
2819
|
}
|
2869
2820
|
|
@@ -2872,7 +2823,7 @@ int git_repository_is_shallow(git_repository *repo)
|
|
2872
2823
|
return st.st_size == 0 ? 0 : 1;
|
2873
2824
|
}
|
2874
2825
|
|
2875
|
-
int
|
2826
|
+
int git_repository_init_init_options(
|
2876
2827
|
git_repository_init_options *opts, unsigned int version)
|
2877
2828
|
{
|
2878
2829
|
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
|
@@ -2881,12 +2832,6 @@ int git_repository_init_options_init(
|
|
2881
2832
|
return 0;
|
2882
2833
|
}
|
2883
2834
|
|
2884
|
-
int git_repository_init_init_options(
|
2885
|
-
git_repository_init_options *opts, unsigned int version)
|
2886
|
-
{
|
2887
|
-
return git_repository_init_options_init(opts, version);
|
2888
|
-
}
|
2889
|
-
|
2890
2835
|
int git_repository_ident(const char **name, const char **email, const git_repository *repo)
|
2891
2836
|
{
|
2892
2837
|
*name = repo->ident_name;
|
@@ -2901,12 +2846,12 @@ int git_repository_set_ident(git_repository *repo, const char *name, const char
|
|
2901
2846
|
|
2902
2847
|
if (name) {
|
2903
2848
|
tmp_name = git__strdup(name);
|
2904
|
-
|
2849
|
+
GITERR_CHECK_ALLOC(tmp_name);
|
2905
2850
|
}
|
2906
2851
|
|
2907
2852
|
if (email) {
|
2908
2853
|
tmp_email = git__strdup(email);
|
2909
|
-
|
2854
|
+
GITERR_CHECK_ALLOC(tmp_email);
|
2910
2855
|
}
|
2911
2856
|
|
2912
2857
|
tmp_name = git__swap(repo->ident_name, tmp_name);
|
@@ -2924,7 +2869,7 @@ int git_repository_submodule_cache_all(git_repository *repo)
|
|
2924
2869
|
|
2925
2870
|
assert(repo);
|
2926
2871
|
|
2927
|
-
if ((error =
|
2872
|
+
if ((error = git_strmap_alloc(&repo->submodule_cache)))
|
2928
2873
|
return error;
|
2929
2874
|
|
2930
2875
|
error = git_submodule__map(repo, repo->submodule_cache);
|