@@ -3,49 +3,69 @@ module Git
3
3
class Base
4
4
5
5
module Factories
6
+
7
+ # returns a Git::Branch object for branch_name
8
+ def branch ( branch_name = 'master' )
9
+ Git ::Branch . new ( self , branch_name )
10
+ end
6
11
7
- # returns a Git::Object of the appropriate type
8
- # you can also call @git.gtree('tree'), but that's
9
- # just for readability. If you call @git.gtree('HEAD') it will
10
- # still return a Git::Object::Commit object.
11
- #
12
- # @git.object calls a factory method that will run a rev-parse
13
- # on the objectish and determine the type of the object and return
14
- # an appropriate object for that type
15
- def object ( objectish )
16
- Git ::Object . new ( self , objectish )
12
+ # returns a Git::Branches object of all the Git::Branch
13
+ # objects for this repo
14
+ def branches
15
+ Git ::Branches . new ( self )
17
16
end
18
17
19
- def gtree ( objectish )
20
- Git ::Object . new ( self , objectish , 'tree' )
18
+ def commit_tree ( tree = nil , opts = { } )
19
+ Git ::Object :: Commit . new ( self , self . lib . commit_tree ( tree , opts ) )
21
20
end
22
-
23
- def gcommit ( objectish )
24
- Git ::Object . new ( self , objectish , 'commit' )
21
+
22
+ # returns a Git::Diff object
23
+ def diff ( objectish = 'HEAD' , obj2 = nil )
24
+ Git ::Diff . new ( self , objectish , obj2 )
25
25
end
26
26
27
27
def gblob ( objectish )
28
28
Git ::Object . new ( self , objectish , 'blob' )
29
29
end
30
30
31
+ def gcommit ( objectish )
32
+ Git ::Object . new ( self , objectish , 'commit' )
33
+ end
34
+
35
+ def gtree ( objectish )
36
+ Git ::Object . new ( self , objectish , 'tree' )
37
+ end
38
+
31
39
# returns a Git::Log object with count commits
32
40
def log ( count = 30 )
33
41
Git ::Log . new ( self , count )
34
42
end
43
+
44
+ # returns a Git::Object of the appropriate type
45
+ # you can also call @git.gtree('tree'), but that's
46
+ # just for readability. If you call @git.gtree('HEAD') it will
47
+ # still return a Git::Object::Commit object.
48
+ #
49
+ # @git.object calls a factory method that will run a rev-parse
50
+ # on the objectish and determine the type of the object and return
51
+ # an appropriate object for that type
52
+ def object ( objectish )
53
+ Git ::Object . new ( self , objectish )
54
+ end
35
55
56
+ # returns a Git::Remote object
57
+ def remote ( remote_name = 'origin' )
58
+ Git ::Remote . new ( self , remote_name )
59
+ end
60
+
36
61
# returns a Git::Status object
37
62
def status
38
63
Git ::Status . new ( self )
39
64
end
40
-
41
- # returns a Git::Branches object of all the Git::Branch objects for this repo
42
- def branches
43
- Git ::Branches . new ( self )
44
- end
45
-
46
- # returns a Git::Branch object for branch_name
47
- def branch ( branch_name = 'master' )
48
- Git ::Branch . new ( self , branch_name )
65
+
66
+ # returns a Git::Tag object
67
+ def tag ( tag_name )
68
+ Git ::Object . new ( self , tag_name , 'tag' , true )
49
69
end
50
70
51
71
end
0 commit comments