rugged 1.3.2.3 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/rugged/extconf.rb +1 -1
- data/ext/rugged/rugged_config.c +7 -2
- data/ext/rugged/rugged_remote.c +17 -0
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +103 -276
- data/vendor/libgit2/COPYING +36 -19
- data/vendor/libgit2/cmake/AddCFlagIfSupported.cmake +21 -21
- data/vendor/libgit2/cmake/DefaultCFlags.cmake +154 -0
- data/vendor/libgit2/cmake/EnableWarnings.cmake +13 -13
- data/vendor/libgit2/cmake/FindCoreFoundation.cmake +13 -13
- data/vendor/libgit2/cmake/FindGSSAPI.cmake +171 -287
- data/vendor/libgit2/cmake/FindGSSFramework.cmake +13 -13
- data/vendor/libgit2/cmake/{FindHTTP_Parser.cmake → FindHTTPParser.cmake} +17 -17
- data/vendor/libgit2/cmake/FindIconv.cmake +27 -27
- data/vendor/libgit2/cmake/FindLibSSH2.cmake +5 -5
- data/vendor/libgit2/cmake/FindPCRE.cmake +13 -13
- data/vendor/libgit2/cmake/FindPCRE2.cmake +12 -12
- data/vendor/libgit2/cmake/FindPkgLibraries.cmake +19 -19
- data/vendor/libgit2/cmake/FindSecurity.cmake +14 -14
- data/vendor/libgit2/cmake/FindStatNsec.cmake +12 -18
- data/vendor/libgit2/cmake/Findfutimens.cmake +8 -8
- data/vendor/libgit2/cmake/FindmbedTLS.cmake +63 -70
- data/vendor/libgit2/cmake/IdeSplitSources.cmake +18 -18
- data/vendor/libgit2/cmake/PkgBuildConfig.cmake +60 -60
- data/vendor/libgit2/cmake/SanitizeBool.cmake +20 -20
- data/vendor/libgit2/cmake/SelectGSSAPI.cmake +37 -37
- data/vendor/libgit2/cmake/SelectHTTPParser.cmake +19 -0
- data/vendor/libgit2/cmake/SelectHTTPSBackend.cmake +100 -100
- data/vendor/libgit2/cmake/SelectHashes.cmake +39 -49
- data/vendor/libgit2/cmake/SelectRegex.cmake +51 -0
- data/vendor/libgit2/cmake/SelectSSH.cmake +41 -0
- data/vendor/libgit2/cmake/SelectWinHTTP.cmake +17 -0
- data/vendor/libgit2/cmake/SelectZlib.cmake +34 -0
- data/vendor/libgit2/deps/chromium-zlib/CMakeLists.txt +6 -6
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +31 -31
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +1 -1
- data/vendor/libgit2/deps/ntlmclient/ntlm.c +4 -4
- data/vendor/libgit2/deps/ntlmclient/ntlm.h +4 -4
- data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +2 -2
- data/vendor/libgit2/deps/pcre/CMakeLists.txt +88 -88
- data/vendor/libgit2/deps/winhttp/CMakeLists.txt +14 -16
- data/vendor/libgit2/deps/zlib/adler32.c +0 -7
- data/vendor/libgit2/deps/zlib/crc32.c +288 -975
- data/vendor/libgit2/deps/zlib/crc32.h +436 -9441
- data/vendor/libgit2/deps/zlib/deflate.c +31 -83
- data/vendor/libgit2/deps/zlib/deflate.h +15 -12
- data/vendor/libgit2/deps/zlib/gzguts.h +2 -3
- data/vendor/libgit2/deps/zlib/infback.c +1 -2
- data/vendor/libgit2/deps/zlib/inffast.c +14 -14
- data/vendor/libgit2/deps/zlib/inflate.c +8 -39
- data/vendor/libgit2/deps/zlib/inflate.h +2 -3
- data/vendor/libgit2/deps/zlib/inftrees.c +3 -3
- data/vendor/libgit2/deps/zlib/trees.c +48 -27
- data/vendor/libgit2/deps/zlib/zlib.h +100 -126
- data/vendor/libgit2/deps/zlib/zutil.c +2 -2
- data/vendor/libgit2/deps/zlib/zutil.h +9 -12
- data/vendor/libgit2/include/git2/apply.h +16 -2
- data/vendor/libgit2/include/git2/attr.h +11 -2
- data/vendor/libgit2/include/git2/blame.h +4 -1
- data/vendor/libgit2/include/git2/blob.h +14 -1
- data/vendor/libgit2/include/git2/branch.h +2 -0
- data/vendor/libgit2/include/git2/buffer.h +18 -78
- data/vendor/libgit2/include/git2/cert.h +2 -2
- data/vendor/libgit2/include/git2/checkout.h +5 -2
- data/vendor/libgit2/include/git2/clone.h +3 -3
- data/vendor/libgit2/include/git2/commit.h +2 -0
- data/vendor/libgit2/include/git2/common.h +5 -12
- data/vendor/libgit2/include/git2/config.h +19 -3
- data/vendor/libgit2/include/git2/credential.h +2 -1
- data/vendor/libgit2/include/git2/credential_helpers.h +1 -0
- data/vendor/libgit2/include/git2/deprecated.h +1 -1
- data/vendor/libgit2/include/git2/describe.h +7 -2
- data/vendor/libgit2/include/git2/diff.h +17 -9
- data/vendor/libgit2/include/git2/email.h +1 -1
- data/vendor/libgit2/include/git2/errors.h +1 -2
- data/vendor/libgit2/include/git2/filter.h +7 -2
- data/vendor/libgit2/include/git2/graph.h +1 -0
- data/vendor/libgit2/include/git2/ignore.h +1 -1
- data/vendor/libgit2/include/git2/index.h +11 -5
- data/vendor/libgit2/include/git2/indexer.h +19 -0
- data/vendor/libgit2/include/git2/merge.h +23 -3
- data/vendor/libgit2/include/git2/message.h +2 -0
- data/vendor/libgit2/include/git2/object.h +23 -0
- data/vendor/libgit2/include/git2/odb.h +37 -7
- data/vendor/libgit2/include/git2/odb_backend.h +1 -1
- data/vendor/libgit2/include/git2/pack.h +24 -8
- data/vendor/libgit2/include/git2/patch.h +8 -0
- data/vendor/libgit2/include/git2/pathspec.h +1 -1
- data/vendor/libgit2/include/git2/proxy.h +1 -1
- data/vendor/libgit2/include/git2/rebase.h +9 -1
- data/vendor/libgit2/include/git2/refdb.h +3 -0
- data/vendor/libgit2/include/git2/reflog.h +1 -1
- data/vendor/libgit2/include/git2/refs.h +2 -2
- data/vendor/libgit2/include/git2/remote.h +184 -37
- data/vendor/libgit2/include/git2/repository.h +14 -9
- data/vendor/libgit2/include/git2/reset.h +2 -2
- data/vendor/libgit2/include/git2/revparse.h +1 -1
- data/vendor/libgit2/include/git2/revwalk.h +4 -1
- data/vendor/libgit2/include/git2/signature.h +1 -1
- data/vendor/libgit2/include/git2/stash.h +3 -3
- data/vendor/libgit2/include/git2/status.h +9 -3
- data/vendor/libgit2/include/git2/submodule.h +7 -2
- data/vendor/libgit2/include/git2/sys/commit_graph.h +1 -1
- data/vendor/libgit2/include/git2/sys/odb_backend.h +2 -5
- data/vendor/libgit2/include/git2/sys/remote.h +31 -0
- data/vendor/libgit2/include/git2/sys/stream.h +1 -1
- data/vendor/libgit2/include/git2/sys/transport.h +25 -34
- data/vendor/libgit2/include/git2/tag.h +1 -0
- data/vendor/libgit2/include/git2/tree.h +4 -3
- data/vendor/libgit2/include/git2/types.h +7 -7
- data/vendor/libgit2/include/git2/version.h +3 -3
- data/vendor/libgit2/include/git2/worktree.h +12 -2
- data/vendor/libgit2/src/CMakeLists.txt +189 -315
- data/vendor/libgit2/src/annotated_commit.h +1 -1
- data/vendor/libgit2/src/apply.c +18 -18
- data/vendor/libgit2/src/apply.h +2 -2
- data/vendor/libgit2/src/attr.c +18 -18
- data/vendor/libgit2/src/attr_file.c +17 -17
- data/vendor/libgit2/src/attr_file.h +4 -4
- data/vendor/libgit2/src/attrcache.c +17 -12
- data/vendor/libgit2/src/blame_git.c +1 -1
- data/vendor/libgit2/src/blob.c +33 -26
- data/vendor/libgit2/src/blob.h +1 -1
- data/vendor/libgit2/src/branch.c +150 -109
- data/vendor/libgit2/src/branch.h +15 -3
- data/vendor/libgit2/src/buf.c +126 -0
- data/vendor/libgit2/src/buf.h +50 -0
- data/vendor/libgit2/src/cc-compat.h +1 -1
- data/vendor/libgit2/src/checkout.c +74 -68
- data/vendor/libgit2/src/cherrypick.c +10 -10
- data/vendor/libgit2/src/clone.c +66 -66
- data/vendor/libgit2/src/commit.c +128 -58
- data/vendor/libgit2/src/commit.h +24 -1
- data/vendor/libgit2/src/commit_graph.c +68 -53
- data/vendor/libgit2/src/commit_graph.h +10 -3
- data/vendor/libgit2/src/commit_list.c +2 -3
- data/vendor/libgit2/src/common.h +10 -3
- data/vendor/libgit2/src/config.c +99 -77
- data/vendor/libgit2/src/config.h +15 -2
- data/vendor/libgit2/src/config_file.c +103 -91
- data/vendor/libgit2/src/config_mem.c +9 -9
- data/vendor/libgit2/src/config_parse.c +27 -23
- data/vendor/libgit2/src/crlf.c +24 -21
- data/vendor/libgit2/src/date.c +10 -17
- data/vendor/libgit2/src/date.h +33 -0
- data/vendor/libgit2/src/describe.c +27 -19
- data/vendor/libgit2/src/diff.c +25 -8
- data/vendor/libgit2/src/diff.h +2 -4
- data/vendor/libgit2/src/diff_driver.c +34 -36
- data/vendor/libgit2/src/diff_driver.h +3 -3
- data/vendor/libgit2/src/diff_file.c +29 -20
- data/vendor/libgit2/src/diff_generate.c +30 -6
- data/vendor/libgit2/src/diff_generate.h +5 -3
- data/vendor/libgit2/src/diff_print.c +102 -95
- data/vendor/libgit2/src/diff_stats.c +40 -29
- data/vendor/libgit2/src/{message.h → diff_stats.h} +7 -6
- data/vendor/libgit2/src/diff_tform.c +9 -8
- data/vendor/libgit2/src/diff_xdiff.c +3 -8
- data/vendor/libgit2/src/email.c +54 -38
- data/vendor/libgit2/src/email.h +1 -1
- data/vendor/libgit2/src/errors.c +18 -18
- data/vendor/libgit2/src/features.h.in +6 -1
- data/vendor/libgit2/src/fetch.c +69 -24
- data/vendor/libgit2/src/fetch.h +1 -1
- data/vendor/libgit2/src/fetchhead.c +19 -19
- data/vendor/libgit2/src/filebuf.c +28 -28
- data/vendor/libgit2/src/filebuf.h +1 -1
- data/vendor/libgit2/src/filter.c +96 -52
- data/vendor/libgit2/src/filter.h +26 -5
- data/vendor/libgit2/src/fs_path.c +1912 -0
- data/vendor/libgit2/src/fs_path.h +752 -0
- data/vendor/libgit2/src/futils.c +91 -85
- data/vendor/libgit2/src/futils.h +26 -14
- data/vendor/libgit2/src/hash/sha1/collisiondetect.c +2 -2
- data/vendor/libgit2/src/hash/sha1/common_crypto.c +2 -2
- data/vendor/libgit2/src/hash/sha1/generic.c +2 -2
- data/vendor/libgit2/src/hash/sha1/mbedtls.c +2 -2
- data/vendor/libgit2/src/hash/sha1/openssl.c +2 -2
- data/vendor/libgit2/src/hash/sha1/sha1dc/sha1.c +1 -1
- data/vendor/libgit2/src/hash/sha1/win32.c +6 -6
- data/vendor/libgit2/src/hash/sha1.h +3 -1
- data/vendor/libgit2/src/hash.c +67 -35
- data/vendor/libgit2/src/hash.h +12 -12
- data/vendor/libgit2/src/ident.c +18 -18
- data/vendor/libgit2/src/ignore.c +35 -34
- data/vendor/libgit2/src/ignore.h +2 -2
- data/vendor/libgit2/src/index.c +79 -80
- data/vendor/libgit2/src/index.h +6 -3
- data/vendor/libgit2/src/indexer.c +75 -57
- data/vendor/libgit2/src/iterator.c +64 -56
- data/vendor/libgit2/src/iterator.h +5 -5
- data/vendor/libgit2/src/khash.h +1 -1
- data/vendor/libgit2/src/libgit2.c +22 -19
- data/vendor/libgit2/src/mailmap.c +38 -36
- data/vendor/libgit2/src/merge.c +27 -27
- data/vendor/libgit2/src/merge.h +1 -14
- data/vendor/libgit2/src/merge_driver.c +2 -2
- data/vendor/libgit2/src/merge_file.c +13 -3
- data/vendor/libgit2/src/message.c +21 -10
- data/vendor/libgit2/src/midx.c +83 -66
- data/vendor/libgit2/src/midx.h +3 -3
- data/vendor/libgit2/src/mwindow.c +1 -1
- data/vendor/libgit2/src/net.c +278 -68
- data/vendor/libgit2/src/net.h +10 -3
- data/vendor/libgit2/src/netops.c +1 -1
- data/vendor/libgit2/src/netops.h +1 -1
- data/vendor/libgit2/src/notes.c +20 -29
- data/vendor/libgit2/src/object.c +49 -9
- data/vendor/libgit2/src/object.h +1 -1
- data/vendor/libgit2/src/odb.c +35 -32
- data/vendor/libgit2/src/odb.h +1 -1
- data/vendor/libgit2/src/odb_loose.c +68 -68
- data/vendor/libgit2/src/odb_mempack.c +18 -5
- data/vendor/libgit2/src/odb_pack.c +43 -43
- data/vendor/libgit2/src/oid.c +11 -4
- data/vendor/libgit2/src/oid.h +15 -0
- data/vendor/libgit2/src/pack-objects.c +41 -26
- data/vendor/libgit2/src/pack-objects.h +11 -6
- data/vendor/libgit2/src/pack.c +10 -10
- data/vendor/libgit2/src/patch.c +3 -3
- data/vendor/libgit2/src/patch.h +1 -0
- data/vendor/libgit2/src/patch_generate.c +27 -11
- data/vendor/libgit2/src/patch_generate.h +5 -5
- data/vendor/libgit2/src/patch_parse.c +24 -24
- data/vendor/libgit2/src/path.c +76 -1951
- data/vendor/libgit2/src/path.h +34 -741
- data/vendor/libgit2/src/pathspec.c +6 -6
- data/vendor/libgit2/src/pathspec.h +2 -2
- data/vendor/libgit2/src/posix.c +3 -3
- data/vendor/libgit2/src/posix.h +1 -0
- data/vendor/libgit2/src/pqueue.h +1 -1
- data/vendor/libgit2/src/proxy.c +4 -1
- data/vendor/libgit2/src/proxy.h +1 -1
- data/vendor/libgit2/src/push.c +30 -35
- data/vendor/libgit2/src/push.h +4 -16
- data/vendor/libgit2/src/rand.c +226 -0
- data/vendor/libgit2/src/rand.h +37 -0
- data/vendor/libgit2/src/reader.c +8 -8
- data/vendor/libgit2/src/reader.h +2 -2
- data/vendor/libgit2/src/rebase.c +89 -88
- data/vendor/libgit2/src/refdb_fs.c +447 -173
- data/vendor/libgit2/src/refs.c +32 -32
- data/vendor/libgit2/src/refs.h +2 -2
- data/vendor/libgit2/src/refspec.c +32 -37
- data/vendor/libgit2/src/refspec.h +5 -2
- data/vendor/libgit2/src/regexp.c +1 -1
- data/vendor/libgit2/src/remote.c +713 -419
- data/vendor/libgit2/src/remote.h +15 -10
- data/vendor/libgit2/src/repository.c +350 -467
- data/vendor/libgit2/src/repository.h +11 -10
- data/vendor/libgit2/src/reset.c +8 -5
- data/vendor/libgit2/src/revert.c +10 -10
- data/vendor/libgit2/src/revparse.c +48 -35
- data/vendor/libgit2/src/revwalk.c +7 -7
- data/vendor/libgit2/src/signature.c +12 -6
- data/vendor/libgit2/src/signature.h +1 -1
- data/vendor/libgit2/src/sortedcache.c +1 -1
- data/vendor/libgit2/src/sortedcache.h +1 -1
- data/vendor/libgit2/src/stash.c +36 -37
- data/vendor/libgit2/src/status.c +4 -1
- data/vendor/libgit2/src/{buffer.c → str.c} +157 -151
- data/vendor/libgit2/src/str.h +357 -0
- data/vendor/libgit2/src/streams/mbedtls.c +8 -6
- data/vendor/libgit2/src/streams/openssl_dynamic.h +3 -3
- data/vendor/libgit2/src/submodule.c +171 -159
- data/vendor/libgit2/src/submodule.h +1 -1
- data/vendor/libgit2/src/sysdir.c +68 -52
- data/vendor/libgit2/src/sysdir.h +15 -10
- data/vendor/libgit2/src/tag.c +29 -27
- data/vendor/libgit2/src/thread.h +3 -3
- data/vendor/libgit2/src/threadstate.c +3 -3
- data/vendor/libgit2/src/threadstate.h +1 -1
- data/vendor/libgit2/src/trace.c +1 -14
- data/vendor/libgit2/src/trace.h +5 -22
- data/vendor/libgit2/src/trailer.c +1 -1
- data/vendor/libgit2/src/transaction.c +1 -1
- data/vendor/libgit2/src/transport.c +10 -10
- data/vendor/libgit2/src/transports/auth.c +7 -9
- data/vendor/libgit2/src/transports/auth.h +2 -3
- data/vendor/libgit2/src/transports/auth_negotiate.c +12 -13
- data/vendor/libgit2/src/transports/auth_ntlm.c +10 -10
- data/vendor/libgit2/src/transports/auth_ntlm.h +0 -1
- data/vendor/libgit2/src/transports/git.c +9 -11
- data/vendor/libgit2/src/transports/http.c +37 -17
- data/vendor/libgit2/src/transports/http.h +2 -3
- data/vendor/libgit2/src/transports/httpclient.c +65 -65
- data/vendor/libgit2/src/transports/local.c +124 -116
- data/vendor/libgit2/src/transports/smart.c +51 -139
- data/vendor/libgit2/src/transports/smart.h +25 -31
- data/vendor/libgit2/src/transports/smart_pkt.c +33 -33
- data/vendor/libgit2/src/transports/smart_protocol.c +57 -39
- data/vendor/libgit2/src/transports/ssh.c +47 -112
- data/vendor/libgit2/src/transports/winhttp.c +50 -56
- data/vendor/libgit2/src/tree-cache.c +5 -5
- data/vendor/libgit2/src/tree-cache.h +2 -2
- data/vendor/libgit2/src/tree.c +59 -48
- data/vendor/libgit2/src/tree.h +1 -1
- data/vendor/libgit2/src/unix/map.c +0 -2
- data/vendor/libgit2/src/unix/posix.h +1 -4
- data/vendor/libgit2/src/unix/realpath.c +0 -2
- data/vendor/libgit2/src/util.c +14 -14
- data/vendor/libgit2/src/util.h +2 -28
- data/vendor/libgit2/src/vector.h +1 -1
- data/vendor/libgit2/src/win32/findfile.c +172 -116
- data/vendor/libgit2/src/win32/findfile.h +7 -4
- data/vendor/libgit2/src/win32/path_w32.c +140 -9
- data/vendor/libgit2/src/win32/path_w32.h +2 -0
- data/vendor/libgit2/src/win32/posix.h +0 -1
- data/vendor/libgit2/src/win32/posix_w32.c +11 -27
- data/vendor/libgit2/src/win32/w32_buffer.c +2 -3
- data/vendor/libgit2/src/win32/w32_buffer.h +2 -3
- data/vendor/libgit2/src/win32/w32_leakcheck.c +1 -1
- data/vendor/libgit2/src/worktree.c +116 -94
- data/vendor/libgit2/src/worktree.h +1 -1
- data/vendor/libgit2/src/xdiff/git-xdiff.h +53 -0
- data/vendor/libgit2/src/xdiff/xdiff.h +15 -15
- data/vendor/libgit2/src/xdiff/xdiffi.c +134 -108
- data/vendor/libgit2/src/xdiff/xemit.c +23 -7
- data/vendor/libgit2/src/xdiff/xhistogram.c +87 -78
- data/vendor/libgit2/src/xdiff/xinclude.h +1 -12
- data/vendor/libgit2/src/xdiff/xmerge.c +104 -117
- data/vendor/libgit2/src/xdiff/xpatience.c +6 -17
- data/vendor/libgit2/src/xdiff/xprepare.c +15 -20
- data/vendor/libgit2/src/xdiff/xutils.c +18 -7
- data/vendor/libgit2/src/zstream.c +5 -5
- data/vendor/libgit2/src/zstream.h +4 -4
- metadata +25 -10
- data/vendor/libgit2/src/buffer.h +0 -374
data/vendor/libgit2/src/blob.h
CHANGED
|
@@ -38,7 +38,7 @@ struct git_blob {
|
|
|
38
38
|
void git_blob__free(void *blob);
|
|
39
39
|
int git_blob__parse(void *blob, git_odb_object *obj);
|
|
40
40
|
int git_blob__parse_raw(void *blob, const char *data, size_t size);
|
|
41
|
-
int git_blob__getbuf(
|
|
41
|
+
int git_blob__getbuf(git_str *buffer, git_blob *blob);
|
|
42
42
|
|
|
43
43
|
extern int git_blob__create_from_paths(
|
|
44
44
|
git_oid *out_oid,
|
data/vendor/libgit2/src/branch.c
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
#include "branch.h"
|
|
9
9
|
|
|
10
|
+
#include "buf.h"
|
|
10
11
|
#include "commit.h"
|
|
11
12
|
#include "tag.h"
|
|
12
13
|
#include "config.h"
|
|
@@ -27,11 +28,11 @@ static int retrieve_branch_reference(
|
|
|
27
28
|
git_reference *branch = NULL;
|
|
28
29
|
int error = 0;
|
|
29
30
|
char *prefix;
|
|
30
|
-
|
|
31
|
+
git_str ref_name = GIT_STR_INIT;
|
|
31
32
|
|
|
32
33
|
prefix = is_remote ? GIT_REFS_REMOTES_DIR : GIT_REFS_HEADS_DIR;
|
|
33
34
|
|
|
34
|
-
if ((error =
|
|
35
|
+
if ((error = git_str_joinpath(&ref_name, prefix, branch_name)) < 0)
|
|
35
36
|
/* OOM */;
|
|
36
37
|
else if ((error = git_reference_lookup(&branch, repo, ref_name.ptr)) < 0)
|
|
37
38
|
git_error_set(
|
|
@@ -40,7 +41,7 @@ static int retrieve_branch_reference(
|
|
|
40
41
|
|
|
41
42
|
*branch_reference_out = branch; /* will be NULL on error */
|
|
42
43
|
|
|
43
|
-
|
|
44
|
+
git_str_dispose(&ref_name);
|
|
44
45
|
return error;
|
|
45
46
|
}
|
|
46
47
|
|
|
@@ -62,8 +63,8 @@ static int create_branch(
|
|
|
62
63
|
{
|
|
63
64
|
int is_unmovable_head = 0;
|
|
64
65
|
git_reference *branch = NULL;
|
|
65
|
-
|
|
66
|
-
log_message =
|
|
66
|
+
git_str canonical_branch_name = GIT_STR_INIT,
|
|
67
|
+
log_message = GIT_STR_INIT;
|
|
67
68
|
int error = -1;
|
|
68
69
|
int bare = git_repository_is_bare(repository);
|
|
69
70
|
|
|
@@ -96,22 +97,22 @@ static int create_branch(
|
|
|
96
97
|
goto cleanup;
|
|
97
98
|
}
|
|
98
99
|
|
|
99
|
-
if (
|
|
100
|
+
if (git_str_joinpath(&canonical_branch_name, GIT_REFS_HEADS_DIR, branch_name) < 0)
|
|
100
101
|
goto cleanup;
|
|
101
102
|
|
|
102
|
-
if (
|
|
103
|
+
if (git_str_printf(&log_message, "branch: Created from %s", from) < 0)
|
|
103
104
|
goto cleanup;
|
|
104
105
|
|
|
105
106
|
error = git_reference_create(&branch, repository,
|
|
106
|
-
|
|
107
|
-
|
|
107
|
+
git_str_cstr(&canonical_branch_name), git_commit_id(commit), force,
|
|
108
|
+
git_str_cstr(&log_message));
|
|
108
109
|
|
|
109
110
|
if (!error)
|
|
110
111
|
*ref_out = branch;
|
|
111
112
|
|
|
112
113
|
cleanup:
|
|
113
|
-
|
|
114
|
-
|
|
114
|
+
git_str_dispose(&canonical_branch_name);
|
|
115
|
+
git_str_dispose(&log_message);
|
|
115
116
|
return error;
|
|
116
117
|
}
|
|
117
118
|
|
|
@@ -122,7 +123,10 @@ int git_branch_create(
|
|
|
122
123
|
const git_commit *commit,
|
|
123
124
|
int force)
|
|
124
125
|
{
|
|
125
|
-
|
|
126
|
+
char commit_id[GIT_OID_HEXSZ + 1];
|
|
127
|
+
|
|
128
|
+
git_oid_tostr(commit_id, GIT_OID_HEXSZ + 1, git_commit_id(commit));
|
|
129
|
+
return create_branch(ref_out, repository, branch_name, commit, commit_id, force);
|
|
126
130
|
}
|
|
127
131
|
|
|
128
132
|
int git_branch_create_from_annotated(
|
|
@@ -174,7 +178,7 @@ int git_branch_is_checked_out(const git_reference *branch)
|
|
|
174
178
|
int git_branch_delete(git_reference *branch)
|
|
175
179
|
{
|
|
176
180
|
int is_head;
|
|
177
|
-
|
|
181
|
+
git_str config_section = GIT_STR_INIT;
|
|
178
182
|
int error = -1;
|
|
179
183
|
|
|
180
184
|
GIT_ASSERT_ARG(branch);
|
|
@@ -200,18 +204,18 @@ int git_branch_delete(git_reference *branch)
|
|
|
200
204
|
return -1;
|
|
201
205
|
}
|
|
202
206
|
|
|
203
|
-
if (
|
|
207
|
+
if (git_str_join(&config_section, '.', "branch",
|
|
204
208
|
git_reference_name(branch) + strlen(GIT_REFS_HEADS_DIR)) < 0)
|
|
205
209
|
goto on_error;
|
|
206
210
|
|
|
207
211
|
if (git_config_rename_section(
|
|
208
|
-
git_reference_owner(branch),
|
|
212
|
+
git_reference_owner(branch), git_str_cstr(&config_section), NULL) < 0)
|
|
209
213
|
goto on_error;
|
|
210
214
|
|
|
211
215
|
error = git_reference_delete(branch);
|
|
212
216
|
|
|
213
217
|
on_error:
|
|
214
|
-
|
|
218
|
+
git_str_dispose(&config_section);
|
|
215
219
|
return error;
|
|
216
220
|
}
|
|
217
221
|
|
|
@@ -286,10 +290,10 @@ int git_branch_move(
|
|
|
286
290
|
const char *new_branch_name,
|
|
287
291
|
int force)
|
|
288
292
|
{
|
|
289
|
-
|
|
290
|
-
old_config_section =
|
|
291
|
-
new_config_section =
|
|
292
|
-
log_message =
|
|
293
|
+
git_str new_reference_name = GIT_STR_INIT,
|
|
294
|
+
old_config_section = GIT_STR_INIT,
|
|
295
|
+
new_config_section = GIT_STR_INIT,
|
|
296
|
+
log_message = GIT_STR_INIT;
|
|
293
297
|
int error;
|
|
294
298
|
|
|
295
299
|
GIT_ASSERT_ARG(branch);
|
|
@@ -298,35 +302,35 @@ int git_branch_move(
|
|
|
298
302
|
if (!git_reference_is_branch(branch))
|
|
299
303
|
return not_a_local_branch(git_reference_name(branch));
|
|
300
304
|
|
|
301
|
-
if ((error =
|
|
305
|
+
if ((error = git_str_joinpath(&new_reference_name, GIT_REFS_HEADS_DIR, new_branch_name)) < 0)
|
|
302
306
|
goto done;
|
|
303
307
|
|
|
304
|
-
if ((error =
|
|
305
|
-
git_reference_name(branch),
|
|
308
|
+
if ((error = git_str_printf(&log_message, "branch: renamed %s to %s",
|
|
309
|
+
git_reference_name(branch), git_str_cstr(&new_reference_name))) < 0)
|
|
306
310
|
goto done;
|
|
307
311
|
|
|
308
312
|
/* first update ref then config so failure won't trash config */
|
|
309
313
|
|
|
310
314
|
error = git_reference_rename(
|
|
311
|
-
out, branch,
|
|
312
|
-
|
|
315
|
+
out, branch, git_str_cstr(&new_reference_name), force,
|
|
316
|
+
git_str_cstr(&log_message));
|
|
313
317
|
if (error < 0)
|
|
314
318
|
goto done;
|
|
315
319
|
|
|
316
|
-
|
|
320
|
+
git_str_join(&old_config_section, '.', "branch",
|
|
317
321
|
git_reference_name(branch) + strlen(GIT_REFS_HEADS_DIR));
|
|
318
|
-
|
|
322
|
+
git_str_join(&new_config_section, '.', "branch", new_branch_name);
|
|
319
323
|
|
|
320
324
|
error = git_config_rename_section(
|
|
321
325
|
git_reference_owner(branch),
|
|
322
|
-
|
|
323
|
-
|
|
326
|
+
git_str_cstr(&old_config_section),
|
|
327
|
+
git_str_cstr(&new_config_section));
|
|
324
328
|
|
|
325
329
|
done:
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
+
git_str_dispose(&new_reference_name);
|
|
331
|
+
git_str_dispose(&old_config_section);
|
|
332
|
+
git_str_dispose(&new_config_section);
|
|
333
|
+
git_str_dispose(&log_message);
|
|
330
334
|
|
|
331
335
|
return error;
|
|
332
336
|
}
|
|
@@ -384,20 +388,20 @@ int git_branch_name(
|
|
|
384
388
|
}
|
|
385
389
|
|
|
386
390
|
static int retrieve_upstream_configuration(
|
|
387
|
-
|
|
391
|
+
git_str *out,
|
|
388
392
|
const git_config *config,
|
|
389
393
|
const char *canonical_branch_name,
|
|
390
394
|
const char *format)
|
|
391
395
|
{
|
|
392
|
-
|
|
396
|
+
git_str buf = GIT_STR_INIT;
|
|
393
397
|
int error;
|
|
394
398
|
|
|
395
|
-
if (
|
|
399
|
+
if (git_str_printf(&buf, format,
|
|
396
400
|
canonical_branch_name + strlen(GIT_REFS_HEADS_DIR)) < 0)
|
|
397
401
|
return -1;
|
|
398
402
|
|
|
399
|
-
error =
|
|
400
|
-
|
|
403
|
+
error = git_config__get_string_buf(out, config, git_str_cstr(&buf));
|
|
404
|
+
git_str_dispose(&buf);
|
|
401
405
|
return error;
|
|
402
406
|
}
|
|
403
407
|
|
|
@@ -406,20 +410,26 @@ int git_branch_upstream_name(
|
|
|
406
410
|
git_repository *repo,
|
|
407
411
|
const char *refname)
|
|
408
412
|
{
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
413
|
+
GIT_BUF_WRAP_PRIVATE(out, git_branch__upstream_name, repo, refname);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
int git_branch__upstream_name(
|
|
417
|
+
git_str *out,
|
|
418
|
+
git_repository *repo,
|
|
419
|
+
const char *refname)
|
|
420
|
+
{
|
|
421
|
+
git_str remote_name = GIT_STR_INIT;
|
|
422
|
+
git_str merge_name = GIT_STR_INIT;
|
|
423
|
+
git_str buf = GIT_STR_INIT;
|
|
412
424
|
int error = -1;
|
|
413
425
|
git_remote *remote = NULL;
|
|
414
426
|
const git_refspec *refspec;
|
|
415
427
|
git_config *config;
|
|
416
428
|
|
|
417
429
|
GIT_ASSERT_ARG(out);
|
|
430
|
+
GIT_ASSERT_ARG(repo);
|
|
418
431
|
GIT_ASSERT_ARG(refname);
|
|
419
432
|
|
|
420
|
-
if ((error = git_buf_sanitize(out)) < 0)
|
|
421
|
-
return error;
|
|
422
|
-
|
|
423
433
|
if (!git_reference__is_branch(refname))
|
|
424
434
|
return not_a_local_branch(refname);
|
|
425
435
|
|
|
@@ -434,75 +444,109 @@ int git_branch_upstream_name(
|
|
|
434
444
|
&merge_name, config, refname, "branch.%s.merge")) < 0)
|
|
435
445
|
goto cleanup;
|
|
436
446
|
|
|
437
|
-
if (
|
|
447
|
+
if (git_str_len(&remote_name) == 0 || git_str_len(&merge_name) == 0) {
|
|
438
448
|
git_error_set(GIT_ERROR_REFERENCE,
|
|
439
449
|
"branch '%s' does not have an upstream", refname);
|
|
440
450
|
error = GIT_ENOTFOUND;
|
|
441
451
|
goto cleanup;
|
|
442
452
|
}
|
|
443
453
|
|
|
444
|
-
if (strcmp(".",
|
|
445
|
-
if ((error = git_remote_lookup(&remote, repo,
|
|
454
|
+
if (strcmp(".", git_str_cstr(&remote_name)) != 0) {
|
|
455
|
+
if ((error = git_remote_lookup(&remote, repo, git_str_cstr(&remote_name))) < 0)
|
|
446
456
|
goto cleanup;
|
|
447
457
|
|
|
448
|
-
refspec = git_remote__matching_refspec(remote,
|
|
458
|
+
refspec = git_remote__matching_refspec(remote, git_str_cstr(&merge_name));
|
|
449
459
|
if (!refspec) {
|
|
450
460
|
error = GIT_ENOTFOUND;
|
|
451
461
|
goto cleanup;
|
|
452
462
|
}
|
|
453
463
|
|
|
454
|
-
if (
|
|
464
|
+
if (git_refspec__transform(&buf, refspec, git_str_cstr(&merge_name)) < 0)
|
|
455
465
|
goto cleanup;
|
|
456
466
|
} else
|
|
457
|
-
if (
|
|
467
|
+
if (git_str_set(&buf, git_str_cstr(&merge_name), git_str_len(&merge_name)) < 0)
|
|
458
468
|
goto cleanup;
|
|
459
469
|
|
|
460
|
-
|
|
470
|
+
git_str_swap(out, &buf);
|
|
461
471
|
|
|
462
472
|
cleanup:
|
|
463
473
|
git_config_free(config);
|
|
464
474
|
git_remote_free(remote);
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
475
|
+
git_str_dispose(&remote_name);
|
|
476
|
+
git_str_dispose(&merge_name);
|
|
477
|
+
git_str_dispose(&buf);
|
|
468
478
|
return error;
|
|
469
479
|
}
|
|
470
480
|
|
|
471
|
-
static int git_branch_upstream_with_format(
|
|
481
|
+
static int git_branch_upstream_with_format(
|
|
482
|
+
git_str *out,
|
|
483
|
+
git_repository *repo,
|
|
484
|
+
const char *refname,
|
|
485
|
+
const char *format,
|
|
486
|
+
const char *format_name)
|
|
472
487
|
{
|
|
473
|
-
int error;
|
|
474
488
|
git_config *cfg;
|
|
489
|
+
int error;
|
|
475
490
|
|
|
476
491
|
if (!git_reference__is_branch(refname))
|
|
477
492
|
return not_a_local_branch(refname);
|
|
478
493
|
|
|
479
|
-
if ((error = git_repository_config__weakptr(&cfg, repo)) < 0
|
|
494
|
+
if ((error = git_repository_config__weakptr(&cfg, repo)) < 0 ||
|
|
495
|
+
(error = retrieve_upstream_configuration(out, cfg, refname, format)) < 0)
|
|
480
496
|
return error;
|
|
481
497
|
|
|
482
|
-
if ((
|
|
483
|
-
(error = retrieve_upstream_configuration(buf, cfg, refname, format)) < 0)
|
|
484
|
-
return error;
|
|
485
|
-
|
|
486
|
-
if (git_buf_len(buf) == 0) {
|
|
498
|
+
if (git_str_len(out) == 0) {
|
|
487
499
|
git_error_set(GIT_ERROR_REFERENCE, "branch '%s' does not have an upstream %s", refname, format_name);
|
|
488
500
|
error = GIT_ENOTFOUND;
|
|
489
|
-
git_buf_clear(buf);
|
|
490
501
|
}
|
|
491
502
|
|
|
492
503
|
return error;
|
|
493
504
|
}
|
|
494
505
|
|
|
495
|
-
int git_branch_upstream_remote(
|
|
506
|
+
int git_branch_upstream_remote(
|
|
507
|
+
git_buf *out,
|
|
508
|
+
git_repository *repo,
|
|
509
|
+
const char *refname)
|
|
510
|
+
{
|
|
511
|
+
GIT_BUF_WRAP_PRIVATE(out, git_branch__upstream_remote, repo, refname);
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
int git_branch__upstream_remote(
|
|
515
|
+
git_str *out,
|
|
516
|
+
git_repository *repo,
|
|
517
|
+
const char *refname)
|
|
496
518
|
{
|
|
497
|
-
return git_branch_upstream_with_format(
|
|
519
|
+
return git_branch_upstream_with_format(out, repo, refname, "branch.%s.remote", "remote");
|
|
498
520
|
}
|
|
499
521
|
|
|
500
|
-
int git_branch_upstream_merge(
|
|
522
|
+
int git_branch_upstream_merge(
|
|
523
|
+
git_buf *out,
|
|
524
|
+
git_repository *repo,
|
|
525
|
+
const char *refname)
|
|
501
526
|
{
|
|
502
|
-
|
|
527
|
+
GIT_BUF_WRAP_PRIVATE(out, git_branch__upstream_merge, repo, refname);
|
|
503
528
|
}
|
|
504
529
|
|
|
505
|
-
int
|
|
530
|
+
int git_branch__upstream_merge(
|
|
531
|
+
git_str *out,
|
|
532
|
+
git_repository *repo,
|
|
533
|
+
const char *refname)
|
|
534
|
+
{
|
|
535
|
+
return git_branch_upstream_with_format(out, repo, refname, "branch.%s.merge", "merge");
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
int git_branch_remote_name(
|
|
539
|
+
git_buf *out,
|
|
540
|
+
git_repository *repo,
|
|
541
|
+
const char *refname)
|
|
542
|
+
{
|
|
543
|
+
GIT_BUF_WRAP_PRIVATE(out, git_branch__remote_name, repo, refname);
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
int git_branch__remote_name(
|
|
547
|
+
git_str *out,
|
|
548
|
+
git_repository *repo,
|
|
549
|
+
const char *refname)
|
|
506
550
|
{
|
|
507
551
|
git_strarray remote_list = {0};
|
|
508
552
|
size_t i;
|
|
@@ -511,13 +555,10 @@ int git_branch_remote_name(git_buf *buf, git_repository *repo, const char *refna
|
|
|
511
555
|
int error = 0;
|
|
512
556
|
char *remote_name = NULL;
|
|
513
557
|
|
|
514
|
-
GIT_ASSERT_ARG(
|
|
558
|
+
GIT_ASSERT_ARG(out);
|
|
515
559
|
GIT_ASSERT_ARG(repo);
|
|
516
560
|
GIT_ASSERT_ARG(refname);
|
|
517
561
|
|
|
518
|
-
if ((error = git_buf_sanitize(buf)) < 0)
|
|
519
|
-
return error;
|
|
520
|
-
|
|
521
562
|
/* Verify that this is a remote branch */
|
|
522
563
|
if (!git_reference__is_remote(refname)) {
|
|
523
564
|
git_error_set(GIT_ERROR_INVALID, "reference '%s' is not a remote branch.",
|
|
@@ -557,8 +598,8 @@ int git_branch_remote_name(git_buf *buf, git_repository *repo, const char *refna
|
|
|
557
598
|
}
|
|
558
599
|
|
|
559
600
|
if (remote_name) {
|
|
560
|
-
|
|
561
|
-
error =
|
|
601
|
+
git_str_clear(out);
|
|
602
|
+
error = git_str_puts(out, remote_name);
|
|
562
603
|
} else {
|
|
563
604
|
git_error_set(GIT_ERROR_REFERENCE,
|
|
564
605
|
"could not determine remote for '%s'", refname);
|
|
@@ -567,7 +608,7 @@ int git_branch_remote_name(git_buf *buf, git_repository *repo, const char *refna
|
|
|
567
608
|
|
|
568
609
|
cleanup:
|
|
569
610
|
if (error < 0)
|
|
570
|
-
|
|
611
|
+
git_str_dispose(out);
|
|
571
612
|
|
|
572
613
|
git_strarray_dispose(&remote_list);
|
|
573
614
|
return error;
|
|
@@ -578,49 +619,49 @@ int git_branch_upstream(
|
|
|
578
619
|
const git_reference *branch)
|
|
579
620
|
{
|
|
580
621
|
int error;
|
|
581
|
-
|
|
622
|
+
git_str tracking_name = GIT_STR_INIT;
|
|
582
623
|
|
|
583
|
-
if ((error =
|
|
624
|
+
if ((error = git_branch__upstream_name(&tracking_name,
|
|
584
625
|
git_reference_owner(branch), git_reference_name(branch))) < 0)
|
|
585
626
|
return error;
|
|
586
627
|
|
|
587
628
|
error = git_reference_lookup(
|
|
588
629
|
tracking_out,
|
|
589
630
|
git_reference_owner(branch),
|
|
590
|
-
|
|
631
|
+
git_str_cstr(&tracking_name));
|
|
591
632
|
|
|
592
|
-
|
|
633
|
+
git_str_dispose(&tracking_name);
|
|
593
634
|
return error;
|
|
594
635
|
}
|
|
595
636
|
|
|
596
637
|
static int unset_upstream(git_config *config, const char *shortname)
|
|
597
638
|
{
|
|
598
|
-
|
|
639
|
+
git_str buf = GIT_STR_INIT;
|
|
599
640
|
|
|
600
|
-
if (
|
|
641
|
+
if (git_str_printf(&buf, "branch.%s.remote", shortname) < 0)
|
|
601
642
|
return -1;
|
|
602
643
|
|
|
603
|
-
if (git_config_delete_entry(config,
|
|
644
|
+
if (git_config_delete_entry(config, git_str_cstr(&buf)) < 0)
|
|
604
645
|
goto on_error;
|
|
605
646
|
|
|
606
|
-
|
|
607
|
-
if (
|
|
647
|
+
git_str_clear(&buf);
|
|
648
|
+
if (git_str_printf(&buf, "branch.%s.merge", shortname) < 0)
|
|
608
649
|
goto on_error;
|
|
609
650
|
|
|
610
|
-
if (git_config_delete_entry(config,
|
|
651
|
+
if (git_config_delete_entry(config, git_str_cstr(&buf)) < 0)
|
|
611
652
|
goto on_error;
|
|
612
653
|
|
|
613
|
-
|
|
654
|
+
git_str_dispose(&buf);
|
|
614
655
|
return 0;
|
|
615
656
|
|
|
616
657
|
on_error:
|
|
617
|
-
|
|
658
|
+
git_str_dispose(&buf);
|
|
618
659
|
return -1;
|
|
619
660
|
}
|
|
620
661
|
|
|
621
662
|
int git_branch_set_upstream(git_reference *branch, const char *branch_name)
|
|
622
663
|
{
|
|
623
|
-
|
|
664
|
+
git_str key = GIT_STR_INIT, remote_name = GIT_STR_INIT, merge_refspec = GIT_STR_INIT;
|
|
624
665
|
git_reference *upstream;
|
|
625
666
|
git_repository *repo;
|
|
626
667
|
git_remote *remote = NULL;
|
|
@@ -662,31 +703,31 @@ int git_branch_set_upstream(git_reference *branch, const char *branch_name)
|
|
|
662
703
|
* name on the remote is and use that.
|
|
663
704
|
*/
|
|
664
705
|
if (local)
|
|
665
|
-
error =
|
|
706
|
+
error = git_str_puts(&remote_name, ".");
|
|
666
707
|
else
|
|
667
|
-
error =
|
|
708
|
+
error = git_branch__remote_name(&remote_name, repo, git_reference_name(upstream));
|
|
668
709
|
|
|
669
710
|
if (error < 0)
|
|
670
711
|
goto on_error;
|
|
671
712
|
|
|
672
|
-
/* Update the
|
|
673
|
-
if (
|
|
713
|
+
/* Update the upstream branch config with the new name */
|
|
714
|
+
if (git_str_printf(&key, "branch.%s.remote", shortname) < 0)
|
|
674
715
|
goto on_error;
|
|
675
716
|
|
|
676
|
-
if (git_config_set_string(config,
|
|
717
|
+
if (git_config_set_string(config, git_str_cstr(&key), git_str_cstr(&remote_name)) < 0)
|
|
677
718
|
goto on_error;
|
|
678
719
|
|
|
679
720
|
if (local) {
|
|
680
721
|
/* A local branch uses the upstream refname directly */
|
|
681
|
-
if (
|
|
722
|
+
if (git_str_puts(&merge_refspec, git_reference_name(upstream)) < 0)
|
|
682
723
|
goto on_error;
|
|
683
724
|
} else {
|
|
684
725
|
/* We transform the upstream branch name according to the remote's refspecs */
|
|
685
|
-
if (git_remote_lookup(&remote, repo,
|
|
726
|
+
if (git_remote_lookup(&remote, repo, git_str_cstr(&remote_name)) < 0)
|
|
686
727
|
goto on_error;
|
|
687
728
|
|
|
688
729
|
fetchspec = git_remote__matching_dst_refspec(remote, git_reference_name(upstream));
|
|
689
|
-
if (!fetchspec ||
|
|
730
|
+
if (!fetchspec || git_refspec__rtransform(&merge_refspec, fetchspec, git_reference_name(upstream)) < 0)
|
|
690
731
|
goto on_error;
|
|
691
732
|
|
|
692
733
|
git_remote_free(remote);
|
|
@@ -694,25 +735,25 @@ int git_branch_set_upstream(git_reference *branch, const char *branch_name)
|
|
|
694
735
|
}
|
|
695
736
|
|
|
696
737
|
/* Update the merge branch config with the refspec */
|
|
697
|
-
|
|
698
|
-
if (
|
|
738
|
+
git_str_clear(&key);
|
|
739
|
+
if (git_str_printf(&key, "branch.%s.merge", shortname) < 0)
|
|
699
740
|
goto on_error;
|
|
700
741
|
|
|
701
|
-
if (git_config_set_string(config,
|
|
742
|
+
if (git_config_set_string(config, git_str_cstr(&key), git_str_cstr(&merge_refspec)) < 0)
|
|
702
743
|
goto on_error;
|
|
703
744
|
|
|
704
745
|
git_reference_free(upstream);
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
746
|
+
git_str_dispose(&key);
|
|
747
|
+
git_str_dispose(&remote_name);
|
|
748
|
+
git_str_dispose(&merge_refspec);
|
|
708
749
|
|
|
709
750
|
return 0;
|
|
710
751
|
|
|
711
752
|
on_error:
|
|
712
753
|
git_reference_free(upstream);
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
754
|
+
git_str_dispose(&key);
|
|
755
|
+
git_str_dispose(&remote_name);
|
|
756
|
+
git_str_dispose(&merge_refspec);
|
|
716
757
|
git_remote_free(remote);
|
|
717
758
|
|
|
718
759
|
return -1;
|
|
@@ -749,7 +790,7 @@ int git_branch_is_head(
|
|
|
749
790
|
|
|
750
791
|
int git_branch_name_is_valid(int *valid, const char *name)
|
|
751
792
|
{
|
|
752
|
-
|
|
793
|
+
git_str ref_name = GIT_STR_INIT;
|
|
753
794
|
int error = 0;
|
|
754
795
|
|
|
755
796
|
GIT_ASSERT(valid);
|
|
@@ -765,13 +806,13 @@ int git_branch_name_is_valid(int *valid, const char *name)
|
|
|
765
806
|
if (!name || name[0] == '-' || !git__strcmp(name, "HEAD"))
|
|
766
807
|
goto done;
|
|
767
808
|
|
|
768
|
-
if ((error =
|
|
769
|
-
(error =
|
|
809
|
+
if ((error = git_str_puts(&ref_name, GIT_REFS_HEADS_DIR)) < 0 ||
|
|
810
|
+
(error = git_str_puts(&ref_name, name)) < 0)
|
|
770
811
|
goto done;
|
|
771
812
|
|
|
772
813
|
error = git_reference_name_is_valid(valid, ref_name.ptr);
|
|
773
814
|
|
|
774
815
|
done:
|
|
775
|
-
|
|
816
|
+
git_str_dispose(&ref_name);
|
|
776
817
|
return error;
|
|
777
818
|
}
|
data/vendor/libgit2/src/branch.h
CHANGED
|
@@ -9,10 +9,22 @@
|
|
|
9
9
|
|
|
10
10
|
#include "common.h"
|
|
11
11
|
|
|
12
|
-
#include "
|
|
12
|
+
#include "str.h"
|
|
13
13
|
|
|
14
|
-
int
|
|
15
|
-
|
|
14
|
+
int git_branch__remote_name(
|
|
15
|
+
git_str *out,
|
|
16
|
+
git_repository *repo,
|
|
17
|
+
const char *refname);
|
|
18
|
+
int git_branch__upstream_remote(
|
|
19
|
+
git_str *out,
|
|
20
|
+
git_repository *repo,
|
|
21
|
+
const char *refname);
|
|
22
|
+
int git_branch__upstream_merge(
|
|
23
|
+
git_str *out,
|
|
24
|
+
git_repository *repo,
|
|
25
|
+
const char *refname);
|
|
26
|
+
int git_branch__upstream_name(
|
|
27
|
+
git_str *tracking_name,
|
|
16
28
|
git_repository *repo,
|
|
17
29
|
const char *canonical_branch_name);
|
|
18
30
|
|