@@ -27,8 +27,10 @@ void Commit::Initialize(Handle<Object> target) {
2727 constructor_template->SetClassName (String::NewSymbol (" Commit" ));
2828
2929 NODE_SET_PROTOTYPE_METHOD (constructor_template, " lookup" , Lookup);
30+ NODE_SET_PROTOTYPE_METHOD (constructor_template, " id" , Id);
3031 NODE_SET_PROTOTYPE_METHOD (constructor_template, " messageShort" , MessageShort);
3132 NODE_SET_PROTOTYPE_METHOD (constructor_template, " message" , Message);
33+ NODE_SET_PROTOTYPE_METHOD (constructor_template, " time" , Time);
3234 NODE_SET_PROTOTYPE_METHOD (constructor_template, " timeOffset" , TimeOffset);
3335 NODE_SET_PROTOTYPE_METHOD (constructor_template, " author" , Author);
3436
@@ -43,12 +45,16 @@ void Commit::SetValue(git_commit* commit) {
4345 this ->commit = commit;
4446}
4547
48+ int Commit::Lookup (git_repository* repo, git_oid* oid) {
49+ return git_commit_lookup (&this ->commit , repo, oid);
50+ }
51+
4652int Commit::New (git_repository* repo) {
4753 return git_commit_new (&this ->commit , repo);
4854}
4955
50- int Commit::Lookup (git_repository* repo, git_oid* oid ) {
51- return git_commit_lookup (& this ->commit , repo, oid );
56+ const git_oid* Commit::Id ( ) {
57+ return git_commit_id ( this ->commit );
5258}
5359
5460const char * Commit::MessageShort () {
@@ -59,10 +65,18 @@ const char* Commit::Message() {
5965 return git_commit_message (this ->commit );
6066}
6167
68+ time_t Commit::Time () {
69+ return git_commit_time (this ->commit );
70+ }
71+
6272int Commit::TimeOffset () {
6373 return git_commit_time_offset (this ->commit );
6474}
6575
76+ const git_signature* Commit::Committer () {
77+ return git_commit_author (this ->commit );
78+ }
79+
6680const git_signature* Commit::Author () {
6781 return git_commit_author (this ->commit );
6882}
@@ -153,6 +167,22 @@ int Commit::EIO_AfterLookup(eio_req *req) {
153167 return 0 ;
154168}
155169
170+ Handle<Value> Commit::Id (const Arguments& args) {
171+ Commit *commit = ObjectWrap::Unwrap<Commit>(args.This ());
172+
173+ HandleScope scope;
174+
175+ if (args.Length () == 0 || !args[0 ]->IsObject ()) {
176+ return ThrowException (Exception::Error (String::New (" Oid is required and must be an Object." )));
177+ }
178+
179+ Oid *oid = ObjectWrap::Unwrap<Oid>(args[0 ]->ToObject ());
180+
181+ oid->SetValue (const_cast <git_oid *>(commit->Id ()));
182+
183+ return Undefined ();
184+ }
185+
156186Handle<Value> Commit::MessageShort (const Arguments& args) {
157187 Commit *commit = ObjectWrap::Unwrap<Commit>(args.This ());
158188
@@ -169,6 +199,14 @@ Handle<Value> Commit::Message(const Arguments& args) {
169199 return String::New (commit->Message ());
170200}
171201
202+ Handle<Value> Commit::Time (const Arguments& args) {
203+ Commit *commit = ObjectWrap::Unwrap<Commit>(args.This ());
204+
205+ HandleScope scope;
206+
207+ return Integer::New (commit->Time ());
208+ }
209+
172210Handle<Value> Commit::TimeOffset (const Arguments& args) {
173211 Commit *commit = ObjectWrap::Unwrap<Commit>(args.This ());
174212
@@ -177,6 +215,22 @@ Handle<Value> Commit::TimeOffset(const Arguments& args) {
177215 return Integer::New (commit->TimeOffset ());
178216}
179217
218+ Handle<Value> Commit::Committer (const Arguments& args) {
219+ Commit *commit = ObjectWrap::Unwrap<Commit>(args.This ());
220+
221+ HandleScope scope;
222+
223+ if (args.Length () == 0 || !args[0 ]->IsObject ()) {
224+ return ThrowException (Exception::Error (String::New (" Signature is required and must be an Object." )));
225+ }
226+
227+ Sig *sig = ObjectWrap::Unwrap<Sig>(args[0 ]->ToObject ());
228+
229+ sig->SetValue (const_cast <git_signature *>(commit->Committer ()));
230+
231+ return Undefined ();
232+ }
233+
180234Handle<Value> Commit::Author (const Arguments& args) {
181235 Commit *commit = ObjectWrap::Unwrap<Commit>(args.This ());
182236
0 commit comments