public
Fork of Caged/gitnub
Description: A Gitk-like application written in RubyCocoa that looks like it belongs on a Mac. See the wiki for downloads and screenshots.
Homepage: http://alternateidea.com
Clone URL: git://github.com/dustin/gitnub.git
Search Repo:
Open gitnub with the current branch (if any).

I've got a tree without a ``master'' branch, and it just gets
confused.
dustin (author)
Tue Apr 01 09:06:26 -0700 2008
commit  69357dd18bcb8e4ab7e8107766381de6e4617ae8
tree    7a8b70a47eadb53c4f092b0acf8ada17a359afd0
parent  f7e8c6cf6273967d8f7237c828e4c86e036949bc
...
37
38
39
 
40
41
42
...
234
235
236
237
 
238
239
240
...
257
258
259
 
 
 
 
 
260
261
262
...
37
38
39
40
41
42
43
...
235
236
237
 
238
239
240
241
...
258
259
260
261
262
263
264
265
266
267
268
0
@@ -37,6 +37,7 @@
0
     end
0
     
0
     if(fetch_git_repository)
0
+ setup_current_branch
0
       setup_commit_detail_view
0
       fetch_commits_for @branch, @offset
0
       setup_branches_menu
0
@@ -234,7 +235,7 @@
0
       return false
0
     end
0
   end
0
-
0
+
0
   def fetch_commits_for(branch, quanity, offset = 0)
0
     @commits = @repo.commits(branch, quanity, offset)
0
   end
0
@@ -257,6 +258,11 @@
0
   def setup_commit_detail_view
0
     commit_detail = File.join(NSBundle.mainBundle.bundlePath, "Contents", "Resources", "commit.html")
0
     @commit_details.mainFrame.loadRequest(NSURLRequest.requestWithURL(NSURL.fileURLWithPath(commit_detail)))
0
+ end
0
+
0
+ def setup_current_branch
0
+ head = @repo.head || @repo.heads.first
0
+ @branch = head.name.to_sym
0
   end
0
   
0
   def set_html(element, html)
...
11
12
13
14
 
15
16
17
...
21
22
23
24
 
25
26
27
28
...
30
31
32
33
 
34
35
36
37
38
39
40
 
 
 
 
 
 
 
 
 
41
42
43
...
11
12
13
 
14
15
16
17
...
21
22
23
 
24
25
26
27
28
...
30
31
32
 
33
34
35
36
37
38
39
 
40
41
42
43
44
45
46
47
48
49
50
51
0
@@ -11,7 +11,7 @@
0
   class Head
0
     attr_reader :name
0
     attr_reader :commit
0
-
0
+
0
     # Instantiate a new Head
0
     # +name+ is the name of the head
0
     # +commit+ is the Commit that the head points to
0
@@ -21,7 +21,7 @@
0
       @name = name
0
       @commit = commit
0
     end
0
-
0
+
0
     # Find all Heads
0
     # +repo+ is the Repo
0
     # +options+ is a Hash of options
0
0
@@ -30,14 +30,22 @@
0
     def self.find_all(repo, options = {})
0
       default_options = {:sort => "committerdate",
0
                          :format => "%(refname)%00%(objectname)"}
0
-
0
+
0
       actual_options = default_options.merge(options)
0
       
0
       output = repo.git.for_each_ref(actual_options, "refs/heads")
0
                  
0
       self.list_from_string(repo, output)
0
     end
0
-
0
+
0
+ # Get the HEAD revision of the repo.
0
+ def self.current(repo, options = {})
0
+ head = File.open(File.join(repo.path, 'HEAD')).read.chomp
0
+ if /ref: refs\/heads\/(.*)/.match(head)
0
+ self.new($1, repo.git.rev_parse(options, 'HEAD'))
0
+ end
0
+ end
0
+
0
     # Parse out head information into an array of baked head objects
0
     # +repo+ is the Repo
0
     # +text+ is the text output from the git command
...
52
53
54
 
 
 
 
 
 
 
55
56
57
...
52
53
54
55
56
57
58
59
60
61
62
63
64
0
@@ -52,6 +52,13 @@
0
     end
0
     
0
     alias_method :branches, :heads
0
+
0
+ # Object reprsenting the current repo head.
0
+ #
0
+ # Returns Grit::Head (baked)
0
+ def head
0
+ Head.current(self)
0
+ end
0
     
0
     # An array of Tag objects that are available in this repo
0
     #

Comments

    No one has commented yet.