rugged 0.17.0.b7 → 0.18.0.b1
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.
- data/LICENSE +1 -1
- data/README.md +88 -32
- data/ext/rugged/extconf.rb +4 -2
- data/ext/rugged/rugged.c +72 -10
- data/ext/rugged/rugged.h +14 -10
- data/ext/rugged/rugged_blob.c +8 -10
- data/ext/rugged/rugged_branch.c +11 -14
- data/ext/rugged/rugged_commit.c +31 -24
- data/ext/rugged/rugged_config.c +2 -2
- data/ext/rugged/rugged_index.c +133 -198
- data/ext/rugged/rugged_note.c +372 -0
- data/ext/rugged/rugged_object.c +50 -22
- data/ext/rugged/rugged_reference.c +122 -130
- data/ext/rugged/rugged_remote.c +72 -29
- data/ext/rugged/rugged_repo.c +402 -20
- data/ext/rugged/rugged_revwalk.c +7 -3
- data/ext/rugged/rugged_settings.c +110 -0
- data/ext/rugged/rugged_signature.c +23 -7
- data/ext/rugged/rugged_tag.c +32 -16
- data/ext/rugged/rugged_tree.c +44 -15
- data/lib/rugged.rb +1 -0
- data/lib/rugged/index.rb +8 -0
- data/lib/rugged/remote.rb +13 -0
- data/lib/rugged/repository.rb +3 -3
- data/lib/rugged/version.rb +1 -1
- data/test/blob_test.rb +13 -15
- data/test/branch_test.rb +32 -67
- data/test/commit_test.rb +50 -12
- data/test/config_test.rb +12 -11
- data/test/coverage/HEAD.json +1 -1
- data/test/coverage/cover.rb +40 -21
- data/test/errors_test.rb +34 -0
- data/test/fixtures/alternate/objects/14/6ae76773c91e3b1d00cf7a338ec55ae58297e2 +0 -0
- data/test/fixtures/alternate/objects/14/9c32d47e99d0a3572ff1e70a2e0051bbf347a9 +0 -0
- data/test/fixtures/alternate/objects/14/fb3108588f9421bf764041e5e3ac305eb6277f +0 -0
- data/test/fixtures/testrepo.git/logs/refs/notes/commits +1 -0
- data/test/fixtures/testrepo.git/objects/44/1034f860c1d5d90e4188d11ae0d325176869a8 +1 -0
- data/test/fixtures/testrepo.git/objects/60/d415052a33de2150bf68757f6461df4f563ae4 +0 -0
- data/test/fixtures/testrepo.git/objects/68/8a8f4ef7496901d15322972f96e212a9e466cc +1 -0
- data/test/fixtures/testrepo.git/objects/94/eca2de348d5f672faf56b0decafa5937e3235e +0 -0
- data/test/fixtures/testrepo.git/objects/9b/7384fe1676186192842f5d3e129457b62db9e3 +0 -0
- data/test/fixtures/testrepo.git/objects/b7/4713326bc972cc15751ed504dca6f6f3b91f7a +3 -0
- data/test/fixtures/testrepo.git/refs/notes/commits +1 -0
- data/test/index_test.rb +65 -69
- data/test/lib_test.rb +76 -11
- data/test/note_test.rb +158 -0
- data/test/object_test.rb +8 -11
- data/test/reference_test.rb +77 -85
- data/test/remote_test.rb +86 -8
- data/test/repo_pack_test.rb +9 -7
- data/test/repo_reset_test.rb +80 -0
- data/test/repo_test.rb +176 -53
- data/test/tag_test.rb +44 -7
- data/test/test_helper.rb +63 -35
- data/test/tree_test.rb +34 -13
- data/test/walker_test.rb +14 -14
- data/vendor/libgit2/Makefile.embed +1 -1
- data/vendor/libgit2/deps/http-parser/http_parser.c +974 -578
- data/vendor/libgit2/deps/http-parser/http_parser.h +106 -70
- data/vendor/libgit2/deps/regex/regcomp.c +7 -6
- data/vendor/libgit2/deps/regex/regex_internal.c +1 -1
- data/vendor/libgit2/deps/regex/regex_internal.h +12 -3
- data/vendor/libgit2/deps/regex/regexec.c +5 -5
- data/vendor/libgit2/include/git2.h +5 -1
- data/vendor/libgit2/include/git2/attr.h +4 -2
- data/vendor/libgit2/include/git2/blob.h +39 -12
- data/vendor/libgit2/include/git2/branch.h +123 -35
- data/vendor/libgit2/include/git2/checkout.h +206 -48
- data/vendor/libgit2/include/git2/clone.h +72 -27
- data/vendor/libgit2/include/git2/commit.h +20 -17
- data/vendor/libgit2/include/git2/common.h +67 -1
- data/vendor/libgit2/include/git2/config.h +81 -60
- data/vendor/libgit2/include/git2/cred_helpers.h +53 -0
- data/vendor/libgit2/include/git2/diff.h +459 -150
- data/vendor/libgit2/include/git2/errors.h +9 -1
- data/vendor/libgit2/include/git2/graph.h +41 -0
- data/vendor/libgit2/include/git2/ignore.h +7 -6
- data/vendor/libgit2/include/git2/index.h +323 -97
- data/vendor/libgit2/include/git2/indexer.h +27 -59
- data/vendor/libgit2/include/git2/inttypes.h +4 -0
- data/vendor/libgit2/include/git2/merge.h +13 -3
- data/vendor/libgit2/include/git2/message.h +14 -8
- data/vendor/libgit2/include/git2/net.h +9 -7
- data/vendor/libgit2/include/git2/notes.h +88 -29
- data/vendor/libgit2/include/git2/object.h +16 -6
- data/vendor/libgit2/include/git2/odb.h +80 -17
- data/vendor/libgit2/include/git2/odb_backend.h +47 -11
- data/vendor/libgit2/include/git2/oid.h +26 -17
- data/vendor/libgit2/include/git2/pack.h +62 -8
- data/vendor/libgit2/include/git2/push.h +131 -0
- data/vendor/libgit2/include/git2/refdb.h +103 -0
- data/vendor/libgit2/include/git2/refdb_backend.h +109 -0
- data/vendor/libgit2/include/git2/reflog.h +30 -21
- data/vendor/libgit2/include/git2/refs.h +215 -193
- data/vendor/libgit2/include/git2/refspec.h +22 -2
- data/vendor/libgit2/include/git2/remote.h +158 -37
- data/vendor/libgit2/include/git2/repository.h +150 -31
- data/vendor/libgit2/include/git2/reset.h +43 -9
- data/vendor/libgit2/include/git2/revparse.h +48 -4
- data/vendor/libgit2/include/git2/revwalk.h +25 -10
- data/vendor/libgit2/include/git2/signature.h +20 -12
- data/vendor/libgit2/include/git2/stash.h +121 -0
- data/vendor/libgit2/include/git2/status.h +122 -53
- data/vendor/libgit2/include/git2/strarray.h +17 -11
- data/vendor/libgit2/include/git2/submodule.h +42 -7
- data/vendor/libgit2/include/git2/tag.h +72 -59
- data/vendor/libgit2/include/git2/threads.h +4 -2
- data/vendor/libgit2/include/git2/trace.h +68 -0
- data/vendor/libgit2/include/git2/transport.h +328 -0
- data/vendor/libgit2/include/git2/tree.h +149 -120
- data/vendor/libgit2/include/git2/types.h +13 -12
- data/vendor/libgit2/include/git2/version.h +3 -3
- data/vendor/libgit2/src/amiga/map.c +2 -2
- data/vendor/libgit2/src/attr.c +58 -48
- data/vendor/libgit2/src/attr.h +4 -18
- data/vendor/libgit2/src/attr_file.c +30 -6
- data/vendor/libgit2/src/attr_file.h +6 -8
- data/vendor/libgit2/src/attrcache.h +24 -0
- data/vendor/libgit2/src/blob.c +30 -7
- data/vendor/libgit2/src/blob.h +1 -1
- data/vendor/libgit2/src/branch.c +361 -68
- data/vendor/libgit2/src/branch.h +17 -0
- data/vendor/libgit2/src/bswap.h +1 -1
- data/vendor/libgit2/src/buf_text.c +291 -0
- data/vendor/libgit2/src/buf_text.h +122 -0
- data/vendor/libgit2/src/buffer.c +27 -101
- data/vendor/libgit2/src/buffer.h +54 -39
- data/vendor/libgit2/src/cache.c +15 -6
- data/vendor/libgit2/src/cache.h +1 -1
- data/vendor/libgit2/src/cc-compat.h +3 -1
- data/vendor/libgit2/src/checkout.c +1165 -222
- data/vendor/libgit2/src/checkout.h +24 -0
- data/vendor/libgit2/src/clone.c +171 -86
- data/vendor/libgit2/src/commit.c +44 -45
- data/vendor/libgit2/src/commit.h +3 -3
- data/vendor/libgit2/src/commit_list.c +194 -0
- data/vendor/libgit2/src/commit_list.h +49 -0
- data/vendor/libgit2/src/common.h +44 -10
- data/vendor/libgit2/src/compress.c +1 -1
- data/vendor/libgit2/src/compress.h +1 -1
- data/vendor/libgit2/src/config.c +211 -124
- data/vendor/libgit2/src/config.h +23 -4
- data/vendor/libgit2/src/config_cache.c +2 -2
- data/vendor/libgit2/src/config_file.c +129 -53
- data/vendor/libgit2/src/config_file.h +10 -8
- data/vendor/libgit2/src/crlf.c +66 -67
- data/vendor/libgit2/src/date.c +12 -12
- data/vendor/libgit2/src/delta-apply.c +14 -1
- data/vendor/libgit2/src/delta-apply.h +18 -1
- data/vendor/libgit2/src/delta.c +40 -107
- data/vendor/libgit2/src/delta.h +19 -17
- data/vendor/libgit2/src/diff.c +347 -496
- data/vendor/libgit2/src/diff.h +27 -1
- data/vendor/libgit2/src/diff_output.c +564 -249
- data/vendor/libgit2/src/diff_output.h +15 -8
- data/vendor/libgit2/src/diff_tform.c +687 -0
- data/vendor/libgit2/src/errors.c +27 -36
- data/vendor/libgit2/src/fetch.c +13 -351
- data/vendor/libgit2/src/fetch.h +13 -3
- data/vendor/libgit2/src/fetchhead.c +295 -0
- data/vendor/libgit2/src/fetchhead.h +34 -0
- data/vendor/libgit2/src/filebuf.c +42 -15
- data/vendor/libgit2/src/filebuf.h +4 -2
- data/vendor/libgit2/src/fileops.c +466 -113
- data/vendor/libgit2/src/fileops.h +154 -28
- data/vendor/libgit2/src/filter.c +3 -75
- data/vendor/libgit2/src/filter.h +1 -29
- data/vendor/libgit2/src/fnmatch.c +1 -1
- data/vendor/libgit2/src/fnmatch.h +1 -1
- data/vendor/libgit2/src/global.c +54 -10
- data/vendor/libgit2/src/global.h +10 -1
- data/vendor/libgit2/src/graph.c +178 -0
- data/vendor/libgit2/src/hash.c +25 -52
- data/vendor/libgit2/src/hash.h +21 -9
- data/vendor/libgit2/src/{sha1/sha1.c → hash/hash_generic.c} +20 -12
- data/vendor/libgit2/src/hash/hash_generic.h +24 -0
- data/vendor/libgit2/src/hash/hash_openssl.h +45 -0
- data/vendor/libgit2/src/hash/hash_win32.c +291 -0
- data/vendor/libgit2/src/hash/hash_win32.h +140 -0
- data/vendor/libgit2/src/hashsig.c +368 -0
- data/vendor/libgit2/src/hashsig.h +72 -0
- data/vendor/libgit2/src/ignore.c +22 -15
- data/vendor/libgit2/src/ignore.h +6 -1
- data/vendor/libgit2/src/index.c +770 -171
- data/vendor/libgit2/src/index.h +13 -5
- data/vendor/libgit2/src/indexer.c +286 -431
- data/vendor/libgit2/src/iterator.c +854 -466
- data/vendor/libgit2/src/iterator.h +134 -109
- data/vendor/libgit2/src/map.h +1 -1
- data/vendor/libgit2/src/merge.c +296 -0
- data/vendor/libgit2/src/merge.h +22 -0
- data/vendor/libgit2/src/message.c +1 -1
- data/vendor/libgit2/src/message.h +1 -1
- data/vendor/libgit2/src/mwindow.c +35 -30
- data/vendor/libgit2/src/mwindow.h +2 -2
- data/vendor/libgit2/src/netops.c +162 -98
- data/vendor/libgit2/src/netops.h +50 -15
- data/vendor/libgit2/src/notes.c +109 -58
- data/vendor/libgit2/src/notes.h +2 -1
- data/vendor/libgit2/src/object.c +46 -57
- data/vendor/libgit2/src/object.h +1 -8
- data/vendor/libgit2/src/odb.c +151 -40
- data/vendor/libgit2/src/odb.h +5 -1
- data/vendor/libgit2/src/odb_loose.c +4 -5
- data/vendor/libgit2/src/odb_pack.c +122 -80
- data/vendor/libgit2/src/offmap.h +65 -0
- data/vendor/libgit2/src/oid.c +12 -4
- data/vendor/libgit2/src/oidmap.h +1 -1
- data/vendor/libgit2/src/pack-objects.c +88 -61
- data/vendor/libgit2/src/pack-objects.h +8 -8
- data/vendor/libgit2/src/pack.c +293 -28
- data/vendor/libgit2/src/pack.h +49 -4
- data/vendor/libgit2/src/path.c +103 -14
- data/vendor/libgit2/src/path.h +23 -7
- data/vendor/libgit2/src/pathspec.c +168 -0
- data/vendor/libgit2/src/pathspec.h +40 -0
- data/vendor/libgit2/src/pool.c +29 -4
- data/vendor/libgit2/src/pool.h +8 -1
- data/vendor/libgit2/src/posix.c +26 -27
- data/vendor/libgit2/src/posix.h +2 -3
- data/vendor/libgit2/src/pqueue.c +23 -1
- data/vendor/libgit2/src/pqueue.h +23 -1
- data/vendor/libgit2/src/push.c +653 -0
- data/vendor/libgit2/src/push.h +51 -0
- data/vendor/libgit2/src/refdb.c +185 -0
- data/vendor/libgit2/src/refdb.h +46 -0
- data/vendor/libgit2/src/refdb_fs.c +1024 -0
- data/vendor/libgit2/src/refdb_fs.h +15 -0
- data/vendor/libgit2/src/reflog.c +77 -45
- data/vendor/libgit2/src/reflog.h +1 -3
- data/vendor/libgit2/src/refs.c +366 -1326
- data/vendor/libgit2/src/refs.h +22 -13
- data/vendor/libgit2/src/refspec.c +46 -7
- data/vendor/libgit2/src/refspec.h +11 -1
- data/vendor/libgit2/src/remote.c +758 -120
- data/vendor/libgit2/src/remote.h +10 -5
- data/vendor/libgit2/src/repo_template.h +6 -6
- data/vendor/libgit2/src/repository.c +315 -96
- data/vendor/libgit2/src/repository.h +5 -3
- data/vendor/libgit2/src/reset.c +99 -81
- data/vendor/libgit2/src/revparse.c +157 -84
- data/vendor/libgit2/src/revwalk.c +68 -470
- data/vendor/libgit2/src/revwalk.h +44 -0
- data/vendor/libgit2/src/sha1_lookup.c +1 -1
- data/vendor/libgit2/src/sha1_lookup.h +1 -1
- data/vendor/libgit2/src/signature.c +68 -200
- data/vendor/libgit2/src/signature.h +1 -1
- data/vendor/libgit2/src/stash.c +663 -0
- data/vendor/libgit2/src/status.c +101 -79
- data/vendor/libgit2/src/strmap.h +1 -1
- data/vendor/libgit2/src/submodule.c +67 -51
- data/vendor/libgit2/src/submodule.h +1 -1
- data/vendor/libgit2/src/tag.c +35 -29
- data/vendor/libgit2/src/tag.h +1 -1
- data/vendor/libgit2/src/thread-utils.c +1 -1
- data/vendor/libgit2/src/thread-utils.h +2 -2
- data/vendor/libgit2/src/trace.c +39 -0
- data/vendor/libgit2/src/trace.h +56 -0
- data/vendor/libgit2/src/transport.c +81 -34
- data/vendor/libgit2/src/transports/cred.c +60 -0
- data/vendor/libgit2/src/transports/cred_helpers.c +49 -0
- data/vendor/libgit2/src/transports/git.c +234 -127
- data/vendor/libgit2/src/transports/http.c +761 -433
- data/vendor/libgit2/src/transports/local.c +460 -64
- data/vendor/libgit2/src/transports/smart.c +345 -0
- data/vendor/libgit2/src/transports/smart.h +179 -0
- data/vendor/libgit2/src/{pkt.c → transports/smart_pkt.c} +131 -12
- data/vendor/libgit2/src/transports/smart_protocol.c +856 -0
- data/vendor/libgit2/src/transports/winhttp.c +1136 -0
- data/vendor/libgit2/src/tree-cache.c +2 -2
- data/vendor/libgit2/src/tree-cache.h +1 -1
- data/vendor/libgit2/src/tree.c +239 -166
- data/vendor/libgit2/src/tree.h +11 -2
- data/vendor/libgit2/src/tsort.c +39 -23
- data/vendor/libgit2/src/unix/map.c +1 -1
- data/vendor/libgit2/src/unix/posix.h +12 -2
- data/vendor/libgit2/src/unix/realpath.c +30 -0
- data/vendor/libgit2/src/util.c +250 -13
- data/vendor/libgit2/src/util.h +71 -14
- data/vendor/libgit2/src/vector.c +123 -60
- data/vendor/libgit2/src/vector.h +24 -22
- data/vendor/libgit2/src/win32/dir.c +1 -1
- data/vendor/libgit2/src/win32/dir.h +1 -1
- data/vendor/libgit2/src/win32/error.c +77 -0
- data/vendor/libgit2/src/win32/error.h +13 -0
- data/vendor/libgit2/src/win32/findfile.c +143 -54
- data/vendor/libgit2/src/win32/findfile.h +10 -6
- data/vendor/libgit2/src/win32/map.c +1 -1
- data/vendor/libgit2/src/win32/mingw-compat.h +1 -1
- data/vendor/libgit2/src/win32/msvc-compat.h +10 -1
- data/vendor/libgit2/src/win32/posix.h +10 -1
- data/vendor/libgit2/src/win32/posix_w32.c +132 -63
- data/vendor/libgit2/src/win32/precompiled.c +1 -1
- data/vendor/libgit2/src/win32/pthread.c +1 -1
- data/vendor/libgit2/src/win32/pthread.h +1 -1
- data/vendor/libgit2/src/win32/utf-conv.c +5 -5
- data/vendor/libgit2/src/win32/utf-conv.h +3 -3
- data/vendor/libgit2/src/win32/version.h +20 -0
- metadata +308 -252
- data/test/fixtures/testrepo.git/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 +0 -0
- data/test/fixtures/testrepo.git/objects/7f/043268ea43ce18e3540acaabf9e090c91965b0 +0 -0
- data/test/fixtures/testrepo.git/objects/a3/e05719b428a2d0ed7a55c4ce53dcc5768c6d5e +0 -0
- data/test/index_test.rb~ +0 -218
- data/vendor/libgit2/src/pkt.h +0 -91
- data/vendor/libgit2/src/ppc/sha1.c +0 -70
- data/vendor/libgit2/src/ppc/sha1.h +0 -26
- data/vendor/libgit2/src/protocol.c +0 -110
- data/vendor/libgit2/src/protocol.h +0 -21
- data/vendor/libgit2/src/sha1.h +0 -33
- data/vendor/libgit2/src/transport.h +0 -148
data/vendor/libgit2/src/tag.c
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (C)
|
|
2
|
+
* Copyright (C) the libgit2 contributors. All rights reserved.
|
|
3
3
|
*
|
|
4
4
|
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
|
5
5
|
* a Linking Exception. For full terms see the included COPYING file.
|
|
@@ -22,41 +22,41 @@ void git_tag__free(git_tag *tag)
|
|
|
22
22
|
git__free(tag);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
const git_oid *git_tag_id(git_tag *c)
|
|
25
|
+
const git_oid *git_tag_id(const git_tag *c)
|
|
26
26
|
{
|
|
27
|
-
return git_object_id((git_object *)c);
|
|
27
|
+
return git_object_id((const git_object *)c);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
int git_tag_target(git_object **target, git_tag *t)
|
|
30
|
+
int git_tag_target(git_object **target, const git_tag *t)
|
|
31
31
|
{
|
|
32
32
|
assert(t);
|
|
33
33
|
return git_object_lookup(target, t->object.repo, &t->target, t->type);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
const git_oid *
|
|
36
|
+
const git_oid *git_tag_target_id(const git_tag *t)
|
|
37
37
|
{
|
|
38
38
|
assert(t);
|
|
39
39
|
return &t->target;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
git_otype
|
|
42
|
+
git_otype git_tag_target_type(const git_tag *t)
|
|
43
43
|
{
|
|
44
44
|
assert(t);
|
|
45
45
|
return t->type;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
const char *git_tag_name(git_tag *t)
|
|
48
|
+
const char *git_tag_name(const git_tag *t)
|
|
49
49
|
{
|
|
50
50
|
assert(t);
|
|
51
51
|
return t->tag_name;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
const git_signature *git_tag_tagger(git_tag *t)
|
|
54
|
+
const git_signature *git_tag_tagger(const git_tag *t)
|
|
55
55
|
{
|
|
56
56
|
return t->tagger;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
const char *git_tag_message(git_tag *t)
|
|
59
|
+
const char *git_tag_message(const git_tag *t)
|
|
60
60
|
{
|
|
61
61
|
assert(t);
|
|
62
62
|
return t->message;
|
|
@@ -131,7 +131,7 @@ int git_tag__parse_buffer(git_tag *tag, const char *buffer, size_t length)
|
|
|
131
131
|
buffer = search + 1;
|
|
132
132
|
|
|
133
133
|
tag->tagger = NULL;
|
|
134
|
-
if (*buffer != '\n') {
|
|
134
|
+
if (buffer < buffer_end && *buffer != '\n') {
|
|
135
135
|
tag->tagger = git__malloc(sizeof(git_signature));
|
|
136
136
|
GITERR_CHECK_ALLOC(tag->tagger);
|
|
137
137
|
|
|
@@ -139,16 +139,19 @@ int git_tag__parse_buffer(git_tag *tag, const char *buffer, size_t length)
|
|
|
139
139
|
return -1;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
tag->message = NULL;
|
|
143
|
+
if (buffer < buffer_end) {
|
|
144
|
+
if( *buffer != '\n' )
|
|
145
|
+
return tag_error("No new line before message");
|
|
144
146
|
|
|
145
|
-
|
|
147
|
+
text_len = buffer_end - ++buffer;
|
|
146
148
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
+
tag->message = git__malloc(text_len + 1);
|
|
150
|
+
GITERR_CHECK_ALLOC(tag->message);
|
|
149
151
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
+
memcpy(tag->message, buffer, text_len);
|
|
153
|
+
tag->message[text_len] = '\0';
|
|
154
|
+
}
|
|
152
155
|
|
|
153
156
|
return 0;
|
|
154
157
|
}
|
|
@@ -185,7 +188,7 @@ static int retrieve_tag_reference_oid(
|
|
|
185
188
|
if (git_buf_joinpath(ref_name_out, GIT_REFS_TAGS_DIR, tag_name) < 0)
|
|
186
189
|
return -1;
|
|
187
190
|
|
|
188
|
-
return
|
|
191
|
+
return git_reference_name_to_id(oid, repo, ref_name_out->ptr);
|
|
189
192
|
}
|
|
190
193
|
|
|
191
194
|
static int write_tag_annotation(
|
|
@@ -248,7 +251,7 @@ static int git_tag_create__internal(
|
|
|
248
251
|
|
|
249
252
|
error = retrieve_tag_reference_oid(oid, &ref_name, repo, tag_name);
|
|
250
253
|
if (error < 0 && error != GIT_ENOTFOUND)
|
|
251
|
-
|
|
254
|
+
goto cleanup;
|
|
252
255
|
|
|
253
256
|
/** Ensure the tag name doesn't conflict with an already existing
|
|
254
257
|
* reference unless overwriting has explictly been requested **/
|
|
@@ -264,8 +267,9 @@ static int git_tag_create__internal(
|
|
|
264
267
|
} else
|
|
265
268
|
git_oid_cpy(oid, git_object_id(target));
|
|
266
269
|
|
|
267
|
-
error =
|
|
270
|
+
error = git_reference_create(&new_ref, repo, ref_name.ptr, oid, allow_ref_overwrite);
|
|
268
271
|
|
|
272
|
+
cleanup:
|
|
269
273
|
git_reference_free(new_ref);
|
|
270
274
|
git_buf_free(&ref_name);
|
|
271
275
|
return error;
|
|
@@ -355,7 +359,7 @@ int git_tag_create_frombuffer(git_oid *oid, git_repository *repo, const char *bu
|
|
|
355
359
|
return -1;
|
|
356
360
|
}
|
|
357
361
|
|
|
358
|
-
error =
|
|
362
|
+
error = git_reference_create(&new_ref, repo, ref_name.ptr, oid, allow_ref_overwrite);
|
|
359
363
|
|
|
360
364
|
git_reference_free(new_ref);
|
|
361
365
|
git_buf_free(&ref_name);
|
|
@@ -372,18 +376,21 @@ on_error:
|
|
|
372
376
|
|
|
373
377
|
int git_tag_delete(git_repository *repo, const char *tag_name)
|
|
374
378
|
{
|
|
375
|
-
int error;
|
|
376
379
|
git_reference *tag_ref;
|
|
377
380
|
git_buf ref_name = GIT_BUF_INIT;
|
|
381
|
+
int error;
|
|
378
382
|
|
|
379
383
|
error = retrieve_tag_reference(&tag_ref, &ref_name, repo, tag_name);
|
|
380
384
|
|
|
381
385
|
git_buf_free(&ref_name);
|
|
382
386
|
|
|
383
387
|
if (error < 0)
|
|
384
|
-
return
|
|
388
|
+
return error;
|
|
385
389
|
|
|
386
|
-
|
|
390
|
+
if ((error = git_reference_delete(tag_ref)) == 0)
|
|
391
|
+
git_reference_free(tag_ref);
|
|
392
|
+
|
|
393
|
+
return error;
|
|
387
394
|
}
|
|
388
395
|
|
|
389
396
|
int git_tag__parse(git_tag *tag, git_odb_object *obj)
|
|
@@ -406,7 +413,7 @@ static int tags_cb(const char *ref, void *data)
|
|
|
406
413
|
if (git__prefixcmp(ref, GIT_REFS_TAGS_DIR) != 0)
|
|
407
414
|
return 0; /* no tag */
|
|
408
415
|
|
|
409
|
-
if (
|
|
416
|
+
if (git_reference_name_to_id(&oid, d->repo, ref) < 0)
|
|
410
417
|
return -1;
|
|
411
418
|
|
|
412
419
|
return d->cb(ref, &oid, d->cb_data);
|
|
@@ -422,8 +429,7 @@ int git_tag_foreach(git_repository *repo, git_tag_foreach_cb cb, void *cb_data)
|
|
|
422
429
|
data.cb_data = cb_data;
|
|
423
430
|
data.repo = repo;
|
|
424
431
|
|
|
425
|
-
return git_reference_foreach(repo, GIT_REF_OID
|
|
426
|
-
&tags_cb, &data);
|
|
432
|
+
return git_reference_foreach(repo, GIT_REF_OID, &tags_cb, &data);
|
|
427
433
|
}
|
|
428
434
|
|
|
429
435
|
typedef struct {
|
|
@@ -474,7 +480,7 @@ int git_tag_list(git_strarray *tag_names, git_repository *repo)
|
|
|
474
480
|
return git_tag_list_match(tag_names, "", repo);
|
|
475
481
|
}
|
|
476
482
|
|
|
477
|
-
int git_tag_peel(git_object **tag_target, git_tag *tag)
|
|
483
|
+
int git_tag_peel(git_object **tag_target, const git_tag *tag)
|
|
478
484
|
{
|
|
479
|
-
return git_object_peel(tag_target, (git_object *)tag, GIT_OBJ_ANY);
|
|
485
|
+
return git_object_peel(tag_target, (const git_object *)tag, GIT_OBJ_ANY);
|
|
480
486
|
}
|
data/vendor/libgit2/src/tag.h
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (C)
|
|
2
|
+
* Copyright (C) the libgit2 contributors. All rights reserved.
|
|
3
3
|
*
|
|
4
4
|
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
|
5
5
|
* a Linking Exception. For full terms see the included COPYING file.
|
|
@@ -79,7 +79,7 @@ GIT_INLINE(int) git_atomic_dec(git_atomic *a)
|
|
|
79
79
|
/* Pthreads Mutex */
|
|
80
80
|
#define git_mutex unsigned int
|
|
81
81
|
#define git_mutex_init(a) (void)0
|
|
82
|
-
#define git_mutex_lock(a)
|
|
82
|
+
#define git_mutex_lock(a) 0
|
|
83
83
|
#define git_mutex_unlock(a) (void)0
|
|
84
84
|
#define git_mutex_free(a) (void)0
|
|
85
85
|
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) the libgit2 contributors. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
|
5
|
+
* a Linking Exception. For full terms see the included COPYING file.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#include "buffer.h"
|
|
9
|
+
#include "common.h"
|
|
10
|
+
#include "global.h"
|
|
11
|
+
#include "trace.h"
|
|
12
|
+
#include "git2/trace.h"
|
|
13
|
+
|
|
14
|
+
#ifdef GIT_TRACE
|
|
15
|
+
|
|
16
|
+
struct git_trace_data git_trace__data = {0};
|
|
17
|
+
|
|
18
|
+
#endif
|
|
19
|
+
|
|
20
|
+
int git_trace_set(git_trace_level_t level, git_trace_callback callback)
|
|
21
|
+
{
|
|
22
|
+
#ifdef GIT_TRACE
|
|
23
|
+
assert(level == 0 || callback != NULL);
|
|
24
|
+
|
|
25
|
+
git_trace__data.level = level;
|
|
26
|
+
git_trace__data.callback = callback;
|
|
27
|
+
GIT_MEMORY_BARRIER;
|
|
28
|
+
|
|
29
|
+
return 0;
|
|
30
|
+
#else
|
|
31
|
+
GIT_UNUSED(level);
|
|
32
|
+
GIT_UNUSED(callback);
|
|
33
|
+
|
|
34
|
+
giterr_set(GITERR_INVALID,
|
|
35
|
+
"This version of libgit2 was not built with tracing.");
|
|
36
|
+
return -1;
|
|
37
|
+
#endif
|
|
38
|
+
}
|
|
39
|
+
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) the libgit2 contributors. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
|
5
|
+
* a Linking Exception. For full terms see the included COPYING file.
|
|
6
|
+
*/
|
|
7
|
+
#ifndef INCLUDE_trace_h__
|
|
8
|
+
#define INCLUDE_trace_h__
|
|
9
|
+
|
|
10
|
+
#include <stdarg.h>
|
|
11
|
+
|
|
12
|
+
#include <git2/trace.h>
|
|
13
|
+
#include "buffer.h"
|
|
14
|
+
|
|
15
|
+
#ifdef GIT_TRACE
|
|
16
|
+
|
|
17
|
+
struct git_trace_data {
|
|
18
|
+
git_trace_level_t level;
|
|
19
|
+
git_trace_callback callback;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
extern struct git_trace_data git_trace__data;
|
|
23
|
+
|
|
24
|
+
GIT_INLINE(void) git_trace__write_fmt(
|
|
25
|
+
git_trace_level_t level,
|
|
26
|
+
const char *fmt, ...)
|
|
27
|
+
{
|
|
28
|
+
git_trace_callback callback = git_trace__data.callback;
|
|
29
|
+
git_buf message = GIT_BUF_INIT;
|
|
30
|
+
va_list ap;
|
|
31
|
+
|
|
32
|
+
va_start(ap, fmt);
|
|
33
|
+
git_buf_vprintf(&message, fmt, ap);
|
|
34
|
+
va_end(ap);
|
|
35
|
+
|
|
36
|
+
callback(level, git_buf_cstr(&message));
|
|
37
|
+
|
|
38
|
+
git_buf_free(&message);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
#define git_trace_level() (git_trace__data.level)
|
|
42
|
+
#define git_trace(l, ...) { \
|
|
43
|
+
if (git_trace__data.level >= l && \
|
|
44
|
+
git_trace__data.callback != NULL) { \
|
|
45
|
+
git_trace__write_fmt(l, __VA_ARGS__); \
|
|
46
|
+
} \
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
#else
|
|
50
|
+
|
|
51
|
+
#define git_trace_level() ((void)0)
|
|
52
|
+
#define git_trace(lvl, ...) ((void)0)
|
|
53
|
+
|
|
54
|
+
#endif
|
|
55
|
+
|
|
56
|
+
#endif
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (C)
|
|
2
|
+
* Copyright (C) the libgit2 contributors. All rights reserved.
|
|
3
3
|
*
|
|
4
4
|
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
|
5
5
|
* a Linking Exception. For full terms see the included COPYING file.
|
|
@@ -8,76 +8,116 @@
|
|
|
8
8
|
#include "git2/types.h"
|
|
9
9
|
#include "git2/remote.h"
|
|
10
10
|
#include "git2/net.h"
|
|
11
|
-
#include "transport.h"
|
|
11
|
+
#include "git2/transport.h"
|
|
12
12
|
#include "path.h"
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
typedef struct transport_definition {
|
|
15
15
|
char *prefix;
|
|
16
|
+
unsigned priority;
|
|
16
17
|
git_transport_cb fn;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
void *param;
|
|
19
|
+
} transport_definition;
|
|
20
|
+
|
|
21
|
+
static transport_definition local_transport_definition = { "file://", 1, git_transport_local, NULL };
|
|
22
|
+
static transport_definition dummy_transport_definition = { NULL, 1, git_transport_dummy, NULL };
|
|
23
|
+
|
|
24
|
+
static git_smart_subtransport_definition http_subtransport_definition = { git_smart_subtransport_http, 1 };
|
|
25
|
+
static git_smart_subtransport_definition git_subtransport_definition = { git_smart_subtransport_git, 0 };
|
|
26
|
+
|
|
27
|
+
static transport_definition transports[] = {
|
|
28
|
+
{"git://", 1, git_transport_smart, &git_subtransport_definition},
|
|
29
|
+
{"http://", 1, git_transport_smart, &http_subtransport_definition},
|
|
30
|
+
{"https://", 1, git_transport_smart, &http_subtransport_definition},
|
|
31
|
+
{"file://", 1, git_transport_local, NULL},
|
|
32
|
+
{"git+ssh://", 1, git_transport_dummy, NULL},
|
|
33
|
+
{"ssh+git://", 1, git_transport_dummy, NULL},
|
|
34
|
+
{NULL, 0, 0}
|
|
25
35
|
};
|
|
26
36
|
|
|
27
37
|
#define GIT_TRANSPORT_COUNT (sizeof(transports)/sizeof(transports[0])) - 1
|
|
28
38
|
|
|
29
|
-
static
|
|
39
|
+
static int transport_find_fn(const char *url, git_transport_cb *callback, void **param)
|
|
30
40
|
{
|
|
31
41
|
size_t i = 0;
|
|
42
|
+
unsigned priority = 0;
|
|
43
|
+
transport_definition *definition = NULL, *definition_iter;
|
|
32
44
|
|
|
33
45
|
// First, check to see if it's an obvious URL, which a URL scheme
|
|
34
46
|
for (i = 0; i < GIT_TRANSPORT_COUNT; ++i) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
47
|
+
definition_iter = &transports[i];
|
|
48
|
+
|
|
49
|
+
if (strncasecmp(url, definition_iter->prefix, strlen(definition_iter->prefix)))
|
|
50
|
+
continue;
|
|
38
51
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
52
|
+
if (definition_iter->priority > priority)
|
|
53
|
+
definition = definition_iter;
|
|
54
|
+
}
|
|
42
55
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
56
|
+
#ifdef GIT_WIN32
|
|
57
|
+
/* On Windows, it might not be possible to discern between absolute local
|
|
58
|
+
* and ssh paths - first check if this is a valid local path that points
|
|
59
|
+
* to a directory and if so assume local path, else assume SSH */
|
|
60
|
+
|
|
61
|
+
/* Check to see if the path points to a file on the local file system */
|
|
62
|
+
if (!definition && git_path_exists(url) && git_path_isdir(url))
|
|
63
|
+
definition = &local_transport_definition;
|
|
64
|
+
|
|
65
|
+
/* It could be a SSH remote path. Check to see if there's a :
|
|
66
|
+
* SSH is an unsupported transport mechanism in this version of libgit2 */
|
|
67
|
+
if (!definition && strrchr(url, ':'))
|
|
68
|
+
definition = &dummy_transport_definition;
|
|
69
|
+
#else
|
|
70
|
+
/* For other systems, perform the SSH check first, to avoid going to the
|
|
71
|
+
* filesystem if it is not necessary */
|
|
72
|
+
|
|
73
|
+
/* It could be a SSH remote path. Check to see if there's a :
|
|
74
|
+
* SSH is an unsupported transport mechanism in this version of libgit2 */
|
|
75
|
+
if (!definition && strrchr(url, ':'))
|
|
76
|
+
definition = &dummy_transport_definition;
|
|
77
|
+
|
|
78
|
+
/* Check to see if the path points to a file on the local file system */
|
|
79
|
+
if (!definition && git_path_exists(url) && git_path_isdir(url))
|
|
80
|
+
definition = &local_transport_definition;
|
|
81
|
+
#endif
|
|
82
|
+
|
|
83
|
+
if (!definition)
|
|
84
|
+
return -1;
|
|
46
85
|
|
|
47
|
-
|
|
86
|
+
*callback = definition->fn;
|
|
87
|
+
*param = definition->param;
|
|
88
|
+
|
|
89
|
+
return 0;
|
|
48
90
|
}
|
|
49
91
|
|
|
50
92
|
/**************
|
|
51
93
|
* Public API *
|
|
52
94
|
**************/
|
|
53
95
|
|
|
54
|
-
int git_transport_dummy(git_transport **transport)
|
|
96
|
+
int git_transport_dummy(git_transport **transport, git_remote *owner, void *param)
|
|
55
97
|
{
|
|
56
98
|
GIT_UNUSED(transport);
|
|
99
|
+
GIT_UNUSED(owner);
|
|
100
|
+
GIT_UNUSED(param);
|
|
57
101
|
giterr_set(GITERR_NET, "This transport isn't implemented. Sorry");
|
|
58
102
|
return -1;
|
|
59
103
|
}
|
|
60
104
|
|
|
61
|
-
int git_transport_new(git_transport **out, const char *url)
|
|
105
|
+
int git_transport_new(git_transport **out, git_remote *owner, const char *url)
|
|
62
106
|
{
|
|
63
107
|
git_transport_cb fn;
|
|
64
108
|
git_transport *transport;
|
|
109
|
+
void *param;
|
|
65
110
|
int error;
|
|
66
111
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
if (fn == NULL) {
|
|
112
|
+
if (transport_find_fn(url, &fn, ¶m) < 0) {
|
|
70
113
|
giterr_set(GITERR_NET, "Unsupported URL protocol");
|
|
71
114
|
return -1;
|
|
72
115
|
}
|
|
73
116
|
|
|
74
|
-
error = fn(&transport);
|
|
117
|
+
error = fn(&transport, owner, param);
|
|
75
118
|
if (error < 0)
|
|
76
119
|
return error;
|
|
77
120
|
|
|
78
|
-
transport->url = git__strdup(url);
|
|
79
|
-
GITERR_CHECK_ALLOC(transport->url);
|
|
80
|
-
|
|
81
121
|
*out = transport;
|
|
82
122
|
|
|
83
123
|
return 0;
|
|
@@ -86,12 +126,19 @@ int git_transport_new(git_transport **out, const char *url)
|
|
|
86
126
|
/* from remote.h */
|
|
87
127
|
int git_remote_valid_url(const char *url)
|
|
88
128
|
{
|
|
89
|
-
|
|
129
|
+
git_transport_cb fn;
|
|
130
|
+
void *param;
|
|
131
|
+
|
|
132
|
+
return !transport_find_fn(url, &fn, ¶m);
|
|
90
133
|
}
|
|
91
134
|
|
|
92
135
|
int git_remote_supported_url(const char* url)
|
|
93
136
|
{
|
|
94
|
-
git_transport_cb
|
|
137
|
+
git_transport_cb fn;
|
|
138
|
+
void *param;
|
|
139
|
+
|
|
140
|
+
if (transport_find_fn(url, &fn, ¶m) < 0)
|
|
141
|
+
return 0;
|
|
95
142
|
|
|
96
|
-
return
|
|
143
|
+
return fn != &git_transport_dummy;
|
|
97
144
|
}
|