Skip to content

Commit eea1a15

Browse files
author
Vicent Martí
committed
Merge pull request libgit2#15 from Merovius/objtype
Add String() Method to ObjectType
2 parents 2bf17ba + ac6ea9a commit eea1a15

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

object.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,25 @@ type gitObject struct {
2929
ptr *C.git_object
3030
}
3131

32+
func (t ObjectType) String() (string) {
33+
switch (t) {
34+
case OBJ_ANY:
35+
return "Any"
36+
case OBJ_BAD:
37+
return "Bad"
38+
case OBJ_COMMIT:
39+
return "Commit"
40+
case OBJ_TREE:
41+
return "Tree"
42+
case OBJ_BLOB:
43+
return "Blob"
44+
case OBJ_TAG:
45+
return "tag"
46+
}
47+
// Never reached
48+
return ""
49+
}
50+
3251
func (o gitObject) Id() *Oid {
3352
return newOidFromC(C.git_commit_id(o.ptr))
3453
}

0 commit comments

Comments
 (0)