@@ -19,7 +19,7 @@ VALUE rb_cRuggedCommit;
19
19
* commit.message -> msg
20
20
*
21
21
* Return the message of this commit. This includes the full body of the
22
- * message, with the short description, detailed descritpion , and any
22
+ * message, with the short description, detailed description , and any
23
23
* optional footers or signatures after it.
24
24
*
25
25
* In Ruby 1.9+, the returned string will be encoded with the encoding
@@ -44,6 +44,35 @@ static VALUE rb_git_commit_message_GET(VALUE self)
44
44
return rb_enc_str_new (message , strlen (message ), encoding );
45
45
}
46
46
47
+ /*
48
+ * call-seq:
49
+ * commit.summary -> summary
50
+ *
51
+ * Return the short summary message of this commit.
52
+ *
53
+ * In Ruby 1.9+, the returned string will be encoded with the encoding
54
+ * specified in the +Encoding+ header of the commit, if available.
55
+ *
56
+ * commit.message #=> "add a lot of RDoc docs\n\nthis includes docs for commit and blob"
57
+ * commit.summary #=> "add a lot of RDoc docs"
58
+ */
59
+ static VALUE rb_git_commit_summary_GET (VALUE self )
60
+ {
61
+ git_commit * commit ;
62
+ rb_encoding * encoding = rb_utf8_encoding ();
63
+ const char * encoding_name ;
64
+ const char * summary ;
65
+
66
+ Data_Get_Struct (self , git_commit , commit );
67
+
68
+ summary = git_commit_summary (commit );
69
+ encoding_name = git_commit_message_encoding (commit );
70
+ if (encoding_name != NULL )
71
+ encoding = rb_enc_find (encoding_name );
72
+
73
+ return rb_enc_str_new (summary , strlen (summary ), encoding );
74
+ }
75
+
47
76
/*
48
77
* call-seq:
49
78
* commit.committer -> signature
@@ -790,6 +819,7 @@ void Init_rugged_commit(void)
790
819
rb_define_singleton_method (rb_cRuggedCommit , "extract_signature" , rb_git_commit_extract_signature , -1 );
791
820
792
821
rb_define_method (rb_cRuggedCommit , "message" , rb_git_commit_message_GET , 0 );
822
+ rb_define_method (rb_cRuggedCommit , "summary" , rb_git_commit_summary_GET , 0 );
793
823
rb_define_method (rb_cRuggedCommit , "epoch_time" , rb_git_commit_epoch_time_GET , 0 );
794
824
rb_define_method (rb_cRuggedCommit , "committer" , rb_git_commit_committer_GET , 0 );
795
825
rb_define_method (rb_cRuggedCommit , "author" , rb_git_commit_author_GET , 0 );
0 commit comments