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
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/test/index_test.rb~
DELETED
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
require "test_helper"
|
|
2
|
-
require 'base64'
|
|
3
|
-
require 'tempfile'
|
|
4
|
-
require 'fileutils'
|
|
5
|
-
|
|
6
|
-
def new_index_entry
|
|
7
|
-
now = Time.now
|
|
8
|
-
{
|
|
9
|
-
:path => "new_path",
|
|
10
|
-
:oid => "d385f264afb75a56a5bec74243be9b367ba4ca08",
|
|
11
|
-
:mtime => now,
|
|
12
|
-
:ctime => now,
|
|
13
|
-
:file_size => 1000,
|
|
14
|
-
:dev => 234881027,
|
|
15
|
-
:ino => 88888,
|
|
16
|
-
:mode => 33199,
|
|
17
|
-
:uid => 502,
|
|
18
|
-
:gid => 502,
|
|
19
|
-
:stage => 3,
|
|
20
|
-
}
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
context "Rugged::Index reading stuff" do
|
|
24
|
-
setup do
|
|
25
|
-
path = File.dirname(__FILE__) + '/fixtures/testrepo.git/index'
|
|
26
|
-
@index = Rugged::Index.new(path)
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
test "can iterate through the index" do
|
|
30
|
-
enum = @index.each
|
|
31
|
-
assert enum.kind_of? Enumerable
|
|
32
|
-
|
|
33
|
-
i = 0
|
|
34
|
-
@index.each { |e| i += 1 }
|
|
35
|
-
assert_equal @index.count, i
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
test "can count index entries" do
|
|
39
|
-
assert_equal 2, @index.count
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
test "can clear the in-memory index" do
|
|
43
|
-
@index.clear
|
|
44
|
-
assert_equal 0, @index.count
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
test "can remove entries from the index" do
|
|
48
|
-
@index.remove 0
|
|
49
|
-
assert_equal 1, @index.count
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
test "can get all data from an entry" do
|
|
53
|
-
e = @index.get_entry(0)
|
|
54
|
-
assert_equal 'README', e[:path]
|
|
55
|
-
assert_equal '1385f264afb75a56a5bec74243be9b367ba4ca08', e[:oid]
|
|
56
|
-
assert_equal 1273360380, e[:mtime].to_i
|
|
57
|
-
assert_equal 1273360380, e[:ctime].to_i
|
|
58
|
-
assert_equal 4, e[:file_size]
|
|
59
|
-
assert_equal 234881026, e[:dev]
|
|
60
|
-
assert_equal 6674088, e[:ino]
|
|
61
|
-
assert_equal 33188, e[:mode]
|
|
62
|
-
assert_equal 501, e[:uid]
|
|
63
|
-
assert_equal 0, e[:gid]
|
|
64
|
-
assert_equal false, e[:valid]
|
|
65
|
-
assert_equal 0, e[:stage]
|
|
66
|
-
|
|
67
|
-
e = @index.get_entry(1)
|
|
68
|
-
assert_equal 'new.txt', e[:path]
|
|
69
|
-
assert_equal 'fa49b077972391ad58037050f2a75f74e3671e92', e[:oid]
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
test "can iterate over the entries" do
|
|
73
|
-
itr_test = @index.sort { |a, b| a[:oid] <=> b[:oid] }.map { |e| e[:path] }.join(':')
|
|
74
|
-
assert_equal "README:new.txt", itr_test
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
test "can update entries" do
|
|
78
|
-
now = Time.at Time.now.to_i
|
|
79
|
-
e = @index.get_entry(0)
|
|
80
|
-
|
|
81
|
-
e[:oid] = "12ea3153a78002a988bb92f4123e7e831fd1138a"
|
|
82
|
-
e[:mtime] = now
|
|
83
|
-
e[:ctime] = now
|
|
84
|
-
e[:file_size] = 1000
|
|
85
|
-
e[:dev] = 234881027
|
|
86
|
-
e[:ino] = 88888
|
|
87
|
-
e[:mode] = 33199
|
|
88
|
-
e[:uid] = 502
|
|
89
|
-
e[:gid] = 502
|
|
90
|
-
e[:stage] = 3
|
|
91
|
-
|
|
92
|
-
@index.add(e)
|
|
93
|
-
new_e = @index[e[:path]]
|
|
94
|
-
|
|
95
|
-
# git only sets executable bit based on owner
|
|
96
|
-
e[:mode] = 33188
|
|
97
|
-
assert_equal e, new_e
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
test "can add new entries" do
|
|
101
|
-
e = new_index_entry
|
|
102
|
-
@index << e
|
|
103
|
-
assert_equal 3, @index.count
|
|
104
|
-
itr_test = @index.sort { |a, b| a[:oid] <=> b[:oid] }.map { |x| x[:path] }.join(':')
|
|
105
|
-
assert_equal "README:new_path:new.txt", itr_test
|
|
106
|
-
end
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
context "Rugged::Index writing stuff" do
|
|
110
|
-
setup do
|
|
111
|
-
path = File.dirname(__FILE__) + '/fixtures/testrepo.git/index'
|
|
112
|
-
@tmppath = Tempfile.new('index').path
|
|
113
|
-
FileUtils.copy(path, @tmppath)
|
|
114
|
-
@index = Rugged::Index.new(@tmppath)
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
test "add raises if it gets something weird" do
|
|
118
|
-
assert_raise TypeError do
|
|
119
|
-
@index.add(21)
|
|
120
|
-
end
|
|
121
|
-
end
|
|
122
|
-
|
|
123
|
-
test "can write a new index" do
|
|
124
|
-
e = new_index_entry
|
|
125
|
-
@index << e
|
|
126
|
-
|
|
127
|
-
e[:path] = "else.txt"
|
|
128
|
-
@index << e
|
|
129
|
-
|
|
130
|
-
@index.write
|
|
131
|
-
|
|
132
|
-
index2 = Rugged::Index.new(@tmppath)
|
|
133
|
-
|
|
134
|
-
itr_test = index2.sort { |a, b| a[:oid] <=> b[:oid] }.map { |x| x[:path] }.join(':')
|
|
135
|
-
assert_equal "README:else.txt:new_path:new.txt", itr_test
|
|
136
|
-
assert_equal 4, index2.count
|
|
137
|
-
end
|
|
138
|
-
end
|
|
139
|
-
|
|
140
|
-
context "Rugged::Index with working directory" do
|
|
141
|
-
setup do
|
|
142
|
-
@tmppath = Dir.mktmpdir
|
|
143
|
-
@repo = Rugged::Repository.init_at(@tmppath, false)
|
|
144
|
-
@index = @repo.index
|
|
145
|
-
end
|
|
146
|
-
|
|
147
|
-
teardown do
|
|
148
|
-
FileUtils.remove_entry_secure(@tmppath)
|
|
149
|
-
end
|
|
150
|
-
|
|
151
|
-
test "can add from a path" do
|
|
152
|
-
File.open(File.join(@tmppath, 'test.txt'), 'w') do |f|
|
|
153
|
-
f.puts "test content"
|
|
154
|
-
end
|
|
155
|
-
@index.add('test.txt')
|
|
156
|
-
@index.write
|
|
157
|
-
|
|
158
|
-
index2 = Rugged::Index.new(@tmppath + '/.git/index')
|
|
159
|
-
assert_equal index2.get_entry(0)[:path], 'test.txt'
|
|
160
|
-
end
|
|
161
|
-
|
|
162
|
-
test "can reload the index" do
|
|
163
|
-
File.open(File.join(@tmppath, 'test.txt'), 'w') do |f|
|
|
164
|
-
f.puts "test content"
|
|
165
|
-
end
|
|
166
|
-
@index.add('test.txt', 2)
|
|
167
|
-
@index.write
|
|
168
|
-
|
|
169
|
-
sleep(1) # we need this sleep to sync at the FS level
|
|
170
|
-
# most FSs have 1s granularity on mtimes
|
|
171
|
-
|
|
172
|
-
rindex = Rugged::Index.new(File.join(@tmppath, '/.git/index'))
|
|
173
|
-
e = rindex['test.txt']
|
|
174
|
-
assert_equal 2, e[:stage]
|
|
175
|
-
|
|
176
|
-
rindex << new_index_entry
|
|
177
|
-
rindex.write
|
|
178
|
-
|
|
179
|
-
assert_equal 1, @index.count
|
|
180
|
-
@index.reload
|
|
181
|
-
assert_equal 2, @index.count
|
|
182
|
-
|
|
183
|
-
e = @index['new_path']
|
|
184
|
-
assert_equal e[:mode], 33199
|
|
185
|
-
end
|
|
186
|
-
end
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
context "Rugged::Index with Rugged::Repository" do
|
|
190
|
-
setup do
|
|
191
|
-
@path = temp_repo("testrepo.git")
|
|
192
|
-
@repo = Rugged::Repository.new(@path)
|
|
193
|
-
@index = @repo.index
|
|
194
|
-
end
|
|
195
|
-
|
|
196
|
-
test "idempotent read_tree/write_tree" do
|
|
197
|
-
head_sha = Rugged::Reference.lookup(@repo,'HEAD').resolve.target
|
|
198
|
-
tree = @repo.lookup(head_sha).tree
|
|
199
|
-
@index.read_tree(tree)
|
|
200
|
-
|
|
201
|
-
index_tree_sha = @index.write_tree
|
|
202
|
-
index_tree = @repo.lookup(index_tree_sha)
|
|
203
|
-
assert_equal tree.oid, index_tree.oid
|
|
204
|
-
end
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
test "build tree from index on non-HEAD branch" do
|
|
208
|
-
head_sha = Rugged::Reference.lookup(@repo,'refs/remotes/origin/packed').resolve.target
|
|
209
|
-
tree = @repo.lookup(head_sha).tree
|
|
210
|
-
@index.read_tree(tree)
|
|
211
|
-
@index.remove('second.txt')
|
|
212
|
-
|
|
213
|
-
new_tree_sha = @index.write_tree
|
|
214
|
-
assert head_sha != new_tree_sha
|
|
215
|
-
pp @repo.lookup(new_tree_sha)
|
|
216
|
-
assert_nil @repo.lookup(new_tree_sha)['second.txt']
|
|
217
|
-
end
|
|
218
|
-
end
|
data/vendor/libgit2/src/pkt.h
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (C) 2009-2012 the libgit2 contributors
|
|
3
|
-
*
|
|
4
|
-
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
|
5
|
-
* a Linking Exception. For full terms see the included COPYING file.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
#ifndef INCLUDE_pkt_h__
|
|
9
|
-
#define INCLUDE_pkt_h__
|
|
10
|
-
|
|
11
|
-
#include "common.h"
|
|
12
|
-
#include "transport.h"
|
|
13
|
-
#include "buffer.h"
|
|
14
|
-
#include "posix.h"
|
|
15
|
-
#include "git2/net.h"
|
|
16
|
-
|
|
17
|
-
enum git_pkt_type {
|
|
18
|
-
GIT_PKT_CMD,
|
|
19
|
-
GIT_PKT_FLUSH,
|
|
20
|
-
GIT_PKT_REF,
|
|
21
|
-
GIT_PKT_HAVE,
|
|
22
|
-
GIT_PKT_ACK,
|
|
23
|
-
GIT_PKT_NAK,
|
|
24
|
-
GIT_PKT_PACK,
|
|
25
|
-
GIT_PKT_COMMENT,
|
|
26
|
-
GIT_PKT_ERR,
|
|
27
|
-
GIT_PKT_DATA,
|
|
28
|
-
GIT_PKT_PROGRESS,
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
/* Used for multi-ack */
|
|
32
|
-
enum git_ack_status {
|
|
33
|
-
GIT_ACK_NONE,
|
|
34
|
-
GIT_ACK_CONTINUE,
|
|
35
|
-
GIT_ACK_COMMON,
|
|
36
|
-
GIT_ACK_READY
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
/* This would be a flush pkt */
|
|
40
|
-
typedef struct {
|
|
41
|
-
enum git_pkt_type type;
|
|
42
|
-
} git_pkt;
|
|
43
|
-
|
|
44
|
-
struct git_pkt_cmd {
|
|
45
|
-
enum git_pkt_type type;
|
|
46
|
-
char *cmd;
|
|
47
|
-
char *path;
|
|
48
|
-
char *host;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
/* This is a pkt-line with some info in it */
|
|
52
|
-
typedef struct {
|
|
53
|
-
enum git_pkt_type type;
|
|
54
|
-
git_remote_head head;
|
|
55
|
-
char *capabilities;
|
|
56
|
-
} git_pkt_ref;
|
|
57
|
-
|
|
58
|
-
/* Useful later */
|
|
59
|
-
typedef struct {
|
|
60
|
-
enum git_pkt_type type;
|
|
61
|
-
git_oid oid;
|
|
62
|
-
enum git_ack_status status;
|
|
63
|
-
} git_pkt_ack;
|
|
64
|
-
|
|
65
|
-
typedef struct {
|
|
66
|
-
enum git_pkt_type type;
|
|
67
|
-
char comment[GIT_FLEX_ARRAY];
|
|
68
|
-
} git_pkt_comment;
|
|
69
|
-
|
|
70
|
-
typedef struct {
|
|
71
|
-
enum git_pkt_type type;
|
|
72
|
-
int len;
|
|
73
|
-
char data[GIT_FLEX_ARRAY];
|
|
74
|
-
} git_pkt_data;
|
|
75
|
-
|
|
76
|
-
typedef git_pkt_data git_pkt_progress;
|
|
77
|
-
|
|
78
|
-
typedef struct {
|
|
79
|
-
enum git_pkt_type type;
|
|
80
|
-
char error[GIT_FLEX_ARRAY];
|
|
81
|
-
} git_pkt_err;
|
|
82
|
-
|
|
83
|
-
int git_pkt_parse_line(git_pkt **head, const char *line, const char **out, size_t len);
|
|
84
|
-
int git_pkt_buffer_flush(git_buf *buf);
|
|
85
|
-
int git_pkt_send_flush(GIT_SOCKET s);
|
|
86
|
-
int git_pkt_buffer_done(git_buf *buf);
|
|
87
|
-
int git_pkt_buffer_wants(const git_vector *refs, git_transport_caps *caps, git_buf *buf);
|
|
88
|
-
int git_pkt_buffer_have(git_oid *oid, git_buf *buf);
|
|
89
|
-
void git_pkt_free(git_pkt *pkt);
|
|
90
|
-
|
|
91
|
-
#endif
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (C) 2009-2012 the libgit2 contributors
|
|
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
|
-
#include <stdio.h>
|
|
8
|
-
#include <string.h>
|
|
9
|
-
#include "sha1.h"
|
|
10
|
-
|
|
11
|
-
extern void ppc_sha1_core(uint32_t *hash, const unsigned char *p,
|
|
12
|
-
unsigned int nblocks);
|
|
13
|
-
|
|
14
|
-
int ppc_SHA1_Init(ppc_SHA_CTX *c)
|
|
15
|
-
{
|
|
16
|
-
c->hash[0] = 0x67452301;
|
|
17
|
-
c->hash[1] = 0xEFCDAB89;
|
|
18
|
-
c->hash[2] = 0x98BADCFE;
|
|
19
|
-
c->hash[3] = 0x10325476;
|
|
20
|
-
c->hash[4] = 0xC3D2E1F0;
|
|
21
|
-
c->len = 0;
|
|
22
|
-
c->cnt = 0;
|
|
23
|
-
return 0;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
int ppc_SHA1_Update(ppc_SHA_CTX *c, const void *ptr, unsigned long n)
|
|
27
|
-
{
|
|
28
|
-
unsigned long nb;
|
|
29
|
-
const unsigned char *p = ptr;
|
|
30
|
-
|
|
31
|
-
c->len += (uint64_t) n << 3;
|
|
32
|
-
while (n != 0) {
|
|
33
|
-
if (c->cnt || n < 64) {
|
|
34
|
-
nb = 64 - c->cnt;
|
|
35
|
-
if (nb > n)
|
|
36
|
-
nb = n;
|
|
37
|
-
memcpy(&c->buf.b[c->cnt], p, nb);
|
|
38
|
-
if ((c->cnt += nb) == 64) {
|
|
39
|
-
ppc_sha1_core(c->hash, c->buf.b, 1);
|
|
40
|
-
c->cnt = 0;
|
|
41
|
-
}
|
|
42
|
-
} else {
|
|
43
|
-
nb = n >> 6;
|
|
44
|
-
ppc_sha1_core(c->hash, p, nb);
|
|
45
|
-
nb <<= 6;
|
|
46
|
-
}
|
|
47
|
-
n -= nb;
|
|
48
|
-
p += nb;
|
|
49
|
-
}
|
|
50
|
-
return 0;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
int ppc_SHA1_Final(unsigned char *hash, ppc_SHA_CTX *c)
|
|
54
|
-
{
|
|
55
|
-
unsigned int cnt = c->cnt;
|
|
56
|
-
|
|
57
|
-
c->buf.b[cnt++] = 0x80;
|
|
58
|
-
if (cnt > 56) {
|
|
59
|
-
if (cnt < 64)
|
|
60
|
-
memset(&c->buf.b[cnt], 0, 64 - cnt);
|
|
61
|
-
ppc_sha1_core(c->hash, c->buf.b, 1);
|
|
62
|
-
cnt = 0;
|
|
63
|
-
}
|
|
64
|
-
if (cnt < 56)
|
|
65
|
-
memset(&c->buf.b[cnt], 0, 56 - cnt);
|
|
66
|
-
c->buf.l[7] = c->len;
|
|
67
|
-
ppc_sha1_core(c->hash, c->buf.b, 1);
|
|
68
|
-
memcpy(hash, c->hash, 20);
|
|
69
|
-
return 0;
|
|
70
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (C) 2009-2012 the libgit2 contributors
|
|
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
|
-
#include <stdint.h>
|
|
8
|
-
|
|
9
|
-
typedef struct {
|
|
10
|
-
uint32_t hash[5];
|
|
11
|
-
uint32_t cnt;
|
|
12
|
-
uint64_t len;
|
|
13
|
-
union {
|
|
14
|
-
unsigned char b[64];
|
|
15
|
-
uint64_t l[8];
|
|
16
|
-
} buf;
|
|
17
|
-
} ppc_SHA_CTX;
|
|
18
|
-
|
|
19
|
-
int ppc_SHA1_Init(ppc_SHA_CTX *c);
|
|
20
|
-
int ppc_SHA1_Update(ppc_SHA_CTX *c, const void *p, unsigned long n);
|
|
21
|
-
int ppc_SHA1_Final(unsigned char *hash, ppc_SHA_CTX *c);
|
|
22
|
-
|
|
23
|
-
#define SHA_CTX ppc_SHA_CTX
|
|
24
|
-
#define SHA1_Init ppc_SHA1_Init
|
|
25
|
-
#define SHA1_Update ppc_SHA1_Update
|
|
26
|
-
#define SHA1_Final ppc_SHA1_Final
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (C) 2009-2012 the libgit2 contributors
|
|
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
|
-
#include "common.h"
|
|
8
|
-
#include "protocol.h"
|
|
9
|
-
#include "pkt.h"
|
|
10
|
-
#include "buffer.h"
|
|
11
|
-
|
|
12
|
-
int git_protocol_store_refs(git_transport *t, int flushes)
|
|
13
|
-
{
|
|
14
|
-
gitno_buffer *buf = &t->buffer;
|
|
15
|
-
git_vector *refs = &t->refs;
|
|
16
|
-
int error, flush = 0, recvd;
|
|
17
|
-
const char *line_end;
|
|
18
|
-
git_pkt *pkt;
|
|
19
|
-
|
|
20
|
-
do {
|
|
21
|
-
if (buf->offset > 0)
|
|
22
|
-
error = git_pkt_parse_line(&pkt, buf->data, &line_end, buf->offset);
|
|
23
|
-
else
|
|
24
|
-
error = GIT_EBUFS;
|
|
25
|
-
|
|
26
|
-
if (error < 0 && error != GIT_EBUFS)
|
|
27
|
-
return -1;
|
|
28
|
-
|
|
29
|
-
if (error == GIT_EBUFS) {
|
|
30
|
-
if ((recvd = gitno_recv(buf)) < 0)
|
|
31
|
-
return -1;
|
|
32
|
-
|
|
33
|
-
if (recvd == 0 && !flush) {
|
|
34
|
-
giterr_set(GITERR_NET, "Early EOF");
|
|
35
|
-
return -1;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
continue;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
gitno_consume(buf, line_end);
|
|
42
|
-
if (pkt->type == GIT_PKT_ERR) {
|
|
43
|
-
giterr_set(GITERR_NET, "Remote error: %s", ((git_pkt_err *)pkt)->error);
|
|
44
|
-
git__free(pkt);
|
|
45
|
-
return -1;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (pkt->type != GIT_PKT_FLUSH && git_vector_insert(refs, pkt) < 0)
|
|
49
|
-
return -1;
|
|
50
|
-
|
|
51
|
-
if (pkt->type == GIT_PKT_FLUSH) {
|
|
52
|
-
flush++;
|
|
53
|
-
git_pkt_free(pkt);
|
|
54
|
-
}
|
|
55
|
-
} while (flush < flushes);
|
|
56
|
-
|
|
57
|
-
return flush;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
int git_protocol_detect_caps(git_pkt_ref *pkt, git_transport_caps *caps)
|
|
61
|
-
{
|
|
62
|
-
const char *ptr;
|
|
63
|
-
|
|
64
|
-
/* No refs or capabilites, odd but not a problem */
|
|
65
|
-
if (pkt == NULL || pkt->capabilities == NULL)
|
|
66
|
-
return 0;
|
|
67
|
-
|
|
68
|
-
ptr = pkt->capabilities;
|
|
69
|
-
while (ptr != NULL && *ptr != '\0') {
|
|
70
|
-
if (*ptr == ' ')
|
|
71
|
-
ptr++;
|
|
72
|
-
|
|
73
|
-
if(!git__prefixcmp(ptr, GIT_CAP_OFS_DELTA)) {
|
|
74
|
-
caps->common = caps->ofs_delta = 1;
|
|
75
|
-
ptr += strlen(GIT_CAP_OFS_DELTA);
|
|
76
|
-
continue;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if(!git__prefixcmp(ptr, GIT_CAP_MULTI_ACK)) {
|
|
80
|
-
caps->common = caps->multi_ack = 1;
|
|
81
|
-
ptr += strlen(GIT_CAP_MULTI_ACK);
|
|
82
|
-
continue;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if(!git__prefixcmp(ptr, GIT_CAP_INCLUDE_TAG)) {
|
|
86
|
-
caps->common = caps->include_tag = 1;
|
|
87
|
-
ptr += strlen(GIT_CAP_INCLUDE_TAG);
|
|
88
|
-
continue;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/* Keep side-band check after side-band-64k */
|
|
92
|
-
if(!git__prefixcmp(ptr, GIT_CAP_SIDE_BAND_64K)) {
|
|
93
|
-
caps->common = caps->side_band_64k = 1;
|
|
94
|
-
ptr += strlen(GIT_CAP_SIDE_BAND_64K);
|
|
95
|
-
continue;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if(!git__prefixcmp(ptr, GIT_CAP_SIDE_BAND)) {
|
|
99
|
-
caps->common = caps->side_band = 1;
|
|
100
|
-
ptr += strlen(GIT_CAP_SIDE_BAND);
|
|
101
|
-
continue;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
/* We don't know this capability, so skip it */
|
|
106
|
-
ptr = strchr(ptr, ' ');
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
return 0;
|
|
110
|
-
}
|