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_commit.c
CHANGED
@@ -31,53 +31,50 @@ extern VALUE rb_cRuggedSignature;
|
|
31
31
|
VALUE rb_cRuggedCommit;
|
32
32
|
|
33
33
|
/*
|
34
|
-
*
|
35
|
-
*
|
34
|
+
* call-seq:
|
35
|
+
* commit.message -> msg
|
36
36
|
*
|
37
|
-
*
|
38
|
-
*
|
39
|
-
*
|
37
|
+
* Return the message of this commit. This includes the full body of the
|
38
|
+
* message, with the short description, detailed descritpion, and any
|
39
|
+
* optional footers or signatures after it.
|
40
40
|
*
|
41
|
-
*
|
42
|
-
*
|
41
|
+
* In Ruby 1.9+, the returned string will be encoded with the encoding
|
42
|
+
* specified in the +Encoding+ header of the commit, if available.
|
43
43
|
*
|
44
|
-
*
|
44
|
+
* commit.message #=> "add a lot of RDoc docs\n\nthis includes docs for commit and blob"
|
45
45
|
*/
|
46
46
|
static VALUE rb_git_commit_message_GET(VALUE self)
|
47
47
|
{
|
48
48
|
git_commit *commit;
|
49
|
-
|
50
|
-
#ifdef HAVE_RUBY_ENCODING_H
|
51
49
|
rb_encoding *encoding = rb_utf8_encoding();
|
52
50
|
const char *encoding_name;
|
53
|
-
|
51
|
+
const char *message;
|
54
52
|
|
55
53
|
Data_Get_Struct(self, git_commit, commit);
|
56
54
|
|
57
|
-
|
55
|
+
message = git_commit_message(commit);
|
58
56
|
encoding_name = git_commit_message_encoding(commit);
|
59
57
|
if (encoding_name != NULL)
|
60
58
|
encoding = rb_enc_find(encoding_name);
|
61
|
-
#endif
|
62
59
|
|
63
|
-
return
|
60
|
+
return rb_enc_str_new(message, strlen(message), encoding);
|
64
61
|
}
|
65
62
|
|
66
63
|
/*
|
67
|
-
*
|
68
|
-
*
|
64
|
+
* call-seq:
|
65
|
+
* commit.committer -> signature
|
69
66
|
*
|
70
|
-
*
|
71
|
-
*
|
72
|
-
*
|
67
|
+
* Return the signature for the committer of this +commit+. The signature
|
68
|
+
* is returned as a +Hash+ containing +:name+, +:email+ of the author
|
69
|
+
* and +:time+ of the change.
|
73
70
|
*
|
74
|
-
*
|
75
|
-
*
|
71
|
+
* The committer of a commit is the person who actually applied the changes
|
72
|
+
* of the commit; in most cases it's the same as the author.
|
76
73
|
*
|
77
|
-
*
|
78
|
-
*
|
74
|
+
* In Ruby 1.9+, the returned string will be encoded with the encoding
|
75
|
+
* specified in the +Encoding+ header of the commit, if available.
|
79
76
|
*
|
80
|
-
*
|
77
|
+
* commit.committer #=> {:email=>"tanoku@gmail.com", :time=>Tue Jan 24 05:42:45 UTC 2012, :name=>"Vicent Mart\303\255"}
|
81
78
|
*/
|
82
79
|
static VALUE rb_git_commit_committer_GET(VALUE self)
|
83
80
|
{
|
@@ -90,19 +87,19 @@ static VALUE rb_git_commit_committer_GET(VALUE self)
|
|
90
87
|
}
|
91
88
|
|
92
89
|
/*
|
93
|
-
*
|
94
|
-
*
|
90
|
+
* call-seq:
|
91
|
+
* commit.author -> signature
|
95
92
|
*
|
96
|
-
*
|
97
|
-
*
|
98
|
-
*
|
93
|
+
* Return the signature for the author of this +commit+. The signature
|
94
|
+
* is returned as a +Hash+ containing +:name+, +:email+ of the author
|
95
|
+
* and +:time+ of the change.
|
99
96
|
*
|
100
|
-
*
|
97
|
+
* The author of the commit is the person who intially created the changes.
|
101
98
|
*
|
102
|
-
*
|
103
|
-
*
|
99
|
+
* In Ruby 1.9+, the returned string will be encoded with the encoding
|
100
|
+
* specified in the +Encoding+ header of the commit, if available.
|
104
101
|
*
|
105
|
-
*
|
102
|
+
* commit.author #=> {:email=>"tanoku@gmail.com", :time=>Tue Jan 24 05:42:45 UTC 2012, :name=>"Vicent Mart\303\255"}
|
106
103
|
*/
|
107
104
|
static VALUE rb_git_commit_author_GET(VALUE self)
|
108
105
|
{
|
@@ -115,14 +112,14 @@ static VALUE rb_git_commit_author_GET(VALUE self)
|
|
115
112
|
}
|
116
113
|
|
117
114
|
/*
|
118
|
-
*
|
119
|
-
*
|
115
|
+
* call-seq:
|
116
|
+
* commit.epoch_time -> int
|
120
117
|
*
|
121
|
-
*
|
122
|
-
*
|
123
|
-
*
|
118
|
+
* Return the time when this commit was made effective. This is the same value
|
119
|
+
* as the +:time+ attribute for +commit.committer+, but represented as an +Integer+
|
120
|
+
* value in seconds since the Epoch.
|
124
121
|
*
|
125
|
-
*
|
122
|
+
* commit.time #=> 1327383765
|
126
123
|
*/
|
127
124
|
static VALUE rb_git_commit_epoch_time_GET(VALUE self)
|
128
125
|
{
|
@@ -133,13 +130,13 @@ static VALUE rb_git_commit_epoch_time_GET(VALUE self)
|
|
133
130
|
}
|
134
131
|
|
135
132
|
/*
|
136
|
-
*
|
137
|
-
*
|
133
|
+
* call-seq:
|
134
|
+
* commit.tree -> tree
|
138
135
|
*
|
139
|
-
*
|
140
|
-
*
|
136
|
+
* Return the tree pointed at by this +commit+. The tree is
|
137
|
+
* returned as a +Rugged::Tree+ object.
|
141
138
|
*
|
142
|
-
*
|
139
|
+
* commit.tree #=> #<Rugged::Tree:0x10882c680>
|
143
140
|
*/
|
144
141
|
static VALUE rb_git_commit_tree_GET(VALUE self)
|
145
142
|
{
|
@@ -158,13 +155,13 @@ static VALUE rb_git_commit_tree_GET(VALUE self)
|
|
158
155
|
}
|
159
156
|
|
160
157
|
/*
|
161
|
-
*
|
162
|
-
*
|
158
|
+
* call-seq:
|
159
|
+
* commit.tree_id -> oid
|
163
160
|
*
|
164
|
-
*
|
165
|
-
*
|
161
|
+
* Return the tree oid pointed at by this +commit+. The tree is
|
162
|
+
* returned as a String object.
|
166
163
|
*
|
167
|
-
*
|
164
|
+
* commit.tree_id #=> "f148106ca58764adc93ad4e2d6b1d168422b9796"
|
168
165
|
*/
|
169
166
|
static VALUE rb_git_commit_tree_id_GET(VALUE self)
|
170
167
|
{
|
@@ -179,15 +176,15 @@ static VALUE rb_git_commit_tree_id_GET(VALUE self)
|
|
179
176
|
}
|
180
177
|
|
181
178
|
/*
|
182
|
-
*
|
183
|
-
*
|
179
|
+
* call-seq:
|
180
|
+
* commit.parents -> [commit, ...]
|
184
181
|
*
|
185
|
-
*
|
186
|
-
*
|
187
|
-
*
|
182
|
+
* Return the parent(s) of this commit as an array of +Rugged::Commit+
|
183
|
+
* objects. An array is always returned even when the commit has only
|
184
|
+
* one or zero parents.
|
188
185
|
*
|
189
|
-
*
|
190
|
-
*
|
186
|
+
* commit.parents #=> => [#<Rugged::Commit:0x108828918>]
|
187
|
+
* root.parents #=> []
|
191
188
|
*/
|
192
189
|
static VALUE rb_git_commit_parents_GET(VALUE self)
|
193
190
|
{
|
@@ -213,15 +210,15 @@ static VALUE rb_git_commit_parents_GET(VALUE self)
|
|
213
210
|
}
|
214
211
|
|
215
212
|
/*
|
216
|
-
*
|
217
|
-
*
|
213
|
+
* call-seq:
|
214
|
+
* commit.parent_ids -> [oid, ...]
|
218
215
|
*
|
219
|
-
*
|
220
|
-
*
|
221
|
-
*
|
216
|
+
* Return the parent oid(s) of this commit as an array of oid String
|
217
|
+
* objects. An array is always returned even when the commit has only
|
218
|
+
* one or zero parents.
|
222
219
|
*
|
223
|
-
*
|
224
|
-
*
|
220
|
+
* commit.parent_ids #=> => ["2cb831a8aea28b2c1b9c63385585b864e4d3bad1", ...]
|
221
|
+
* root.parent_ids #=> []
|
225
222
|
*/
|
226
223
|
static VALUE rb_git_commit_parent_ids_GET(VALUE self)
|
227
224
|
{
|
@@ -246,33 +243,33 @@ static VALUE rb_git_commit_parent_ids_GET(VALUE self)
|
|
246
243
|
}
|
247
244
|
|
248
245
|
/*
|
249
|
-
*
|
250
|
-
*
|
246
|
+
* call-seq:
|
247
|
+
* Commit.create(repository, data = {}) -> oid
|
251
248
|
*
|
252
|
-
*
|
253
|
-
*
|
249
|
+
* Write a new +Commit+ object to +repository+, with the given +data+
|
250
|
+
* arguments, passed as a +Hash+:
|
254
251
|
*
|
255
|
-
*
|
256
|
-
*
|
257
|
-
*
|
258
|
-
*
|
259
|
-
*
|
260
|
-
*
|
261
|
-
*
|
262
|
-
*
|
263
|
-
*
|
252
|
+
* - +:message+: a string with the full text for the commit's message
|
253
|
+
* - +:committer+: a hash with the signature for the committer
|
254
|
+
* - +:author+: a hash with the signature for the author
|
255
|
+
* - +:parents+: an +Array+ with zero or more parents for this commit,
|
256
|
+
* represented as <tt>Rugged::Commit</tt> instances, or OID +String+.
|
257
|
+
* - +:tree+: the tree for this commit, represented as a <tt>Rugged::Tree</tt>
|
258
|
+
* instance or an OID +String+.
|
259
|
+
* - +:update_ref+ (optional): a +String+ with the name of a reference in the
|
260
|
+
* repository which should be updated to point to this commit (e.g. "HEAD")
|
264
261
|
*
|
265
|
-
*
|
266
|
-
*
|
262
|
+
* When the commit is successfully written to disk, its +oid+ will be
|
263
|
+
* returned as a hex +String+.
|
267
264
|
*
|
268
|
-
*
|
265
|
+
* author = {:email=>"tanoku@gmail.com", :time=>Time.now, :name=>"Vicent Mart\303\255"}
|
269
266
|
*
|
270
|
-
*
|
271
|
-
*
|
272
|
-
*
|
273
|
-
*
|
274
|
-
*
|
275
|
-
*
|
267
|
+
* Rugged::Commit.create(r,
|
268
|
+
* :author => author,
|
269
|
+
* :message => "Hello world\n\n",
|
270
|
+
* :committer => author,
|
271
|
+
* :parents => ["2cb831a8aea28b2c1b9c63385585b864e4d3bad1"],
|
272
|
+
* :tree => some_tree) #=> "f148106ca58764adc93ad4e2d6b1d168422b9796"
|
276
273
|
*/
|
277
274
|
static VALUE rb_git_commit_create(VALUE self, VALUE rb_repo, VALUE rb_data)
|
278
275
|
{
|
@@ -382,7 +379,7 @@ cleanup:
|
|
382
379
|
return rugged_create_oid(&commit_oid);
|
383
380
|
}
|
384
381
|
|
385
|
-
void Init_rugged_commit()
|
382
|
+
void Init_rugged_commit(void)
|
386
383
|
{
|
387
384
|
rb_cRuggedCommit = rb_define_class_under(rb_mRugged, "Commit", rb_cRuggedObject);
|
388
385
|
|
data/ext/rugged/rugged_config.c
CHANGED
@@ -40,12 +40,12 @@ VALUE rugged_config_new(VALUE klass, VALUE owner, git_config *cfg)
|
|
40
40
|
}
|
41
41
|
|
42
42
|
/*
|
43
|
-
*
|
44
|
-
*
|
43
|
+
* call-seq:
|
44
|
+
* Config.new(path) -> new_config
|
45
45
|
*
|
46
|
-
*
|
47
|
-
*
|
48
|
-
*
|
46
|
+
* Open the file specified in +path+ as a +Rugged::Config+ file.
|
47
|
+
* If +path+ cannot be found, or the file is an invalid Git config,
|
48
|
+
* an exception will be raised.
|
49
49
|
*/
|
50
50
|
static VALUE rb_git_config_new(VALUE klass, VALUE rb_path)
|
51
51
|
{
|
@@ -73,16 +73,16 @@ static VALUE rb_git_config_new(VALUE klass, VALUE rb_path)
|
|
73
73
|
}
|
74
74
|
|
75
75
|
/*
|
76
|
-
*
|
77
|
-
*
|
78
|
-
*
|
76
|
+
* call-seq:
|
77
|
+
* cfg.get(key) -> value
|
78
|
+
* cfg[key] -> value
|
79
79
|
*
|
80
|
-
*
|
81
|
-
*
|
82
|
-
*
|
80
|
+
* Get the value for the given config +key+. Values are always
|
81
|
+
* returned as +String+, or +nil+ if the given key doesn't exist
|
82
|
+
* in the Config file.
|
83
83
|
*
|
84
|
-
*
|
85
|
-
*
|
84
|
+
* cfg['apply.whitespace'] #=> 'fix'
|
85
|
+
* cfg['diff.renames'] #=> 'true'
|
86
86
|
*/
|
87
87
|
static VALUE rb_git_config_get(VALUE self, VALUE rb_key)
|
88
88
|
{
|
@@ -98,25 +98,23 @@ static VALUE rb_git_config_get(VALUE self, VALUE rb_key)
|
|
98
98
|
return Qnil;
|
99
99
|
|
100
100
|
rugged_exception_check(error);
|
101
|
-
|
102
|
-
/* Return all config values as ASCII strings */
|
103
|
-
return rugged_str_new2(value, NULL);
|
101
|
+
return rb_str_new_utf8(value);
|
104
102
|
}
|
105
103
|
|
106
104
|
/*
|
107
|
-
*
|
108
|
-
*
|
109
|
-
*
|
105
|
+
* call-seq:
|
106
|
+
* cfg.store(key, value)
|
107
|
+
* cfg[key] = value
|
110
108
|
*
|
111
|
-
*
|
112
|
-
*
|
113
|
-
*
|
109
|
+
* Store the given +value+ in the Config file, under the section
|
110
|
+
* and name specified by +key+. Value can be any of the following
|
111
|
+
* Ruby types: +String+, +true+, +false+ and +Fixnum+.
|
114
112
|
*
|
115
|
-
*
|
113
|
+
* The config file will be automatically stored to disk.
|
116
114
|
*
|
117
|
-
*
|
118
|
-
*
|
119
|
-
*
|
115
|
+
* cfg['apply.whitespace'] = 'fix'
|
116
|
+
* cfg['diff.renames'] = true
|
117
|
+
* cfg['gc.reflogexpre'] = 90
|
120
118
|
*/
|
121
119
|
static VALUE rb_git_config_store(VALUE self, VALUE rb_key, VALUE rb_val)
|
122
120
|
{
|
@@ -153,14 +151,14 @@ static VALUE rb_git_config_store(VALUE self, VALUE rb_key, VALUE rb_val)
|
|
153
151
|
}
|
154
152
|
|
155
153
|
/*
|
156
|
-
*
|
157
|
-
*
|
154
|
+
* call-seq:
|
155
|
+
* cfg.delete(key) -> true or false
|
158
156
|
*
|
159
|
-
*
|
160
|
-
*
|
161
|
-
*
|
157
|
+
* Delete the given +key+ from the config file. Return +true+ if
|
158
|
+
* the deletion was successful, or +false+ if the key was not
|
159
|
+
* found in the Config file.
|
162
160
|
*
|
163
|
-
*
|
161
|
+
* The config file is immediately updated on disk.
|
164
162
|
*/
|
165
163
|
static VALUE rb_git_config_delete(VALUE self, VALUE rb_key)
|
166
164
|
{
|
@@ -180,15 +178,16 @@ static VALUE rb_git_config_delete(VALUE self, VALUE rb_key)
|
|
180
178
|
|
181
179
|
static int cb_config__each_key(const git_config_entry *entry, void *opaque)
|
182
180
|
{
|
183
|
-
rb_funcall((VALUE)opaque, rb_intern("call"), 1,
|
181
|
+
rb_funcall((VALUE)opaque, rb_intern("call"), 1, rb_str_new_utf8(entry->name));
|
184
182
|
return GIT_OK;
|
185
183
|
}
|
186
184
|
|
187
185
|
static int cb_config__each_pair(const git_config_entry *entry, void *opaque)
|
188
186
|
{
|
189
187
|
rb_funcall((VALUE)opaque, rb_intern("call"), 2,
|
190
|
-
|
191
|
-
|
188
|
+
rb_str_new_utf8(entry->name),
|
189
|
+
rb_str_new_utf8(entry->value)
|
190
|
+
);
|
192
191
|
|
193
192
|
return GIT_OK;
|
194
193
|
}
|
@@ -196,23 +195,24 @@ static int cb_config__each_pair(const git_config_entry *entry, void *opaque)
|
|
196
195
|
static int cb_config__to_hash(const git_config_entry *entry, void *opaque)
|
197
196
|
{
|
198
197
|
rb_hash_aset((VALUE)opaque,
|
199
|
-
|
200
|
-
|
198
|
+
rb_str_new_utf8(entry->name),
|
199
|
+
rb_str_new_utf8(entry->value)
|
200
|
+
);
|
201
201
|
|
202
202
|
return GIT_OK;
|
203
203
|
}
|
204
204
|
|
205
205
|
/*
|
206
|
-
*
|
207
|
-
*
|
208
|
-
*
|
206
|
+
* call-seq:
|
207
|
+
* cfg.each_key { |key| block }
|
208
|
+
* cfg.each_key -> enumarator
|
209
209
|
*
|
210
|
-
*
|
211
|
-
*
|
210
|
+
* Call the given block once for each key in the config file. If no block
|
211
|
+
* is given, an enumerator is returned.
|
212
212
|
*
|
213
|
-
*
|
214
|
-
*
|
215
|
-
*
|
213
|
+
* cfg.each_key do |key|
|
214
|
+
* puts key
|
215
|
+
* end
|
216
216
|
*/
|
217
217
|
static VALUE rb_git_config_each_key(VALUE self)
|
218
218
|
{
|
@@ -230,18 +230,18 @@ static VALUE rb_git_config_each_key(VALUE self)
|
|
230
230
|
}
|
231
231
|
|
232
232
|
/*
|
233
|
-
*
|
234
|
-
*
|
235
|
-
*
|
236
|
-
*
|
237
|
-
*
|
233
|
+
* call-seq:
|
234
|
+
* cfg.each_pair { |key, value| block }
|
235
|
+
* cfg.each_pair -> enumerator
|
236
|
+
* cfg.each { |key, value| block }
|
237
|
+
* cfg.each -> enumerator
|
238
238
|
*
|
239
|
-
*
|
240
|
-
*
|
239
|
+
* Call the given block once for each key/value pair in the config file.
|
240
|
+
* If no block is given, an enumerator is returned.
|
241
241
|
*
|
242
|
-
*
|
243
|
-
*
|
244
|
-
*
|
242
|
+
* cfg.each do |key, value|
|
243
|
+
* puts "#{key} => #{value}"
|
244
|
+
* end
|
245
245
|
*/
|
246
246
|
static VALUE rb_git_config_each_pair(VALUE self)
|
247
247
|
{
|
@@ -259,14 +259,14 @@ static VALUE rb_git_config_each_pair(VALUE self)
|
|
259
259
|
}
|
260
260
|
|
261
261
|
/*
|
262
|
-
*
|
263
|
-
*
|
262
|
+
* call-seq:
|
263
|
+
* cfg.to_hash -> hash
|
264
264
|
*
|
265
|
-
*
|
266
|
-
*
|
267
|
-
*
|
265
|
+
* Returns the config file represented as a Ruby hash, where
|
266
|
+
* each configuration entry appears as a key with its
|
267
|
+
* corresponding value.
|
268
268
|
*
|
269
|
-
*
|
269
|
+
* cfg.to_hash #=> {"core.autolf" => "true", "core.bare" => "true"}
|
270
270
|
*/
|
271
271
|
static VALUE rb_git_config_to_hash(VALUE self)
|
272
272
|
{
|
@@ -283,13 +283,13 @@ static VALUE rb_git_config_to_hash(VALUE self)
|
|
283
283
|
}
|
284
284
|
|
285
285
|
/*
|
286
|
-
*
|
287
|
-
*
|
288
|
-
*
|
286
|
+
* call-seq:
|
287
|
+
* Config.global() -> new_config
|
288
|
+
* Config.open_global() -> new_config
|
289
289
|
*
|
290
|
-
*
|
291
|
-
*
|
292
|
-
*
|
290
|
+
* Open the default global config file as a new +Rugged::Config+ object.
|
291
|
+
* An exception will be raised if the global config file doesn't
|
292
|
+
* exist.
|
293
293
|
*/
|
294
294
|
static VALUE rb_git_config_open_default(VALUE klass)
|
295
295
|
{
|
@@ -302,7 +302,7 @@ static VALUE rb_git_config_open_default(VALUE klass)
|
|
302
302
|
return rugged_config_new(klass, Qnil, cfg);
|
303
303
|
}
|
304
304
|
|
305
|
-
void Init_rugged_config()
|
305
|
+
void Init_rugged_config(void)
|
306
306
|
{
|
307
307
|
/*
|
308
308
|
* Config
|