hub 1.8.2 → 1.8.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of hub might be problematic. Click here for more details.

@@ -108,7 +108,11 @@ module Hub
108
108
  options[:base] ||= master_branch.short_name
109
109
 
110
110
  if tracked_branch = options[:head].nil? && current_branch.upstream
111
- if base_project == head_project and tracked_branch.short_name == options[:base]
111
+ if !tracked_branch.remote?
112
+ # The current branch is tracking another local branch. Pretend there is
113
+ # no upstream configuration at all.
114
+ tracked_branch = nil
115
+ elsif base_project == head_project and tracked_branch.short_name == options[:base]
112
116
  $stderr.puts "Aborted: head branch is the same as base (#{options[:base].inspect})"
113
117
  warn "(use `-h <branch>` to specify an explicit pull request head)"
114
118
  abort
@@ -537,9 +541,11 @@ module Hub
537
541
  # $ hub browse pjhyett/github-services
538
542
  # $ hub browse github-services
539
543
  project = github_project dest
544
+ branch = master_branch
540
545
  else
541
546
  # $ hub browse
542
547
  project = current_project
548
+ branch = current_branch && current_branch.upstream || master_branch
543
549
  end
544
550
 
545
551
  abort "Usage: hub browse [<USER>/]<REPOSITORY>" unless project
@@ -547,10 +553,8 @@ module Hub
547
553
  # $ hub browse -- wiki
548
554
  path = case subpage = args.shift
549
555
  when 'commits'
550
- branch = (!dest && current_branch.upstream) || master_branch
551
556
  "/commits/#{branch.short_name}"
552
557
  when 'tree', NilClass
553
- branch = !dest && current_branch.upstream
554
558
  "/tree/#{branch.short_name}" if branch and !branch.master?
555
559
  else
556
560
  "/#{subpage}"
@@ -130,7 +130,7 @@ module Hub
130
130
  end
131
131
 
132
132
  def upstream_project
133
- if upstream = current_branch.upstream
133
+ if branch = current_branch and upstream = branch.upstream and upstream.remote?
134
134
  remote = remote_by_name upstream.remote_name
135
135
  remote.project
136
136
  end
@@ -1,3 +1,3 @@
1
1
  module Hub
2
- Version = VERSION = '1.8.2'
2
+ Version = VERSION = '1.8.3'
3
3
  end
data/man/hub.1 CHANGED
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "HUB" "1" "January 2012" "DEFUNKT" "Git Manual"
4
+ .TH "HUB" "1" "March 2012" "DEFUNKT" "Git Manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBhub\fR \- git + hub = github
@@ -349,7 +349,7 @@ $ git pull\-request \-i 123
349
349
 
350
350
  # $ git checkout https://github\.com/defunkt/hub/pull/73
351
351
  # > git remote add \-f \-t feature git://github:com/mislav/hub\.git
352
- # > git checkout \-b mislav\-feature mislav/feature
352
+ # > git checkout \-\-track \-B mislav\-feature mislav/feature
353
353
 
354
354
  # $ git checkout https://github\.com/defunkt/hub/pull/73 custom\-branch\-name
355
355
  .
@@ -335,7 +335,7 @@ $ git pull-request -i 123
335
335
 
336
336
  <pre><code># $ git checkout https://github.com/defunkt/hub/pull/73
337
337
  # &gt; git remote add -f -t feature git://github:com/mislav/hub.git
338
- # &gt; git checkout -b mislav-feature mislav/feature
338
+ # &gt; git checkout --track -B mislav-feature mislav/feature
339
339
 
340
340
  # $ git checkout https://github.com/defunkt/hub/pull/73 custom-branch-name
341
341
  </code></pre>
@@ -449,7 +449,7 @@ $ git help hub
449
449
 
450
450
  <ol class='man-decor man-foot man foot'>
451
451
  <li class='tl'>DEFUNKT</li>
452
- <li class='tc'>January 2012</li>
452
+ <li class='tc'>March 2012</li>
453
453
  <li class='tr'>hub(1)</li>
454
454
  </ol>
455
455
 
@@ -839,7 +839,6 @@ class HubTest < Test::Unit::TestCase
839
839
  def test_pullrequest_from_tracking_branch
840
840
  stub_branch('refs/heads/feature')
841
841
  stub_tracking('feature', 'mislav', 'yay-feature')
842
- stub_command_output "rev-list --cherry-pick --right-only --no-merges mislav/master...", nil
843
842
 
844
843
  stub_request(:post, "https://#{auth}github.com/api/v2/json/pulls/defunkt/hub").
845
844
  with(:body => { 'pull' => {'base' => "master", 'head' => "mislav:yay-feature", 'title' => "hereyougo"} }).
@@ -849,6 +848,18 @@ class HubTest < Test::Unit::TestCase
849
848
  assert_output expected, "pull-request hereyougo -f"
850
849
  end
851
850
 
851
+ def test_pullrequest_from_branch_tracking_local
852
+ stub_branch('refs/heads/feature')
853
+ stub_tracking('feature', 'refs/heads/master')
854
+
855
+ stub_request(:post, "https://#{auth}github.com/api/v2/json/pulls/defunkt/hub").
856
+ with(:body => { 'pull' => {'base' => "master", 'head' => "tpw:feature", 'title' => "hereyougo"} }).
857
+ to_return(:body => mock_pullreq_response(1))
858
+
859
+ expected = "https://github.com/defunkt/hub/pull/1\n"
860
+ assert_output expected, "pull-request hereyougo -f"
861
+ end
862
+
852
863
  def test_pullrequest_enterprise_no_tracking
853
864
  stub_hub_host('git.my.org')
854
865
  stub_repo_url('git@git.my.org:defunkt/hub.git')
@@ -1156,6 +1167,11 @@ config
1156
1167
  'open https://github.com/mislav/hub/tree/feature/bar'
1157
1168
  end
1158
1169
 
1170
+ def test_hub_browse_no_branch
1171
+ stub_branch(nil)
1172
+ assert_command 'browse', 'open https://github.com/defunkt/hub'
1173
+ end
1174
+
1159
1175
  def test_hub_browse_current
1160
1176
  assert_command "browse", "open https://github.com/defunkt/hub"
1161
1177
  assert_command "browse --", "open https://github.com/defunkt/hub"
@@ -1282,13 +1298,13 @@ config
1282
1298
  stub_command_output 'symbolic-ref -q HEAD', value
1283
1299
  end
1284
1300
 
1285
- def stub_tracking(from, remote_name, remote_branch)
1301
+ def stub_tracking(from, upstream, remote_branch = nil)
1286
1302
  stub_command_output "rev-parse --symbolic-full-name #{from}@{upstream}",
1287
- remote_branch ? "refs/remotes/#{remote_name}/#{remote_branch}" : nil
1303
+ remote_branch ? "refs/remotes/#{upstream}/#{remote_branch}" : upstream
1288
1304
  end
1289
1305
 
1290
1306
  def stub_tracking_nothing(from = 'master')
1291
- stub_tracking(from, nil, nil)
1307
+ stub_tracking(from, nil)
1292
1308
  end
1293
1309
 
1294
1310
  def stub_remotes_group(name, value)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hub
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.2
4
+ version: 1.8.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-02-07 00:00:00.000000000 Z
13
+ date: 2012-03-02 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: ! " `hub` is a command line utility which adds GitHub knowledge to `git`.\n\n
16
16
  \ It can used on its own or as a `git` wrapper.\n\n Normal:\n\n $ hub clone