rugged 0.18.0.gh.de28323 → 0.19.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +9 -4
- data/Rakefile +1 -1
- data/ext/rugged/extconf.rb +10 -0
- data/ext/rugged/rugged.c +153 -86
- data/ext/rugged/rugged.h +44 -33
- data/ext/rugged/rugged_blob.c +288 -60
- data/ext/rugged/rugged_branch.c +82 -57
- data/ext/rugged/rugged_commit.c +83 -86
- data/ext/rugged/rugged_config.c +68 -68
- data/ext/rugged/rugged_diff.c +509 -0
- data/ext/rugged/rugged_diff_delta.c +94 -0
- data/ext/rugged/rugged_diff_hunk.c +100 -0
- data/ext/rugged/rugged_diff_line.c +79 -0
- data/ext/rugged/rugged_diff_patch.c +169 -0
- data/ext/rugged/rugged_index.c +539 -8
- data/ext/rugged/rugged_note.c +74 -80
- data/ext/rugged/rugged_object.c +63 -8
- data/ext/rugged/rugged_reference.c +231 -145
- data/ext/rugged/rugged_remote.c +509 -53
- data/ext/rugged/rugged_repo.c +572 -236
- data/ext/rugged/rugged_revwalk.c +59 -36
- data/ext/rugged/rugged_settings.c +7 -9
- data/ext/rugged/rugged_signature.c +7 -11
- data/ext/rugged/rugged_tag.c +93 -39
- data/ext/rugged/rugged_tree.c +321 -58
- data/lib/rugged.rb +1 -0
- data/lib/rugged/commit.rb +16 -1
- data/lib/rugged/console.rb +9 -0
- data/lib/rugged/diff.rb +19 -0
- data/lib/rugged/diff/delta.rb +54 -0
- data/lib/rugged/diff/hunk.rb +23 -0
- data/lib/rugged/diff/line.rb +29 -0
- data/lib/rugged/diff/patch.rb +28 -0
- data/lib/rugged/repository.rb +36 -39
- data/lib/rugged/version.rb +1 -1
- data/test/blob_test.rb +308 -1
- data/test/branch_test.rb +7 -0
- data/test/commit_test.rb +7 -10
- data/test/coverage/cover.rb +9 -1
- data/test/diff_test.rb +777 -0
- data/test/fixtures/archive.tar.gz +0 -0
- data/test/fixtures/attr/attr0 +1 -0
- data/test/fixtures/attr/attr1 +29 -0
- data/test/fixtures/attr/attr2 +21 -0
- data/test/fixtures/attr/attr3 +4 -0
- data/test/fixtures/attr/binfile +1 -0
- data/test/fixtures/attr/dir/file +0 -0
- data/test/fixtures/attr/file +1 -0
- data/test/fixtures/attr/gitattributes +29 -0
- data/test/fixtures/attr/gitignore +2 -0
- data/test/fixtures/attr/ign +1 -0
- data/test/fixtures/attr/macro_bad +1 -0
- data/test/fixtures/attr/macro_test +1 -0
- data/test/fixtures/attr/root_test1 +1 -0
- data/test/fixtures/attr/root_test2 +6 -0
- data/test/fixtures/attr/root_test3 +19 -0
- data/test/fixtures/attr/root_test4.txt +14 -0
- data/test/fixtures/attr/sub/abc +37 -0
- data/test/fixtures/attr/sub/dir/file +0 -0
- data/test/fixtures/attr/sub/file +1 -0
- data/test/fixtures/attr/sub/ign/file +1 -0
- data/test/fixtures/attr/sub/ign/sub/file +1 -0
- data/test/fixtures/attr/sub/sub/dir +0 -0
- data/test/fixtures/attr/sub/sub/file +1 -0
- data/test/fixtures/attr/sub/sub/subsub.txt +1 -0
- data/test/fixtures/attr/sub/subdir_test1 +2 -0
- data/test/fixtures/attr/sub/subdir_test2.txt +1 -0
- data/test/fixtures/diff/another.txt +38 -0
- data/test/fixtures/diff/readme.txt +36 -0
- data/test/fixtures/mergedrepo/conflicts-one.txt +5 -0
- data/test/fixtures/mergedrepo/conflicts-two.txt +5 -0
- data/test/fixtures/mergedrepo/one.txt +10 -0
- data/test/fixtures/mergedrepo/two.txt +12 -0
- data/test/fixtures/status/current_file +1 -0
- data/test/fixtures/status/ignored_file +1 -0
- data/test/fixtures/status/modified_file +2 -0
- data/test/fixtures/status/new_file +1 -0
- data/test/fixtures/status/staged_changes +2 -0
- data/test/fixtures/status/staged_changes_modified_file +3 -0
- data/test/fixtures/status/staged_delete_modified_file +1 -0
- data/test/fixtures/status/staged_new_file +1 -0
- data/test/fixtures/status/staged_new_file_modified_file +2 -0
- data/test/fixtures/status/subdir.txt +2 -0
- data/test/fixtures/status/subdir/current_file +1 -0
- data/test/fixtures/status/subdir/modified_file +2 -0
- data/test/fixtures/status/subdir/new_file +1 -0
- data/test/fixtures/status//350/277/231 +1 -0
- data/test/fixtures/testrepo.git/config +5 -0
- data/test/fixtures/testrepo.git/objects/77/71329dfa3002caf8c61a0ceb62a31d09023f37 +0 -0
- data/test/fixtures/text_file.md +464 -0
- data/test/fixtures/unsymlinked.git/HEAD +1 -0
- data/test/fixtures/unsymlinked.git/config +6 -0
- data/test/fixtures/unsymlinked.git/description +1 -0
- data/test/fixtures/unsymlinked.git/info/exclude +2 -0
- data/test/fixtures/unsymlinked.git/objects/08/8b64704e0d6b8bd061dea879418cb5442a3fbf +0 -0
- data/test/fixtures/unsymlinked.git/objects/13/a5e939bca25940c069fd2169d993dba328e30b +0 -0
- data/test/fixtures/unsymlinked.git/objects/19/bf568e59e3a0b363cafb4106226e62d4a4c41c +0 -0
- data/test/fixtures/unsymlinked.git/objects/58/1fadd35b4cf320d102a152f918729011604773 +0 -0
- data/test/fixtures/unsymlinked.git/objects/5c/87b6791e8b13da658a14d1ef7e09b5dc3bac8c +0 -0
- data/test/fixtures/unsymlinked.git/objects/6f/e5f5398af85fb3de8a6aba0339b6d3bfa26a27 +0 -0
- data/test/fixtures/unsymlinked.git/objects/7f/ccd75616ec188b8f1b23d67506a334cc34a49d +0 -0
- data/test/fixtures/unsymlinked.git/objects/80/6999882bf91d24241e4077906b9017605eb1f3 +0 -0
- data/test/fixtures/unsymlinked.git/objects/83/7d176303c5005505ec1e4a30231c40930c0230 +0 -0
- data/test/fixtures/unsymlinked.git/objects/a8/595ccca04f40818ae0155c8f9c77a230e597b6 +2 -0
- data/test/fixtures/unsymlinked.git/objects/cf/8f1cf5cce859c438d6cc067284cb5e161206e7 +0 -0
- data/test/fixtures/unsymlinked.git/objects/d5/278d05c8607ec420bfee4cf219fbc0eeebfd6a +0 -0
- data/test/fixtures/unsymlinked.git/objects/f4/e16fb76536591a41454194058d048d8e4dd2e9 +0 -0
- data/test/fixtures/unsymlinked.git/objects/f9/e65619d93fdf2673882e0a261c5e93b1a84006 +0 -0
- data/test/fixtures/unsymlinked.git/refs/heads/exe-file +1 -0
- data/test/fixtures/unsymlinked.git/refs/heads/master +1 -0
- data/test/fixtures/unsymlinked.git/refs/heads/reg-file +1 -0
- data/test/index_test.rb +120 -0
- data/test/reference_test.rb +38 -3
- data/test/remote_test.rb +224 -3
- data/test/repo_reset_test.rb +2 -0
- data/test/repo_test.rb +147 -10
- data/test/test_helper.rb +5 -2
- data/vendor/libgit2/include/git2/attr.h +3 -3
- data/vendor/libgit2/include/git2/blob.h +11 -17
- data/vendor/libgit2/include/git2/branch.h +3 -2
- data/vendor/libgit2/include/git2/checkout.h +7 -0
- data/vendor/libgit2/include/git2/clone.h +3 -0
- data/vendor/libgit2/include/git2/commit.h +61 -66
- data/vendor/libgit2/include/git2/common.h +73 -42
- data/vendor/libgit2/include/git2/config.h +57 -71
- data/vendor/libgit2/include/git2/cred_helpers.h +2 -2
- data/vendor/libgit2/include/git2/diff.h +179 -30
- data/vendor/libgit2/include/git2/errors.h +3 -3
- data/vendor/libgit2/include/git2/index.h +225 -146
- data/vendor/libgit2/include/git2/indexer.h +2 -22
- data/vendor/libgit2/include/git2/inttypes.h +9 -9
- data/vendor/libgit2/include/git2/merge.h +123 -5
- data/vendor/libgit2/include/git2/odb.h +59 -38
- data/vendor/libgit2/include/git2/odb_backend.h +45 -104
- data/vendor/libgit2/include/git2/oid.h +30 -19
- data/vendor/libgit2/include/git2/pack.h +21 -3
- data/vendor/libgit2/include/git2/refdb.h +0 -35
- data/vendor/libgit2/include/git2/refs.h +93 -31
- data/vendor/libgit2/include/git2/refspec.h +17 -0
- data/vendor/libgit2/include/git2/remote.h +60 -20
- data/vendor/libgit2/include/git2/repository.h +48 -70
- data/vendor/libgit2/include/git2/reset.h +3 -3
- data/vendor/libgit2/include/git2/revparse.h +22 -0
- data/vendor/libgit2/include/git2/stash.h +1 -1
- data/vendor/libgit2/include/git2/status.h +131 -56
- data/vendor/libgit2/include/git2/strarray.h +2 -2
- data/vendor/libgit2/include/git2/submodule.h +16 -16
- data/vendor/libgit2/include/git2/sys/commit.h +46 -0
- data/vendor/libgit2/include/git2/sys/config.h +71 -0
- data/vendor/libgit2/include/git2/sys/index.h +179 -0
- data/vendor/libgit2/include/git2/sys/odb_backend.h +86 -0
- data/vendor/libgit2/include/git2/sys/refdb_backend.h +158 -0
- data/vendor/libgit2/include/git2/sys/refs.h +38 -0
- data/vendor/libgit2/include/git2/sys/repository.h +106 -0
- data/vendor/libgit2/include/git2/tag.h +44 -18
- data/vendor/libgit2/include/git2/trace.h +1 -2
- data/vendor/libgit2/include/git2/transport.h +74 -0
- data/vendor/libgit2/include/git2/tree.h +12 -22
- data/vendor/libgit2/include/git2/types.h +33 -0
- data/vendor/libgit2/include/git2/version.h +2 -2
- data/vendor/libgit2/src/array.h +66 -0
- data/vendor/libgit2/src/attr.c +26 -13
- data/vendor/libgit2/src/attr_file.c +3 -2
- data/vendor/libgit2/src/attr_file.h +3 -3
- data/vendor/libgit2/src/attrcache.h +4 -4
- data/vendor/libgit2/src/blob.c +13 -9
- data/vendor/libgit2/src/blob.h +2 -2
- data/vendor/libgit2/src/branch.c +67 -49
- data/vendor/libgit2/src/cache.c +224 -54
- data/vendor/libgit2/src/cache.h +33 -20
- data/vendor/libgit2/src/checkout.c +145 -85
- data/vendor/libgit2/src/clone.c +62 -50
- data/vendor/libgit2/src/commit.c +74 -40
- data/vendor/libgit2/src/commit.h +2 -3
- data/vendor/libgit2/src/commit_list.c +14 -8
- data/vendor/libgit2/src/config.c +119 -36
- data/vendor/libgit2/src/config.h +3 -0
- data/vendor/libgit2/src/config_cache.c +24 -7
- data/vendor/libgit2/src/config_file.c +9 -6
- data/vendor/libgit2/src/crlf.c +4 -2
- data/vendor/libgit2/src/date.c +3 -3
- data/vendor/libgit2/src/delta.c +1 -1
- data/vendor/libgit2/src/diff.c +681 -303
- data/vendor/libgit2/src/diff.h +34 -2
- data/vendor/libgit2/src/diff_driver.c +405 -0
- data/vendor/libgit2/src/diff_driver.h +49 -0
- data/vendor/libgit2/src/diff_file.c +447 -0
- data/vendor/libgit2/src/diff_file.h +58 -0
- data/vendor/libgit2/src/diff_patch.c +995 -0
- data/vendor/libgit2/src/diff_patch.h +46 -0
- data/vendor/libgit2/src/diff_print.c +430 -0
- data/vendor/libgit2/src/diff_tform.c +464 -203
- data/vendor/libgit2/src/diff_xdiff.c +166 -0
- data/vendor/libgit2/src/diff_xdiff.h +28 -0
- data/vendor/libgit2/src/fetch.c +11 -4
- data/vendor/libgit2/src/fileops.c +85 -61
- data/vendor/libgit2/src/fileops.h +4 -0
- data/vendor/libgit2/src/global.c +10 -2
- data/vendor/libgit2/src/global.h +0 -8
- data/vendor/libgit2/src/hash/hash_generic.h +3 -3
- data/vendor/libgit2/src/hash/hash_win32.h +4 -4
- data/vendor/libgit2/src/hashsig.c +0 -1
- data/vendor/libgit2/src/ignore.c +68 -28
- data/vendor/libgit2/src/ignore.h +10 -1
- data/vendor/libgit2/src/index.c +666 -84
- data/vendor/libgit2/src/index.h +6 -0
- data/vendor/libgit2/src/indexer.c +10 -28
- data/vendor/libgit2/src/iterator.c +427 -283
- data/vendor/libgit2/src/iterator.h +58 -4
- data/vendor/libgit2/src/merge.c +1892 -32
- data/vendor/libgit2/src/merge.h +132 -5
- data/vendor/libgit2/src/merge_file.c +174 -0
- data/vendor/libgit2/src/merge_file.h +71 -0
- data/vendor/libgit2/src/mwindow.c +1 -1
- data/vendor/libgit2/src/notes.c +45 -48
- data/vendor/libgit2/src/object.c +89 -127
- data/vendor/libgit2/src/object.h +0 -1
- data/vendor/libgit2/src/object_api.c +129 -0
- data/vendor/libgit2/src/odb.c +156 -59
- data/vendor/libgit2/src/odb.h +5 -2
- data/vendor/libgit2/src/odb_loose.c +31 -17
- data/vendor/libgit2/src/odb_pack.c +39 -43
- data/vendor/libgit2/src/oid.c +62 -27
- data/vendor/libgit2/src/oid.h +33 -0
- data/vendor/libgit2/src/oidmap.h +4 -6
- data/vendor/libgit2/src/pack-objects.c +54 -22
- data/vendor/libgit2/src/pack.c +98 -56
- data/vendor/libgit2/src/pack.h +3 -1
- data/vendor/libgit2/src/pathspec.c +26 -1
- data/vendor/libgit2/src/pathspec.h +14 -0
- data/vendor/libgit2/src/pool.c +5 -0
- data/vendor/libgit2/src/posix.c +2 -2
- data/vendor/libgit2/src/posix.h +3 -0
- data/vendor/libgit2/src/push.c +13 -10
- data/vendor/libgit2/src/refdb.c +82 -62
- data/vendor/libgit2/src/refdb.h +16 -16
- data/vendor/libgit2/src/refdb_fs.c +386 -133
- data/vendor/libgit2/src/reflog.c +3 -1
- data/vendor/libgit2/src/refs.c +247 -221
- data/vendor/libgit2/src/refs.h +2 -1
- data/vendor/libgit2/src/refspec.c +18 -1
- data/vendor/libgit2/src/refspec.h +3 -1
- data/vendor/libgit2/src/remote.c +434 -253
- data/vendor/libgit2/src/remote.h +5 -3
- data/vendor/libgit2/src/repository.c +197 -111
- data/vendor/libgit2/src/repository.h +26 -5
- data/vendor/libgit2/src/reset.c +1 -1
- data/vendor/libgit2/src/revparse.c +84 -79
- data/vendor/libgit2/src/revwalk.c +1 -1
- data/vendor/libgit2/src/signature.c +22 -10
- data/vendor/libgit2/src/stash.c +5 -2
- data/vendor/libgit2/src/status.c +311 -107
- data/vendor/libgit2/src/status.h +23 -0
- data/vendor/libgit2/src/submodule.c +21 -13
- data/vendor/libgit2/src/tag.c +42 -31
- data/vendor/libgit2/src/tag.h +2 -3
- data/vendor/libgit2/src/thread-utils.h +105 -3
- data/vendor/libgit2/src/trace.c +1 -2
- data/vendor/libgit2/src/trace.h +3 -3
- data/vendor/libgit2/src/transport.c +18 -6
- data/vendor/libgit2/src/transports/cred.c +103 -1
- data/vendor/libgit2/src/transports/local.c +19 -9
- data/vendor/libgit2/src/transports/smart_protocol.c +32 -12
- data/vendor/libgit2/src/transports/ssh.c +519 -0
- data/vendor/libgit2/src/transports/winhttp.c +3 -1
- data/vendor/libgit2/src/tree.c +26 -28
- data/vendor/libgit2/src/tree.h +3 -3
- data/vendor/libgit2/src/unix/posix.h +2 -0
- data/vendor/libgit2/src/util.c +43 -6
- data/vendor/libgit2/src/util.h +40 -12
- data/vendor/libgit2/src/vector.c +3 -5
- data/vendor/libgit2/src/vector.h +9 -0
- data/vendor/libgit2/src/win32/dir.c +1 -1
- data/vendor/libgit2/src/win32/error.c +2 -0
- data/vendor/libgit2/src/win32/findfile.c +3 -6
- data/vendor/libgit2/src/win32/posix_w32.c +85 -59
- data/vendor/libgit2/src/win32/pthread.c +16 -8
- data/vendor/libgit2/src/win32/pthread.h +7 -4
- metadata +407 -306
- data/test/coverage/HEAD.json +0 -1
- data/vendor/libgit2/include/git2/refdb_backend.h +0 -109
- data/vendor/libgit2/src/diff_output.c +0 -1819
- data/vendor/libgit2/src/diff_output.h +0 -93
data/ext/rugged/rugged_revwalk.c
CHANGED
@@ -40,11 +40,11 @@ VALUE rugged_walker_new(VALUE klass, VALUE owner, git_revwalk *walk)
|
|
40
40
|
}
|
41
41
|
|
42
42
|
/*
|
43
|
-
*
|
44
|
-
*
|
43
|
+
* call-seq:
|
44
|
+
* Walker.new(repository) -> walker
|
45
45
|
*
|
46
|
-
*
|
47
|
-
*
|
46
|
+
* Create a new +Walker+ instance able to walk commits found
|
47
|
+
* in +repository+, which is a <tt>Rugged::Repository</tt> instance.
|
48
48
|
*/
|
49
49
|
static VALUE rb_git_walker_new(VALUE klass, VALUE rb_repo)
|
50
50
|
{
|
@@ -61,29 +61,29 @@ static VALUE rb_git_walker_new(VALUE klass, VALUE rb_repo)
|
|
61
61
|
}
|
62
62
|
|
63
63
|
/*
|
64
|
-
*
|
65
|
-
*
|
66
|
-
*
|
64
|
+
* call-seq:
|
65
|
+
* walker.each { |commit| block }
|
66
|
+
* walker.each -> Iterator
|
67
67
|
*
|
68
|
-
*
|
69
|
-
*
|
70
|
-
*
|
68
|
+
* Perform the walk through the repository, yielding each
|
69
|
+
* one of the commits found as a <tt>Rugged::Commit</tt> instance
|
70
|
+
* to +block+.
|
71
71
|
*
|
72
|
-
*
|
72
|
+
* If no +block+ is given, an +Iterator+ will be returned.
|
73
73
|
*
|
74
|
-
*
|
75
|
-
*
|
74
|
+
* The walker must have been previously set-up before a walk can be performed
|
75
|
+
* (i.e. at least one commit must have been pushed).
|
76
76
|
*
|
77
|
-
*
|
78
|
-
*
|
77
|
+
* walker.push("92b22bbcb37caf4f6f53d30292169e84f5e4283b")
|
78
|
+
* walker.each { |commit| puts commit.oid }
|
79
79
|
*
|
80
|
-
*
|
80
|
+
* generates:
|
81
81
|
*
|
82
|
-
*
|
83
|
-
*
|
84
|
-
*
|
85
|
-
*
|
86
|
-
*
|
82
|
+
* 92b22bbcb37caf4f6f53d30292169e84f5e4283b
|
83
|
+
* 6b750d5800439b502de669465b385e5f469c78b6
|
84
|
+
* ef9207141549f4ffcd3c4597e270d32e10d0a6bc
|
85
|
+
* cb75e05f0f8ac3407fb3bd0ebd5ff07573b16c9f
|
86
|
+
* ...
|
87
87
|
*/
|
88
88
|
static VALUE rb_git_walker_each(VALUE self)
|
89
89
|
{
|
@@ -113,58 +113,74 @@ static VALUE rb_git_walker_each(VALUE self)
|
|
113
113
|
}
|
114
114
|
|
115
115
|
/*
|
116
|
-
*
|
117
|
-
*
|
116
|
+
* call-seq:
|
117
|
+
* walker.push(commit) -> nil
|
118
118
|
*
|
119
|
-
*
|
120
|
-
*
|
121
|
-
*
|
119
|
+
* Push one new +commit+ to start the walk from. +commit+ must be a
|
120
|
+
* +String+ with the OID of a commit in the repository, or a <tt>Rugged::Commit</tt>
|
121
|
+
* instance.
|
122
122
|
*
|
123
|
-
*
|
124
|
-
*
|
123
|
+
* More than one commit may be pushed to the walker (to walk several
|
124
|
+
* branches simulataneously).
|
125
125
|
*
|
126
|
-
*
|
127
|
-
*
|
126
|
+
* Duplicate pushed commits will be ignored; at least one commit must have been
|
127
|
+
* pushed as a starting point before the walk can begin.
|
128
128
|
*
|
129
|
-
*
|
129
|
+
* walker.push("92b22bbcb37caf4f6f53d30292169e84f5e4283b")
|
130
130
|
*/
|
131
131
|
static VALUE rb_git_walker_push(VALUE self, VALUE rb_commit)
|
132
132
|
{
|
133
133
|
git_revwalk *walk;
|
134
134
|
git_commit *commit;
|
135
|
+
int error;
|
135
136
|
|
136
137
|
Data_Get_Struct(self, git_revwalk, walk);
|
137
138
|
|
138
139
|
commit = (git_commit *)rugged_object_get(
|
139
140
|
git_revwalk_repository(walk), rb_commit, GIT_OBJ_COMMIT);
|
140
141
|
|
141
|
-
git_revwalk_push(walk, git_object_id((git_object *)commit));
|
142
|
+
error = git_revwalk_push(walk, git_object_id((git_object *)commit));
|
142
143
|
|
143
144
|
git_commit_free(commit);
|
145
|
+
rugged_exception_check(error);
|
146
|
+
|
144
147
|
return Qnil;
|
145
148
|
}
|
146
149
|
|
147
150
|
/*
|
148
|
-
*
|
149
|
-
*
|
151
|
+
* call-seq:
|
152
|
+
* walker.hide(commit) -> nil
|
150
153
|
*
|
154
|
+
* Hide the given +commit+ (and all its parents) from the
|
155
|
+
* output in the revision walk.
|
151
156
|
*/
|
152
157
|
static VALUE rb_git_walker_hide(VALUE self, VALUE rb_commit)
|
153
158
|
{
|
154
159
|
git_revwalk *walk;
|
155
160
|
git_commit *commit;
|
161
|
+
int error;
|
156
162
|
|
157
163
|
Data_Get_Struct(self, git_revwalk, walk);
|
158
164
|
|
159
165
|
commit = (git_commit *)rugged_object_get(
|
160
166
|
git_revwalk_repository(walk), rb_commit, GIT_OBJ_COMMIT);
|
161
167
|
|
162
|
-
git_revwalk_hide(walk, git_object_id((git_object *)commit));
|
168
|
+
error = git_revwalk_hide(walk, git_object_id((git_object *)commit));
|
163
169
|
|
164
170
|
git_commit_free(commit);
|
171
|
+
rugged_exception_check(error);
|
172
|
+
|
165
173
|
return Qnil;
|
166
174
|
}
|
167
175
|
|
176
|
+
/*
|
177
|
+
* call-seq:
|
178
|
+
* walker.sorting = sort_mode
|
179
|
+
*
|
180
|
+
* Change the sorting mode for the revision walk.
|
181
|
+
*
|
182
|
+
* This will cause +walker+ to be reset.
|
183
|
+
*/
|
168
184
|
static VALUE rb_git_walker_sorting(VALUE self, VALUE ruby_sort_mode)
|
169
185
|
{
|
170
186
|
git_revwalk *walk;
|
@@ -173,6 +189,13 @@ static VALUE rb_git_walker_sorting(VALUE self, VALUE ruby_sort_mode)
|
|
173
189
|
return Qnil;
|
174
190
|
}
|
175
191
|
|
192
|
+
/*
|
193
|
+
* call-seq:
|
194
|
+
* walker.reset -> nil
|
195
|
+
*
|
196
|
+
* Remove all pushed and hidden commits and reset the +walker+
|
197
|
+
* back into a blank state.
|
198
|
+
*/
|
176
199
|
static VALUE rb_git_walker_reset(VALUE self)
|
177
200
|
{
|
178
201
|
git_revwalk *walk;
|
@@ -181,7 +204,7 @@ static VALUE rb_git_walker_reset(VALUE self)
|
|
181
204
|
return Qnil;
|
182
205
|
}
|
183
206
|
|
184
|
-
void Init_rugged_revwalk()
|
207
|
+
void Init_rugged_revwalk(void)
|
185
208
|
{
|
186
209
|
rb_cRuggedWalker = rb_define_class_under(rb_mRugged, "Walker", rb_cObject);
|
187
210
|
rb_define_singleton_method(rb_cRuggedWalker, "new", rb_git_walker_new, 1);
|
@@ -37,11 +37,10 @@
|
|
37
37
|
extern VALUE rb_mRugged;
|
38
38
|
|
39
39
|
/*
|
40
|
-
*
|
41
|
-
*
|
42
|
-
*
|
43
|
-
* Sets a libgit2 library option
|
40
|
+
* call-seq:
|
41
|
+
* Settings[option] = value
|
44
42
|
*
|
43
|
+
* Sets a libgit2 library option.
|
45
44
|
*/
|
46
45
|
static VALUE rb_git_set_option(VALUE self, VALUE option, VALUE value)
|
47
46
|
{
|
@@ -72,11 +71,10 @@ static VALUE rb_git_set_option(VALUE self, VALUE option, VALUE value)
|
|
72
71
|
}
|
73
72
|
|
74
73
|
/*
|
75
|
-
*
|
76
|
-
*
|
77
|
-
*
|
78
|
-
* Gets the value of a libgit2 library option
|
74
|
+
* call-seq:
|
75
|
+
* Settings[option] -> value
|
79
76
|
*
|
77
|
+
* Gets the value of a libgit2 library option.
|
80
78
|
*/
|
81
79
|
static VALUE rb_git_get_option(VALUE self, VALUE option)
|
82
80
|
{
|
@@ -102,7 +100,7 @@ static VALUE rb_git_get_option(VALUE self, VALUE option)
|
|
102
100
|
}
|
103
101
|
}
|
104
102
|
|
105
|
-
void Init_rugged_settings()
|
103
|
+
void Init_rugged_settings(void)
|
106
104
|
{
|
107
105
|
VALUE rb_cRuggedSettings = rb_define_class_under(rb_mRugged, "Settings", rb_cObject);
|
108
106
|
rb_define_module_function(rb_cRuggedSettings, "[]=", rb_git_set_option, 2);
|
@@ -27,30 +27,26 @@
|
|
27
27
|
VALUE rugged_signature_new(const git_signature *sig, const char *encoding_name)
|
28
28
|
{
|
29
29
|
VALUE rb_sig, rb_time;
|
30
|
-
|
31
|
-
#ifdef HAVE_RUBY_ENCODING_H
|
32
|
-
rb_encoding *encoding = NULL;
|
30
|
+
rb_encoding *encoding = rb_utf8_encoding();
|
33
31
|
|
34
32
|
if (encoding_name != NULL)
|
35
33
|
encoding = rb_enc_find(encoding_name);
|
36
|
-
#endif
|
37
34
|
|
38
35
|
rb_sig = rb_hash_new();
|
39
36
|
|
40
|
-
#if RUBY_API_VERSION_MINOR >= 9
|
41
37
|
/* Allocate the time with a the given timezone */
|
42
38
|
rb_time = rb_funcall(
|
43
39
|
rb_time_new(sig->when.time, 0),
|
44
40
|
rb_intern("getlocal"), 1,
|
45
41
|
INT2FIX(sig->when.offset * 60)
|
46
42
|
);
|
47
|
-
#else
|
48
|
-
rb_time = rb_time_new(sig->when.time, 0);
|
49
|
-
rb_hash_aset(rb_sig, CSTR2SYM("time_offset"), INT2FIX(sig->when.offset * 60));
|
50
|
-
#endif
|
51
43
|
|
52
|
-
rb_hash_aset(rb_sig, CSTR2SYM("name"),
|
53
|
-
|
44
|
+
rb_hash_aset(rb_sig, CSTR2SYM("name"),
|
45
|
+
rb_enc_str_new(sig->name, strlen(sig->name), encoding));
|
46
|
+
|
47
|
+
rb_hash_aset(rb_sig, CSTR2SYM("email"),
|
48
|
+
rb_enc_str_new(sig->email, strlen(sig->email), encoding));
|
49
|
+
|
54
50
|
rb_hash_aset(rb_sig, CSTR2SYM("time"), rb_time);
|
55
51
|
|
56
52
|
return rb_sig;
|
data/ext/rugged/rugged_tag.c
CHANGED
@@ -30,13 +30,13 @@ extern VALUE rb_cRuggedRepo;
|
|
30
30
|
VALUE rb_cRuggedTag;
|
31
31
|
|
32
32
|
/*
|
33
|
-
*
|
34
|
-
*
|
33
|
+
* call-seq:
|
34
|
+
* tag.target -> object
|
35
35
|
*
|
36
|
-
*
|
37
|
-
*
|
36
|
+
* Return the +object+ pointed at by this tag, as a <tt>Rugged::Object</tt>
|
37
|
+
* instance.
|
38
38
|
*
|
39
|
-
*
|
39
|
+
* tag.target #=> #<Rugged::Commit:0x108828918>
|
40
40
|
*/
|
41
41
|
static VALUE rb_git_tag_target_GET(VALUE self)
|
42
42
|
{
|
@@ -55,14 +55,14 @@ static VALUE rb_git_tag_target_GET(VALUE self)
|
|
55
55
|
}
|
56
56
|
|
57
57
|
/*
|
58
|
-
*
|
59
|
-
*
|
60
|
-
*
|
58
|
+
* call-seq:
|
59
|
+
* tag.target_oid -> oid
|
60
|
+
* tag.target_id -> oid
|
61
61
|
*
|
62
|
-
*
|
63
|
-
*
|
62
|
+
* Return the oid pointed at by this tag, as a <tt>String</tt>
|
63
|
+
* instance.
|
64
64
|
*
|
65
|
-
*
|
65
|
+
* tag.target_id #=> "2cb831a8aea28b2c1b9c63385585b864e4d3bad1"
|
66
66
|
*/
|
67
67
|
static VALUE rb_git_tag_target_id_GET(VALUE self)
|
68
68
|
{
|
@@ -77,16 +77,16 @@ static VALUE rb_git_tag_target_id_GET(VALUE self)
|
|
77
77
|
}
|
78
78
|
|
79
79
|
/*
|
80
|
-
*
|
81
|
-
*
|
80
|
+
* call-seq:
|
81
|
+
* tag.type -> t
|
82
82
|
*
|
83
|
-
*
|
84
|
-
*
|
83
|
+
* Return a symbol representing the type of the objeced pointed at by
|
84
|
+
* this +tag+. Possible values are +:blob+, +:commit+, +:tree+ and +:tag+.
|
85
85
|
*
|
86
|
-
*
|
86
|
+
* This is always the same as the +type+ of the returned <tt>tag.target</tt>
|
87
87
|
*
|
88
|
-
*
|
89
|
-
*
|
88
|
+
* tag.type #=> :commit
|
89
|
+
* tag.target.type == tag.type #=> true
|
90
90
|
*/
|
91
91
|
static VALUE rb_git_tag_target_type_GET(VALUE self)
|
92
92
|
{
|
@@ -97,30 +97,30 @@ static VALUE rb_git_tag_target_type_GET(VALUE self)
|
|
97
97
|
}
|
98
98
|
|
99
99
|
/*
|
100
|
-
*
|
101
|
-
*
|
100
|
+
* call-seq:
|
101
|
+
* tag.name -> name
|
102
102
|
*
|
103
|
-
*
|
103
|
+
* Return a string with the name of this +tag+.
|
104
104
|
*
|
105
|
-
*
|
105
|
+
* tag.name #=> "v0.16.0"
|
106
106
|
*/
|
107
107
|
static VALUE rb_git_tag_name_GET(VALUE self)
|
108
108
|
{
|
109
109
|
git_tag *tag;
|
110
110
|
Data_Get_Struct(self, git_tag, tag);
|
111
111
|
|
112
|
-
return
|
112
|
+
return rb_str_new_utf8(git_tag_name(tag));
|
113
113
|
}
|
114
114
|
|
115
115
|
/*
|
116
|
-
*
|
117
|
-
*
|
116
|
+
* call-seq:
|
117
|
+
* tag.tagger -> signature
|
118
118
|
*
|
119
|
-
*
|
120
|
-
*
|
121
|
-
*
|
119
|
+
* Return the signature for the author of this +tag+. The signature
|
120
|
+
* is returned as a +Hash+ containing +:name+, +:email+ of the author
|
121
|
+
* and +:time+ of the tagging.
|
122
122
|
*
|
123
|
-
*
|
123
|
+
* tag.tagger #=> {:email=>"tanoku@gmail.com", :time=>Tue Jan 24 05:42:45 UTC 2012, :name=>"Vicent Mart\303\255"}
|
124
124
|
*/
|
125
125
|
static VALUE rb_git_tag_tagger_GET(VALUE self)
|
126
126
|
{
|
@@ -137,13 +137,13 @@ static VALUE rb_git_tag_tagger_GET(VALUE self)
|
|
137
137
|
}
|
138
138
|
|
139
139
|
/*
|
140
|
-
*
|
141
|
-
*
|
140
|
+
* call-seq:
|
141
|
+
* tag.message -> msg
|
142
142
|
*
|
143
|
-
*
|
144
|
-
*
|
143
|
+
* Return the message of this +tag+. This includes the full body of the
|
144
|
+
* message and any optional footers or signatures after it.
|
145
145
|
*
|
146
|
-
*
|
146
|
+
* tag.message #=> "Release v0.16.0, codename 'broken stuff'"
|
147
147
|
*/
|
148
148
|
static VALUE rb_git_tag_message_GET(VALUE self)
|
149
149
|
{
|
@@ -156,9 +156,38 @@ static VALUE rb_git_tag_message_GET(VALUE self)
|
|
156
156
|
if (!message)
|
157
157
|
return Qnil;
|
158
158
|
|
159
|
-
return
|
159
|
+
return rb_str_new_utf8(message);
|
160
160
|
}
|
161
161
|
|
162
|
+
/*
|
163
|
+
* call-seq:
|
164
|
+
* Tag.create(repo, data) -> oid
|
165
|
+
*
|
166
|
+
* Create a new tag in +repo+.
|
167
|
+
*
|
168
|
+
* If +data+ is a String, it has to contain the raw tag data.
|
169
|
+
*
|
170
|
+
* If +data+ is a Hash, it has to contain the following key value pairs:
|
171
|
+
*
|
172
|
+
* :name ::
|
173
|
+
* A String holding the tag's new name.
|
174
|
+
*
|
175
|
+
* :force ::
|
176
|
+
* If +true+, existing tags will be overwritten. Defaults to +false+.
|
177
|
+
*
|
178
|
+
* :tagger ::
|
179
|
+
* An optional Hash containing a git signature. Will cause the creation of
|
180
|
+
* an annotated tag object if present.
|
181
|
+
*
|
182
|
+
* :message ::
|
183
|
+
* An optional string containing the message for the new tag. Will cause
|
184
|
+
* the creation of an annotated tag if present.
|
185
|
+
*
|
186
|
+
* :target ::
|
187
|
+
* The OID of the object that the new tag should point to.
|
188
|
+
*
|
189
|
+
* Returns the OID of the newly created tag.
|
190
|
+
*/
|
162
191
|
static VALUE rb_git_tag_create(VALUE self, VALUE rb_repo, VALUE rb_data)
|
163
192
|
{
|
164
193
|
git_oid tag_oid;
|
@@ -234,12 +263,27 @@ static VALUE rb_git_tag_create(VALUE self, VALUE rb_repo, VALUE rb_data)
|
|
234
263
|
return rugged_create_oid(&tag_oid);
|
235
264
|
}
|
236
265
|
|
266
|
+
/*
|
267
|
+
* call-seq:
|
268
|
+
* Tag.each(repo[, pattern]) { |name| block } -> nil
|
269
|
+
* Tag.each(repo[, pattern]) -> enumerator
|
270
|
+
*
|
271
|
+
* Iterate through all the tag names in +repo+. Iteration
|
272
|
+
* can be optionally filtered to the ones matching the given
|
273
|
+
* +pattern+, a standard Unix filename glob.
|
274
|
+
*
|
275
|
+
* If +pattern+ is empty or not given, all tag names will be returned.
|
276
|
+
*
|
277
|
+
* The given block will be called once with the name for each tag.
|
278
|
+
*
|
279
|
+
* If no block is given, an enumerator will be returned.
|
280
|
+
*/
|
237
281
|
static VALUE rb_git_tag_each(int argc, VALUE *argv, VALUE self)
|
238
282
|
{
|
239
283
|
git_repository *repo;
|
240
284
|
git_strarray tags;
|
241
285
|
size_t i;
|
242
|
-
int error;
|
286
|
+
int error, exception = 0;
|
243
287
|
VALUE rb_repo, rb_pattern;
|
244
288
|
const char *pattern = NULL;
|
245
289
|
|
@@ -261,13 +305,23 @@ static VALUE rb_git_tag_each(int argc, VALUE *argv, VALUE self)
|
|
261
305
|
error = git_tag_list_match(&tags, pattern ? pattern : "", repo);
|
262
306
|
rugged_exception_check(error);
|
263
307
|
|
264
|
-
for (i = 0; i < tags.count; ++i)
|
265
|
-
rb_yield(
|
308
|
+
for (i = 0; !exception && i < tags.count; ++i)
|
309
|
+
rb_protect(rb_yield, rb_str_new_utf8(tags.strings[i]), &exception);
|
266
310
|
|
267
311
|
git_strarray_free(&tags);
|
312
|
+
|
313
|
+
if (exception)
|
314
|
+
rb_jump_tag(exception);
|
315
|
+
|
268
316
|
return Qnil;
|
269
317
|
}
|
270
318
|
|
319
|
+
/*
|
320
|
+
* call-seq:
|
321
|
+
* Tag.delete(repo, name) -> nil
|
322
|
+
*
|
323
|
+
* Delete the tag reference identified by +name+ from +repo+.
|
324
|
+
*/
|
271
325
|
static VALUE rb_git_tag_delete(VALUE self, VALUE rb_repo, VALUE rb_name)
|
272
326
|
{
|
273
327
|
git_repository *repo;
|
@@ -284,7 +338,7 @@ static VALUE rb_git_tag_delete(VALUE self, VALUE rb_repo, VALUE rb_name)
|
|
284
338
|
return Qnil;
|
285
339
|
}
|
286
340
|
|
287
|
-
void Init_rugged_tag()
|
341
|
+
void Init_rugged_tag(void)
|
288
342
|
{
|
289
343
|
rb_cRuggedTag = rb_define_class_under(rb_mRugged, "Tag", rb_cRuggedObject);
|
290
344
|
|