git-hub 0.1.3 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CONTRIBUTORS ADDED
@@ -0,0 +1,9 @@
1
+ * Chris Wanstrath
2
+ * Stephen Celis
3
+ * Ryan Tomayko
4
+ * Caio Chassot
5
+ * Joshua Peek
6
+ * Nick Quaranto
7
+ * Konstantin Haase
8
+ * Scott Chacon
9
+ * Alex Kahn
data/HISTORY.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## 0.2.0 (2009-??-??)
2
+
3
+ * Respected GIT_PAGER and core.pager
4
+ * Aliased `--help` to `help`
5
+ * Ruby 1.9 fixes
6
+ * Respect git behavior when pager is empty string
7
+ * `git push` multi-remote support
8
+ * `hub.http-clone` configuration setting
9
+ * Use the origin url to find the repo name
10
+
1
11
  ## 0.1.3 (2009-12-11)
2
12
 
3
13
  * Homebrew!
data/README.md CHANGED
@@ -42,17 +42,17 @@ Assuming `~/bin/` is in your `$PATH`, you're ready to roll:
42
42
 
43
43
  $ hub version
44
44
  git version 1.6.4.2
45
- hub version 0.1.0
45
+ hub version 0.2.0
46
46
 
47
47
  ### Homebrew
48
48
 
49
- brew install hub
49
+ brew install hub
50
50
 
51
51
  ### RubyGems
52
52
 
53
53
  Though not recommended, `hub` can also be installed as a RubyGem:
54
54
 
55
- $ gem install git-hub -s http://gemcutter.org/
55
+ $ gem install git-hub
56
56
 
57
57
  (Yes, the gem name is `git-hub`.)
58
58
 
@@ -122,6 +122,13 @@ superpowers:
122
122
  > git init
123
123
  > git remote add origin git@github.com:YOUR_USER/REPO.git
124
124
 
125
+ ### git push
126
+
127
+ $ git push origin,staging,qa bert_timeout
128
+ > git push origin bert_timeout
129
+ > git push staging bert_timeout
130
+ > git push qa bert_timeout
131
+
125
132
  ### git help
126
133
 
127
134
  $ git help
@@ -147,6 +154,27 @@ If you see nothing, you need to set the config setting:
147
154
  See <http://github.com/guides/local-github-config> for more information.
148
155
 
149
156
 
157
+ Configuration
158
+ -------------
159
+
160
+ If you prefer `http://` clones to `git://` clones, you can set the
161
+ `hub.http-clone` option using `git-config`.
162
+
163
+ For example:
164
+
165
+ $ git clone defunkt/repl
166
+ < git clone >
167
+ $ git config --global --add hub.http-clone yes
168
+ $ git clone defunkt/repl
169
+ < http clone >
170
+
171
+ Or you can enter this manually into your `~/.gitconfig` file:
172
+
173
+ $ cat ~/.gitconfig
174
+ [hub]
175
+ http-clone = yes
176
+
177
+
150
178
  Prior Art
151
179
  ---------
152
180
 
data/lib/hub/commands.rb CHANGED
@@ -32,11 +32,20 @@ module Hub
32
32
  extend self
33
33
 
34
34
  # Templates and useful information.
35
- PRIVATE = 'git@github.com:%s/%s.git'
36
- PUBLIC = 'git://github.com/%s/%s.git'
37
- USER = `git config --global github.user`.chomp
38
- REPO = `basename $(pwd)`.chomp
39
- LGHCONF = "http://github.com/guides/local-github-config"
35
+ USER = `git config --global github.user`.chomp
36
+ ORIGIN = `git config remote.origin.url`.chomp
37
+ HTTP_CLONE = `git config --global hub.http-clone`.chomp == 'yes'
38
+ PUBLIC = (HTTP_CLONE ? 'http' : 'git') + '://github.com/%s/%s.git'
39
+ PRIVATE = 'git@github.com:%s/%s.git'
40
+ LGHCONF = "http://github.com/guides/local-github-config"
41
+
42
+ # Set the repo name based on the current origin or, as a fallback,
43
+ # the cwd.
44
+ if ORIGIN =~ %r{\bgithub\.com[:/](.+)/(.+).git$}
45
+ REPO = $2
46
+ else
47
+ REPO = `basename $(pwd)`.chomp
48
+ end
40
49
 
41
50
  # $ hub clone rtomayko/tilt
42
51
  # > git clone git://github.com/rtomayko/tilt.
@@ -89,6 +98,25 @@ module Hub
89
98
  end
90
99
  end
91
100
 
101
+ # $ hub push origin,staging cool-feature
102
+ # > git push origin cool-feature
103
+ # > git push staging cool-feature
104
+ def push(args)
105
+ return unless args[1] =~ /,/
106
+
107
+ branch = args[2]
108
+ remotes = args[1].split(',')
109
+ args[1] = remotes.shift
110
+
111
+ after = "git push #{remotes.shift} #{branch}"
112
+
113
+ while remotes.length > 0
114
+ after += "; git push #{remotes.shift} #{branch}"
115
+ end
116
+
117
+ args.after after
118
+ end
119
+
92
120
  def alias(args)
93
121
  shells = {
94
122
  'sh' => 'alias git=hub',
@@ -153,6 +181,7 @@ module Hub
153
181
  exit
154
182
  end
155
183
  end
184
+ alias_method "--help", :help
156
185
 
157
186
  # The text print when `hub help` is run, kept in its own method
158
187
  # for the convenience of the author.
@@ -282,7 +311,12 @@ help
282
311
  # Wait until we have input before we start the pager
283
312
  Kernel.select [STDIN]
284
313
 
285
- pager = ENV['PAGER'] || 'less -isr'
314
+ pager = ENV['GIT_PAGER'] ||
315
+ `git config --get-all core.pager`.split.first || ENV['PAGER'] ||
316
+ 'less -isr'
317
+
318
+ pager = 'cat' if pager.empty?
319
+
286
320
  exec pager rescue exec "/bin/sh", "-c", pager
287
321
  else
288
322
  # Child process
data/lib/hub/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Hub
2
- Version = '0.1.3'
2
+ Version = '0.2.0'
3
3
  end
data/man/hub.1 CHANGED
@@ -7,19 +7,21 @@
7
7
  \fBhub\fR \-\- git + hub = github
8
8
  .
9
9
  .SH "SYNOPSIS"
10
- \fBhub\fR \fICOMMAND\fR \fIOPTIONS\fR
10
+ \fBhub\fR \fICOMMAND\fR \fIOPTIONS\fR
11
+ .
12
+ .br
13
+ \fBhub alias\fR [\fB\-s\fR] \fISHELL\fR
11
14
  .
12
15
  .br
13
- \fBhub alias\fR [\fB\-s\fR] \fISHELL\fR
14
16
  .
15
17
  .P
16
- \fBgit init \-g\fR \fIOPTIONS\fR
18
+ \fBgit init \-g\fR \fIOPTIONS\fR
17
19
  .
18
20
  .br
19
- \fBgit clone\fR [\fB\-p\fR] \fIOPTIONS\fR [\fIUSER\fR/]\fIREPOSITORY\fR \fIDIRECTORY\fR
21
+ \fBgit clone\fR [\fB\-p\fR] \fIOPTIONS\fR [\fIUSER\fR/]\fIREPOSITORY\fR \fIDIRECTORY\fR
20
22
  .
21
23
  .br
22
- \fBgit remote add\fR [\fB\-p\fR] \fIOPTIONS\fR \fIUSER\fR[/\fIREPOSITORY\fR]
24
+ \fBgit remote add\fR [\fB\-p\fR] \fIOPTIONS\fR \fIUSER\fR[/\fIREPOSITORY\fR]
23
25
  .
24
26
  .br
25
27
  .
@@ -54,6 +56,11 @@ current working directory is used. With \fB\-p\fR, use private remote
54
56
  "git@github.com:\fIUSER\fR/\fIREPOSITORY\fR.git".
55
57
  .
56
58
  .TP
59
+ \fBgit push\fR \fIREMOTE\-1\fR,\fIREMOTE\-2\fR,...,\fIREMOTE\-N\fR \fIREF\fR
60
+ Push \fIREF\fR to each of \fIREMOTE\-1\fR through \fIREMOTE\-N\fR by executing
61
+ multiple \fBgit push\fR commands.
62
+ .
63
+ .TP
57
64
  \fBgit help\fR
58
65
  Display enhanced git\-help(1).
59
66
  .
@@ -84,7 +91,84 @@ $ git config \-\-global github.user <username>
84
91
  .IP "" 0
85
92
  .
86
93
  .P
87
- See \fIhttp://github.com/guides/local\-github\-config\fR for more information.
94
+ See \fIhttp://github.com/guides/local\-github\-config\fR for more
95
+ information.
96
+ .
97
+ .P
98
+ You can also tell \fBhub\fR to use \fBhttp://\fR rather than \fBgit://\fR when
99
+ cloning:
100
+ .
101
+ .IP "" 4
102
+ .
103
+ .nf
104
+
105
+ $ git config \-\-global \-\-add hub.http\-clone yes
106
+ .
107
+ .fi
108
+ .
109
+ .IP "" 0
110
+ .
111
+ .SH "EXAMPLES"
112
+ .
113
+ .SS "git clone"
114
+ .
115
+ .nf
116
+
117
+ $ git clone schacon/ticgit
118
+ > git clone git://github.com/schacon/ticgit.git
119
+ $ git clone \-p schacon/ticgit
120
+ > git clone git@github.com:schacon/ticgit.git
121
+
122
+ $ git clone resque
123
+ > git clone git://github.com/YOUR_USER/resque.git
124
+
125
+ $ git clone \-p resque
126
+ > git clone git@github.com:YOUR_USER/resque.git
127
+ .
128
+ .fi
129
+ .
130
+ .SS "git remote add"
131
+ .
132
+ .nf
133
+
134
+ $ git remote add rtomayko
135
+ > git remote add rtomayko git://github.com/rtomayko/CURRENT_REPO.git
136
+ $ git remote add \-p rtomayko
137
+ > git remote add rtomayko git@github.com:rtomayko/CURRENT_REPO.git
138
+ .
139
+ .fi
140
+ .
141
+ .SS "git init"
142
+ .
143
+ .nf
144
+
145
+ $ git init \-g
146
+ > git init
147
+ > git remote add origin git@github.com:YOUR_USER/REPO.git
148
+ .
149
+ .fi
150
+ .
151
+ .SS "git push"
152
+ .
153
+ .nf
154
+
155
+ $ git push origin,staging,qa bert_timeout
156
+ > git push origin bert_timeout
157
+ > git push staging bert_timeout
158
+ > git push qa bert_timeout
159
+ .
160
+ .fi
161
+ .
162
+ .SS "git help"
163
+ .
164
+ .nf
165
+
166
+ $ git help
167
+ > (improved git help)
168
+ $ git help hub
169
+ > (hub man page)
170
+ .
171
+ .fi
88
172
  .
89
173
  .SH "BUGS"
90
174
  \fIhttp://github.com/defunkt/hub/issues\fR
data/man/hub.1.html CHANGED
@@ -66,12 +66,13 @@
66
66
  <p><code>hub</code> -- git + hub = github</p>
67
67
  <h2>SYNOPSIS</h2>
68
68
 
69
- <p><code>hub</code> <var>COMMAND</var> <var>OPTIONS</var><br>
70
- <code>hub alias</code> [<code>-s</code>] <var>SHELL</var></p>
69
+ <p><code>hub</code> <var>COMMAND</var> <var>OPTIONS</var> <br>
70
+ <code>hub alias</code> [<code>-s</code>] <var>SHELL</var> <br>
71
+ </p>
71
72
 
72
- <p><code>git init -g</code> <var>OPTIONS</var><br>
73
- <code>git clone</code> [<code>-p</code>] <var>OPTIONS</var> [<var>USER</var>/]<var>REPOSITORY</var> <var>DIRECTORY</var><br>
74
- <code>git remote add</code> [<code>-p</code>] <var>OPTIONS</var> <var>USER</var>[/<var>REPOSITORY</var>]<br>
73
+ <p><code>git init -g</code> <var>OPTIONS</var> <br>
74
+ <code>git clone</code> [<code>-p</code>] <var>OPTIONS</var> [<var>USER</var>/]<var>REPOSITORY</var> <var>DIRECTORY</var> <br>
75
+ <code>git remote add</code> [<code>-p</code>] <var>OPTIONS</var> <var>USER</var>[/<var>REPOSITORY</var>] <br>
75
76
  </p>
76
77
 
77
78
  <h2>DESCRIPTION</h2>
@@ -113,6 +114,11 @@ your GitHub login. With <code>-p</code>, use private remote
113
114
  git-remote(1). When /<var>REPOSITORY</var> is omitted, the basename of the
114
115
  current working directory is used. With <code>-p</code>, use private remote
115
116
  "git@github.com:<var>USER</var>/<var>REPOSITORY</var>.git".</p></dd>
117
+ <dt>
118
+ <code>git push</code> <var>REMOTE-1</var>,<var>REMOTE-2</var>,...,<var>REMOTE-N</var> <var>REF</var>
119
+ </dt>
120
+ <dd><p>Push <var>REF</var> to each of <var>REMOTE-1</var> through <var>REMOTE-N</var> by executing
121
+ multiple <code>git push</code> commands.</p></dd>
116
122
  <dt><code>git help</code></dt>
117
123
  <dd><p>Display enhanced git-help(1).</p></dd>
118
124
  </dl>
@@ -130,7 +136,63 @@ current working directory is used. With <code>-p</code>, use private remote
130
136
  <pre><code>$ git config --global github.user &lt;username&gt;
131
137
  </code></pre>
132
138
 
133
- <p>See <a href="http://github.com/guides/local-github-config">http://github.com/guides/local-github-config</a> for more information.</p>
139
+ <p>See <a href="http://github.com/guides/local-github-config">http://github.com/guides/local-github-config</a> for more
140
+ information.</p>
141
+
142
+ <p>You can also tell <code>hub</code> to use <code>http://</code> rather than <code>git://</code> when
143
+ cloning:</p>
144
+
145
+ <pre><code>$ git config --global --add hub.http-clone yes
146
+ </code></pre>
147
+
148
+ <h2>EXAMPLES</h2>
149
+
150
+ <h3>git clone</h3>
151
+
152
+ <pre><code>$ git clone schacon/ticgit
153
+ &gt; git clone git://github.com/schacon/ticgit.git
154
+
155
+ $ git clone -p schacon/ticgit
156
+ &gt; git clone git@github.com:schacon/ticgit.git
157
+
158
+ $ git clone resque
159
+ &gt; git clone git://github.com/YOUR_USER/resque.git
160
+
161
+ $ git clone -p resque
162
+ &gt; git clone git@github.com:YOUR_USER/resque.git
163
+ </code></pre>
164
+
165
+ <h3>git remote add</h3>
166
+
167
+ <pre><code>$ git remote add rtomayko
168
+ &gt; git remote add rtomayko git://github.com/rtomayko/CURRENT_REPO.git
169
+
170
+ $ git remote add -p rtomayko
171
+ &gt; git remote add rtomayko git@github.com:rtomayko/CURRENT_REPO.git
172
+ </code></pre>
173
+
174
+ <h3>git init</h3>
175
+
176
+ <pre><code>$ git init -g
177
+ &gt; git init
178
+ &gt; git remote add origin git@github.com:YOUR_USER/REPO.git
179
+ </code></pre>
180
+
181
+ <h3>git push</h3>
182
+
183
+ <pre><code>$ git push origin,staging,qa bert_timeout
184
+ &gt; git push origin bert_timeout
185
+ &gt; git push staging bert_timeout
186
+ &gt; git push qa bert_timeout
187
+ </code></pre>
188
+
189
+ <h3>git help</h3>
190
+
191
+ <pre><code>$ git help
192
+ &gt; (improved git help)
193
+ $ git help hub
194
+ &gt; (hub man page)
195
+ </code></pre>
134
196
 
135
197
  <h2>BUGS</h2>
136
198
 
data/man/hub.1.ron CHANGED
@@ -3,12 +3,12 @@ hub(1) -- git + hub = github
3
3
 
4
4
  ## SYNOPSIS
5
5
 
6
- `hub` <COMMAND> <OPTIONS>
7
- `hub alias` [`-s`] <SHELL>
6
+ `hub` <COMMAND> <OPTIONS>
7
+ `hub alias` [`-s`] <SHELL>
8
8
 
9
- `git init -g` <OPTIONS>
10
- `git clone` [`-p`] <OPTIONS> [<USER>/]<REPOSITORY> <DIRECTORY>
11
- `git remote add` [`-p`] <OPTIONS> <USER>[/<REPOSITORY>]
9
+ `git init -g` <OPTIONS>
10
+ `git clone` [`-p`] <OPTIONS> [<USER>/]<REPOSITORY> <DIRECTORY>
11
+ `git remote add` [`-p`] <OPTIONS> <USER>[/<REPOSITORY>]
12
12
 
13
13
  ## DESCRIPTION
14
14
 
@@ -40,6 +40,10 @@ After configuring the alias, the following commands have superpowers:
40
40
  current working directory is used. With `-p`, use private remote
41
41
  "git@github.com:<USER>/<REPOSITORY>.git".
42
42
 
43
+ * `git push` <REMOTE-1>,<REMOTE-2>,...,<REMOTE-N> <REF>:
44
+ Push <REF> to each of <REMOTE-1> through <REMOTE-N> by executing
45
+ multiple `git push` commands.
46
+
43
47
  * `git help`:
44
48
  Display enhanced git-help(1).
45
49
 
@@ -53,7 +57,57 @@ Or, set the GitHub username with:
53
57
 
54
58
  $ git config --global github.user <username>
55
59
 
56
- See <http://github.com/guides/local-github-config> for more information.
60
+ See <http://github.com/guides/local-github-config> for more
61
+ information.
62
+
63
+ You can also tell `hub` to use `http://` rather than `git://` when
64
+ cloning:
65
+
66
+ $ git config --global --add hub.http-clone yes
67
+
68
+ ## EXAMPLES
69
+
70
+ ### git clone
71
+
72
+ $ git clone schacon/ticgit
73
+ > git clone git://github.com/schacon/ticgit.git
74
+
75
+ $ git clone -p schacon/ticgit
76
+ > git clone git@github.com:schacon/ticgit.git
77
+
78
+ $ git clone resque
79
+ > git clone git://github.com/YOUR_USER/resque.git
80
+
81
+ $ git clone -p resque
82
+ > git clone git@github.com:YOUR_USER/resque.git
83
+
84
+ ### git remote add
85
+
86
+ $ git remote add rtomayko
87
+ > git remote add rtomayko git://github.com/rtomayko/CURRENT_REPO.git
88
+
89
+ $ git remote add -p rtomayko
90
+ > git remote add rtomayko git@github.com:rtomayko/CURRENT_REPO.git
91
+
92
+ ### git init
93
+
94
+ $ git init -g
95
+ > git init
96
+ > git remote add origin git@github.com:YOUR_USER/REPO.git
97
+
98
+ ### git push
99
+
100
+ $ git push origin,staging,qa bert_timeout
101
+ > git push origin bert_timeout
102
+ > git push staging bert_timeout
103
+ > git push qa bert_timeout
104
+
105
+ ### git help
106
+
107
+ $ git help
108
+ > (improved git help)
109
+ $ git help hub
110
+ > (hub man page)
57
111
 
58
112
  ## BUGS
59
113
 
data/test/hub_test.rb CHANGED
@@ -84,10 +84,22 @@ class HubTest < Test::Unit::TestCase
84
84
  assert_equal "** No GitHub user set. See http://github.com/guides/local-github-config\n", out
85
85
  end
86
86
 
87
+ def test_push_two
88
+ h = Hub("push origin,staging cool-feature")
89
+ assert_equal "git push origin cool-feature", h.command
90
+ assert_equal "git push staging cool-feature", h.after
91
+ end
92
+
93
+ def test_push_more
94
+ h = Hub("push origin,staging,qa cool-feature")
95
+ assert_equal "git push origin cool-feature", h.command
96
+ assert_equal "git push staging cool-feature; git push qa cool-feature", h.after
97
+ end
98
+
87
99
  def test_version
88
100
  out = hub('--version')
89
101
  assert_includes "git version 1.6", out
90
- assert_includes "hub version 0.1", out
102
+ assert_includes "hub version 0.2", out
91
103
  end
92
104
 
93
105
  def test_help
@@ -101,7 +113,7 @@ class HubTest < Test::Unit::TestCase
101
113
  def test_help_hub
102
114
  help_manpage = hub("help hub")
103
115
  assert_includes "git + hub = github", help_manpage
104
- assert_includes "Writes shell aliasing code", help_manpage
116
+ assert_includes "$ git clone schacon/ticgit", help_manpage
105
117
  assert_includes "Chris Wanstrath :: chris@ozmm.org", help_manpage
106
118
  assert_includes <<-config, help_manpage
107
119
  Use git-config(1) to display the currently configured GitHub username:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-hub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Wanstrath
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-11 00:00:00 -08:00
12
+ date: 2009-12-24 00:00:00 -05:00
13
13
  default_executable: hub
14
14
  dependencies: []
15
15
 
@@ -25,6 +25,7 @@ extra_rdoc_files:
25
25
  files:
26
26
  - .gitignore
27
27
  - .kick
28
+ - CONTRIBUTORS
28
29
  - HISTORY.md
29
30
  - LICENSE
30
31
  - README.md