public
Rubygem
Description: Improvements on Carl Mercier's git-remote-branch script
Homepage: http://github.com/webmat/git_remote_branch
Clone URL: git://github.com/webmat/git_remote_branch.git
grb doesn't need to be run from a git repo to be able to display help or 
explain a command
webmat (author)
Tue Jul 15 17:44:14 -0700 2008
commit  0252f5aac2d476d2420c8536da9193d26eae60b9
tree    06b0561259369a2244a17a90fd505c0d87909743
parent  0175fc43bd1cbea3efda879e84349b921f660fb2
...
1
2
 
 
3
4
5
 
 
 
6
7
8
9
10
11
 
 
 
 
 
 
 
 
 
 
12
13
14
15
 
 
 
 
16
17
18
...
1
2
3
4
5
6
7
8
9
10
11
12
 
13
 
 
14
15
16
17
18
19
20
21
22
23
24
 
 
 
25
26
27
28
29
30
31
0
@@ -1,18 +1,31 @@
0
 module GitRemoteBranch
0
   def read_params(argv)
0
+ #TODO Some validation on the params
0
+
0
     p={}
0
     p[:explain] = explain_mode!(argv)
0
     p[:action] = get_action(argv[0]) || :help
0
+
0
+ return p if p[:action] == :help
0
+
0
     p[:branch] = get_branch(argv[1])
0
     p[:origin] = get_origin(argv[2])
0
- p[:current_branch] = get_current_branch
0
 
0
- #If in explain mode, the user doesn't have to specify a branch to get the explanation
0
- p[:branch] ||= "branch_to_#{p[:action]}" if p[:explain]
0
+ # If in explain mode, the user doesn't have to specify a branch or be on in
0
+ # actual repo to get the explanation.
0
+ # Of course if he is, the explanation can be made better.
0
+ if p[:explain]
0
+ p[:branch] ||= "branch_to_#{p[:action]}"
0
+ p[:current_branch] = begin
0
+ get_current_branch
0
+ rescue
0
+ 'current_branch'
0
+ end
0
 
0
- #TODO Some validation on the params
0
-
0
- p
0
+ else
0
+ p[:current_branch] = get_current_branch
0
+ end
0
+ return p
0
   end
0
 
0
   def explain_mode!(argv)

Comments

    No one has commented yet.