hub 1.12.2 → 1.12.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 31c0677c16aef1654f0bb45debbd4bb13711b80c
4
- data.tar.gz: b05264bdc353d8ba0875402951cf5fcb869fe0bd
3
+ metadata.gz: 5407dc0fb9ed147f8062d7fc71105e47917d81f5
4
+ data.tar.gz: 822b2cea8f672f01c39a020d8ae7e0f32948c057
5
5
  SHA512:
6
- metadata.gz: d5b0533962cce93062ca8e65b29d4c916008b7394d3cddcc700cec8b379e26e7f11fb0ab398cdadea7a6d905d81966f9637ecaa416320b2fdabea8db5e482a31
7
- data.tar.gz: 87fce8fb1670724bcdb9c169df01998be68fbd260341529a2f8677d669575256e6f5df2a1af900e90f52b67a7172641e8554ece4d296a8111552757895eb9ab7
6
+ metadata.gz: 8685da13cb734dc61dc20ad80fc54967bbfd3f00b8b72b4e99f600d16f25e89e87abd20db7783b9a04ac37cc61e948bc313ca7a94ce083e55c9b761d481d0392
7
+ data.tar.gz: f5bb42ef98e1282d6aacb9e5ee1d0a6f69c9cb2ee702848f25a122dd090d1e0023b0a995333bb1eb98dd0fe426c0cf74b17517c0c9ce05e9d905637574ff19a2
@@ -86,7 +86,7 @@ module Hub
86
86
  abort "Aborted: the origin remote doesn't point to a GitHub repository."
87
87
  end
88
88
 
89
- unless sha = local_repo.git_command("rev-parse -q #{ref}")
89
+ unless sha = local_repo.git_command("rev-parse -q '%s'" % ref.gsub("'", "\\'"))
90
90
  abort "Aborted: no revision could be determined from '#{ref}'"
91
91
  end
92
92
 
@@ -228,8 +228,11 @@ module Hub
228
228
  else
229
229
  format = '%h (%aN, %ar)%n%w(78,3,3)%s%n%+b'
230
230
  default_message = nil
231
- commit_summary = git_command "log --no-color --format='%s' --cherry %s...%s" %
232
- [format, base_branch, remote_branch]
231
+ commit_summary = git_command "log --no-color --format='%s' --cherry '%s...%s'" % [
232
+ format,
233
+ base_branch.to_s.gsub("'", "\\'"),
234
+ remote_branch.to_s.gsub("'", "\\'")
235
+ ]
233
236
  end
234
237
 
235
238
  options[:title], options[:body] = pullrequest_editmsg(commit_summary) { |msg, initial_message, cc|
@@ -294,7 +297,7 @@ module Hub
294
297
  name, owner = arg, nil
295
298
  owner, name = name.split('/', 2) if name.index('/')
296
299
  project = github_project(name, owner || github_user)
297
- unless ssh || args[0] == 'submodule' || args.noop? || https_protocol?
300
+ unless ssh || args[0] == 'submodule' || https_protocol?
298
301
  repo_info = api_client.repo_info(project)
299
302
  ssh = repo_info.success? && (repo_info.data['private'] || repo_info.data['permissions']['push'])
300
303
  end
@@ -690,7 +693,7 @@ module Hub
690
693
  elsif subpage && !%w[commits tree blob settings].include?(subpage)
691
694
  branch = master_branch
692
695
  project = local_repo.main_project
693
- else
696
+ elsif local_repo(false)
694
697
  # $ hub browse
695
698
  prefer_upstream = current_branch && current_branch.master?
696
699
  branch, project = remote_branch_and_project(method(:github_user), prefer_upstream)
@@ -355,7 +355,8 @@ module Hub
355
355
  end
356
356
 
357
357
  def upstream
358
- if branch = local_repo.git_command("rev-parse --symbolic-full-name #{short_name}@{upstream}")
358
+ escaped_name = short_name.gsub("'", "\\'")
359
+ if branch = local_repo.git_command("rev-parse --symbolic-full-name '#{escaped_name}@{upstream}'")
359
360
  Branch.new local_repo, branch
360
361
  end
361
362
  end
@@ -479,7 +480,10 @@ module Hub
479
480
  end
480
481
 
481
482
  def rev_list(a, b)
482
- git_command("rev-list --cherry-pick --right-only --no-merges #{a}...#{b}")
483
+ git_command "rev-list --cherry-pick --right-only --no-merges '%s...%s'" % [
484
+ a.to_s.gsub("'", "\\'"),
485
+ b.to_s.gsub("'", "\\'")
486
+ ]
483
487
  end
484
488
 
485
489
  PWD = Dir.pwd
@@ -273,13 +273,15 @@ module Hub
273
273
 
274
274
  def configure_connection req, url
275
275
  url.scheme = config.protocol(url.host)
276
+ url.port = 80 if url.scheme == 'http'
276
277
  if ENV['HUB_TEST_HOST']
277
278
  req['Host'] = url.host
278
279
  req['X-Original-Scheme'] = url.scheme
280
+ req['X-Original-Port'] = url.port
279
281
  url = url.dup
280
282
  url.scheme = 'http'
281
283
  url.host, test_port = ENV['HUB_TEST_HOST'].split(':')
282
- url.port = test_port.to_i if test_port
284
+ url.port = test_port ? test_port.to_i : 80
283
285
  end
284
286
  yield url
285
287
  end
@@ -33,7 +33,9 @@ unless defined?(URI)
33
33
  end
34
34
 
35
35
  module URI
36
- InvalidURIError = Class.new(StandardError)
36
+ Error = Class.new(StandardError)
37
+ InvalidURIError = Class.new(Error)
38
+ InvalidComponentError = Class.new(Error)
37
39
 
38
40
  def self.parse(str)
39
41
  URI::HTTP.new(str)
@@ -56,23 +58,24 @@ unless defined?(URI)
56
58
 
57
59
  class HTTP
58
60
  attr_accessor :scheme, :user, :password, :host, :path, :query, :fragment
59
- attr_writer :port
61
+ attr_reader :port
60
62
  alias hostname host
61
63
 
62
64
  def initialize(str)
63
65
  m = str.to_s.match(%r{^ ([\w-]+): // (?:([^/@]+)@)? ([^/?#]+) }x)
64
66
  raise InvalidURIError unless m
65
67
  _, self.scheme, self.userinfo, host = m.to_a
66
- self.host, self.port = host.split(':', 2)
68
+ self.host, port = host.split(':', 2)
69
+ self.port = port ? port.to_i : default_port
67
70
  path, self.fragment = m.post_match.split('#', 2)
68
- self.path, self.query = path.to_s.split('?', 2)
71
+ path, self.query = path.split('?', 2) if path
72
+ self.path = path.to_s
69
73
  end
70
74
 
71
75
  def to_s
72
76
  url = "#{scheme}://"
73
77
  url << "#{userinfo}@" if user || password
74
- url << host
75
- url << ":#{@port}" if @port
78
+ url << host << display_port
76
79
  url << path
77
80
  url << "?#{query}" if query
78
81
  url << "##{fragment}" if fragment
@@ -85,8 +88,12 @@ unless defined?(URI)
85
88
  url
86
89
  end
87
90
 
88
- def port
89
- (@port || (scheme == 'https' ? 443 : 80)).to_i
91
+ def port=(number)
92
+ if number.is_a?(Fixnum) && number > 0
93
+ @port = number
94
+ else
95
+ raise InvalidComponentError, "bad component(expected port component): %p" % number
96
+ end
90
97
  end
91
98
 
92
99
  def userinfo=(info)
@@ -102,6 +109,20 @@ unless defined?(URI)
102
109
 
103
110
  def find_proxy
104
111
  end
112
+
113
+ private
114
+
115
+ def default_port
116
+ self.scheme == 'https' ? 443 : 80
117
+ end
118
+
119
+ def display_port
120
+ if port != default_port
121
+ ":#{port}"
122
+ else
123
+ ""
124
+ end
125
+ end
105
126
  end
106
127
  end
107
128
  end
@@ -1,3 +1,3 @@
1
1
  module Hub
2
- Version = VERSION = '1.12.2'
2
+ Version = VERSION = '1.12.3'
3
3
  end
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.12.2
4
+ version: 1.12.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Wanstrath
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-07-11 00:00:00.000000000 Z
12
+ date: 2014-11-28 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: |2
15
15
  `hub` is a command line utility which adds GitHub knowledge to `git`.