diff --git a/bin/hub b/bin/hub index 960a01b..1d96b80 100755 --- a/bin/hub +++ b/bin/hub @@ -7,7 +7,7 @@ # module Hub - Version = VERSION = '1.10.2' + Version = VERSION = '1.10.6' end module Hub @@ -17,7 +17,6 @@ module Hub def initialize(*args) super @executable = ENV["GIT"] || "git" - @after = nil @skip = @noop = false @original_args = args.first @chain = [nil] @@ -228,7 +227,7 @@ module Hub end def create_repo project, options = {} - is_org = project.owner != config.username(api_host(project.host)) + is_org = project.owner.downcase != config.username(api_host(project.host)).downcase params = { :name => project.name, :private => !!options[:private] } params[:description] = options[:description] if options[:description] params[:homepage] = options[:homepage] if options[:homepage] @@ -239,6 +238,7 @@ module Hub res = post "https://%s/user/repos" % api_host(project.host), params end res.error! unless res.success? + res.data end def pullrequest_info project, pull_id @@ -269,6 +269,14 @@ module Hub res.data end + def statuses project, sha + res = get "https://%s/repos/%s/%s/statuses/%s" % + [api_host(project.host), project.owner, project.name, sha] + + res.error! unless res.success? + res.data + end + module HttpMethods module ResponseMethods def status() code.to_i end @@ -281,7 +289,12 @@ module Hub data['errors'].map do |err| case err['code'] when 'custom' then err['message'] - when 'missing_field' then "field '%s' is missing" % err['field'] + when 'missing_field' + %(Missing field: "%s") % err['field'] + when 'invalid' + %(Invalid value for "%s": "%s") % [ err['field'], err['value'] ] + when 'unauthorized' + %(Not allowed to change field "%s") % err['field'] end end.compact if data['errors'] end @@ -295,10 +308,17 @@ module Hub perform_request url, :Post do |req| if params req.body = JSON.dump params - req['Content-Type'] = 'application/json' + req['Content-Type'] = 'application/json;charset=utf-8' end yield req if block_given? - req['Content-Length'] = req.body ? req.body.length : 0 + req['Content-Length'] = byte_size req.body + end + end + + def byte_size str + if str.respond_to? :bytesize then str.bytesize + elsif str.respond_to? :length then str.length + else 0 end end @@ -315,13 +335,17 @@ module Hub create_connection host_url end + req['User-Agent'] = "Hub #{Hub::VERSION}" apply_authentication(req, url) yield req if block_given? - res = http.start { http.request(req) } - res.extend ResponseMethods - res - rescue SocketError => err - raise Context::FatalError, "error with #{type.to_s.upcase} #{url} (#{err.message})" + + begin + res = http.start { http.request(req) } + res.extend ResponseMethods + return res + rescue SocketError => err + raise Context::FatalError, "error with #{type.to_s.upcase} #{url} (#{err.message})" + end end def request_uri url @@ -373,10 +397,17 @@ module Hub if (req.path =~ /\/authorizations$/) super else + refresh = false user = url.user || config.username(url.host) token = config.oauth_token(url.host, user) { + refresh = true obtain_oauth_token url.host, user } + if refresh + res = get "https://#{url.host}/user" + res.error! unless res.success? + config.update_username(url.host, user, res.data['login']) + end req['Authorization'] = "token #{token}" end end @@ -462,6 +493,7 @@ module Hub end def username host + return ENV['GITHUB_USER'] unless ENV['GITHUB_USER'].to_s.empty? host = normalize_host host @data.fetch_user host do if block_given? then yield @@ -470,6 +502,12 @@ module Hub end end + def update_username host, old_username, new_username + entry = @data.entry_for_user(normalize_host(host), old_username) + entry['user'] = new_username + @data.save + end + def api_token host, user host = normalize_host host @data.fetch_value host, user, :api_token do @@ -480,6 +518,7 @@ module Hub end def password host, user + return ENV['GITHUB_PASSWORD'] unless ENV['GITHUB_PASSWORD'].to_s.empty? host = normalize_host host @password_cache["#{user}@#{host}"] ||= prompt_password host, user end @@ -504,11 +543,14 @@ module Hub end end + NULL = defined?(File::NULL) ? File::NULL : + File.exist?('/dev/null') ? '/dev/null' : 'NUL' + def askpass - tty_state = `stty -g` + tty_state = `stty -g 2>#{NULL}` system 'stty raw -echo -icanon isig' if $?.success? pass = '' - while char = $stdin.getbyte and !(char == 13 or char == 10) + while char = getbyte($stdin) and !(char == 13 or char == 10) if char == 127 or char == 8 pass[-1,1] = '' unless pass.empty? else @@ -520,6 +562,14 @@ module Hub system "stty #{tty_state}" unless tty_state.empty? end + def getbyte(io) + if io.respond_to?(:getbyte) + io.getbyte + else + io.getc + end + end + def proxy_uri(with_ssl) env_name = "HTTP#{with_ssl ? 'S' : ''}_PROXY" if proxy = ENV[env_name] || ENV[env_name.downcase] and !proxy.empty? @@ -744,6 +794,7 @@ module Hub def initialize(*args) super + self.name = self.name.tr(' ', '-') self.host ||= (local_repo || LocalRepo).default_host self.host = host.sub(/^ssh\./i, '') if 'ssh.github.com' == host.downcase end @@ -854,7 +905,7 @@ module Hub end def project - urls.each { |url| + urls.each_value { |url| if valid = GithubProject.from_url(url, local_repo) return valid end @@ -863,15 +914,21 @@ module Hub end def urls - @urls ||= local_repo.git_config("remote.#{name}.url", :all).to_s.split("\n").map { |uri| - begin - if uri =~ %r{^[\w-]+://} then uri_parse(uri) - elsif uri =~ %r{^([^/]+?):} then uri_parse("ssh://#{$1}/#{$'}") # scp-like syntax + return @urls if defined? @urls + @urls = {} + local_repo.git_command('remote -v').to_s.split("\n").map do |line| + next if line !~ /^(.+?)\t(.+) \((.+)\)$/ + remote, uri, type = $1, $2, $3 + next if remote != self.name + if uri =~ %r{^[\w-]+://} or uri =~ %r{^([^/]+?):} + uri = "ssh://#{$1}/#{$'}" if $1 + begin + @urls[type] = uri_parse(uri) + rescue URI::InvalidURIError end - rescue URI::InvalidURIError - nil end - }.compact + end + @urls end def uri_parse uri @@ -946,13 +1003,15 @@ module Hub editor = git_command 'var GIT_EDITOR' editor = ENV[$1] if editor =~ /^\$(\w+)$/ editor = File.expand_path editor if (editor =~ /^[~.]/ or editor.index('/')) and editor !~ /["']/ - editor.shellsplit + if File.exist? editor then [editor] + else editor.shellsplit + end end module System def browser_launcher browser = ENV['BROWSER'] || ( - osx? ? 'open' : windows? ? 'start' : + osx? ? 'open' : windows? ? %w[cmd /c start] : %w[xdg-open cygstart x-www-browser firefox opera mozilla netscape].find { |comm| which comm } ) @@ -984,6 +1043,10 @@ module Hub def command?(name) !which(name).nil? end + + def tmp_dir + ENV['TMPDIR'] || ENV['TEMP'] || '/tmp' + end end include System @@ -1103,10 +1166,22 @@ class Hub::JSON end end - def generate_String(str) str.inspect end - alias generate_Numeric generate_String - alias generate_TrueClass generate_String - alias generate_FalseClass generate_String + ESC_MAP = Hash.new {|h,k| k }.update \ + "\r" => 'r', + "\n" => 'n', + "\f" => 'f', + "\t" => 't', + "\b" => 'b' + + def generate_String(str) + escaped = str.gsub(/[\r\n\f\t\b"\\]/) { "\\#{ESC_MAP[$&]}"} + %("#{escaped}") + end + + def generate_simple(obj) obj.inspect end + alias generate_Numeric generate_simple + alias generate_TrueClass generate_simple + alias generate_FalseClass generate_simple def generate_Symbol(sym) generate_String(sym.to_s) end @@ -1132,10 +1207,10 @@ module Hub extend Context NAME_RE = /[\w.][\w.-]*/ - OWNER_RE = /[a-zA-Z0-9-]+/ + OWNER_RE = /[a-zA-Z0-9][a-zA-Z0-9-]*/ NAME_WITH_OWNER_RE = /^(?:#{NAME_RE}|#{OWNER_RE}\/#{NAME_RE})$/ - CUSTOM_COMMANDS = %w[alias create browse compare fork pull-request] + CUSTOM_COMMANDS = %w[alias create browse compare fork pull-request ci-status] def run(args) slurp_global_flags(args) @@ -1165,6 +1240,34 @@ module Hub abort "fatal: #{err.message}" end + + def ci_status(args) + args.shift + ref = args.words.first || 'HEAD' + + unless head_project = local_repo.current_project + abort "Aborted: the origin remote doesn't point to a GitHub repository." + end + + unless sha = local_repo.git_command("rev-parse -q #{ref}") + abort "Aborted: no revision could be determined from '#{ref}'" + end + + statuses = api_client.statuses(head_project, sha) + status = statuses.first + ref_state = status ? status['state'] : 'no status' + + exit_code = case ref_state + when 'success' then 0 + when 'failure', 'error' then 1 + when 'pending' then 2 + else 3 + end + + $stdout.puts ref_state + exit exit_code + end + def pull_request(args) args.shift options = { } @@ -1172,6 +1275,10 @@ module Hub base_project = local_repo.main_project head_project = local_repo.current_project + unless current_branch + abort "Aborted: not currently on any branch." + end + unless base_project abort "Aborted: the origin remote doesn't point to a GitHub repository." end @@ -1188,6 +1295,13 @@ module Hub case arg when '-f' force = true + when '-F', '--file' + file = args.shift + text = file == '-' ? $stdin.read : File.read(file) + options[:title], options[:body] = read_msg(text) + when '-m', '--message' + text = args.shift + options[:title], options[:body] = read_msg(text) when '-b' base_project, options[:base] = from_github_ref.call(args.shift, base_project) when '-h' @@ -1200,7 +1314,10 @@ module Hub if url = resolve_github_url(arg) and url.project_path =~ /^issues\/(\d+)/ options[:issue] = $1 base_project = url.project - elsif !options[:title] then options[:title] = arg + elsif !options[:title] + options[:title] = arg + warn "hub: Specifying pull request title without a flag is deprecated." + warn "Please use one of `-m' or `-F' options." else abort "invalid argument: #{arg}" end @@ -1258,8 +1375,9 @@ module Hub [format, base_branch, remote_branch] end - options[:title], options[:body] = pullrequest_editmsg(commit_summary) { |msg| - msg.puts default_message if default_message + options[:title], options[:body] = pullrequest_editmsg(commit_summary) { |msg, initial_message| + initial_message ||= default_message + msg.puts initial_message if initial_message msg.puts "" msg.puts "# Requesting a pull to #{base_project.owner}:#{options[:base]} from #{options[:head]}" msg.puts "#" @@ -1273,13 +1391,20 @@ module Hub args.executable = 'echo' args.replace [pull['html_url']] rescue GitHubAPI::Exceptions - display_api_exception("creating pull request", $!.response) + response = $!.response + display_api_exception("creating pull request", response) + if 404 == response.status + base_url = base_project.web_url.split('://', 2).last + warn "Are you sure that #{base_url} exists?" + end exit 1 + else + delete_editmsg end def clone(args) ssh = args.delete('-p') - has_values = /^(--(upload-pack|template|depth|origin|branch|reference)|-[ubo])$/ + has_values = /^(--(upload-pack|template|depth|origin|branch|reference|name)|-[ubo])$/ idx = 1 while idx < args.length @@ -1304,17 +1429,7 @@ module Hub return unless index = args.index('add') args.delete_at index - branch = args.index('-b') || args.index('--branch') - if branch - args.delete_at branch - branch_name = args.delete_at branch - end - clone(args) - - if branch_name - args.insert branch, '-b', branch_name - end args.insert index, 'add' end @@ -1359,7 +1474,7 @@ module Hub end projects = names.map { |name| - unless name =~ /\W/ or remotes.include?(name) or remotes_group(name) + unless name !~ /^#{OWNER_RE}$/ or remotes.include?(name) or remotes_group(name) project = github_project(nil, name) repo_info = api_client.repo_info(project) if repo_info.success? @@ -1454,7 +1569,7 @@ module Hub url = url.sub(%r{(/pull/\d+)/\w*$}, '\1') unless gist ext = gist ? '.txt' : '.patch' url += ext unless File.extname(url) == ext - patch_file = File.join(ENV['TMPDIR'] || '/tmp', "#{gist ? 'gist-' : ''}#{File.basename(url)}") + patch_file = File.join(tmp_dir, "#{gist ? 'gist-' : ''}#{File.basename(url)}") args.before 'curl', ['-#LA', "hub #{Hub::Version}", url, '-o', patch_file] args[idx] = patch_file end @@ -1476,9 +1591,14 @@ module Hub end forked_project = project.owned_by(github_user(project.host)) - if api_client.repo_exists?(forked_project) - abort "Error creating fork: %s already exists on %s" % - [ forked_project.name_with_owner, forked_project.host ] + existing_repo = api_client.repo_info(forked_project) + if existing_repo.success? + parent_data = existing_repo.data['parent'] + parent_url = parent_data && resolve_github_url(parent_data['html_url']) + if !parent_url or parent_url.project != project + abort "Error creating fork: %s already exists on %s" % + [ forked_project.name_with_owner, forked_project.host ] + end else api_client.fork_repo(project) unless args.noop? end @@ -1528,7 +1648,10 @@ module Hub action = "set remote origin" else action = "created repository" - api_client.create_repo(new_project, options) unless args.noop? + unless args.noop? + repo_data = api_client.create_repo(new_project, options) + new_project = github_project(repo_data['full_name']) + end end url = new_project.git_url(:private => true, :https => https_protocol?) @@ -1579,11 +1702,12 @@ module Hub abort "Usage: hub browse [/]" unless project + require 'cgi' path = case subpage = args.shift when 'commits' - "/commits/#{branch.short_name}" + "/commits/#{branch_in_url(branch)}" when 'tree', NilClass - "/tree/#{branch.short_name}" if branch and !branch.master? + "/tree/#{branch_in_url(branch)}" if branch and !branch.master? else "/#{subpage}" end @@ -1604,7 +1728,7 @@ module Hub abort "Usage: hub compare [USER] [...]" end else - sha_or_tag = /(\w{1,2}|\w[\w.-]+\w)/ + sha_or_tag = /((?:#{OWNER_RE}:)?\w[\w.-]+\w)/ range = args.pop.sub(/^#{sha_or_tag}\.\.#{sha_or_tag}$/, '\1...\2') project = if owner = args.pop then github_project(nil, owner) else current_project @@ -1642,11 +1766,6 @@ module Hub if script puts "alias git=hub" - if 'zsh' == shell - puts "if type compdef >/dev/null; then" - puts " compdef hub=git" - puts "fi" - end else profile = case shell when 'bash' then '~/.bash_profile' @@ -1672,25 +1791,35 @@ module Hub def help(args) command = args.words[1] - if command == 'hub' + if command == 'hub' || custom_command?(command) puts hub_manpage exit - elsif command.nil? && !args.has_flag?('-a', '--all') - ENV['GIT_PAGER'] = '' unless args.has_flag?('-p', '--paginate') # Use `cat`. - puts improved_help_text - exit + elsif command.nil? + if args.has_flag?('-a', '--all') + args.after 'echo', ["\nhub custom commands\n"] + args.after 'echo', CUSTOM_COMMANDS.map {|cmd| " #{cmd}" } + else + ENV['GIT_PAGER'] = '' unless args.has_flag?('-p', '--paginate') # Use `cat`. + puts improved_help_text + exit + end end end alias_method "--help", :help private + def branch_in_url(branch) + require 'cgi' + CGI.escape(branch.short_name).gsub("%2F", "/") + end + def api_client @api_client ||= begin config_file = ENV['HUB_CONFIG'] || '~/.config/hub' file_store = GitHubAPI::FileStore.new File.expand_path(config_file) file_config = GitHubAPI::Configuration.new file_store - GitHubAPI.new file_config, :app_url => 'http://defunkt.io/hub/' + GitHubAPI.new file_config, :app_url => 'http://github.github.com/hub/' end end @@ -1768,6 +1897,7 @@ GitHub Commands: create Create this repository on GitHub and add GitHub as origin browse Open a GitHub page in the default browser compare Open a compare page on GitHub + ci-status Show the CI status of a commit See 'git help ' for more information on a specific command. help @@ -1859,7 +1989,8 @@ help Kernel.select [STDIN] pager = ENV['GIT_PAGER'] || - `git config --get-all core.pager`.split.first || ENV['PAGER'] || + `git config --get-all core.pager`.split("\n").first || + ENV['PAGER'] || 'less -isr' pager = 'cat' if pager.empty? @@ -1871,27 +2002,53 @@ help read.close write.close end + rescue NotImplementedError end def pullrequest_editmsg(changes) - message_file = File.join(git_dir, 'PULLREQ_EDITMSG') + message_file = pullrequest_editmsg_file + + if valid_editmsg_file?(message_file) + title, body = read_editmsg(message_file) + previous_message = [title, body].compact.join("\n\n") if title + end + File.open(message_file, 'w') { |msg| - yield msg + yield msg, previous_message if changes msg.puts "#\n# Changes:\n#" msg.puts changes.gsub(/^/, '# ').gsub(/ +$/, '') end } + edit_cmd = Array(git_editor).dup - edit_cmd << '-c' << 'set ft=gitcommit' if edit_cmd[0] =~ /^[mg]?vim$/ + edit_cmd << '-c' << 'set ft=gitcommit tw=0 wrap lbr' if edit_cmd[0] =~ /^[mg]?vim$/ edit_cmd << message_file system(*edit_cmd) - abort "can't open text editor for pull request message" unless $?.success? + + unless $?.success? + delete_editmsg(message_file) + abort "error using text editor for pull request message" + end + title, body = read_editmsg(message_file) abort "Aborting due to empty pull request title" unless title [title, body] end + def valid_editmsg_file?(message_file) + File.exists?(message_file) && + File.mtime(message_file) > File.mtime(__FILE__) + end + + def read_msg(message) + message.split("\n\n", 2).each {|s| s.strip! }.reject {|s| s.empty? } + end + + def pullrequest_editmsg_file + File.join(git_dir, 'PULLREQ_EDITMSG') + end + def read_editmsg(file) title, body = '', '' File.open(file, 'r') { |msg| @@ -1907,6 +2064,10 @@ help [title =~ /\S/ ? title : nil, body =~ /\S/ ? body : nil] end + def delete_editmsg(file = pullrequest_editmsg_file) + File.delete(file) if File.exist?(file) + end + def expand_alias(cmd) if expanded = git_alias_for(cmd) if expanded.index('!') != 0 @@ -1963,16 +2124,11 @@ module Hub if args.noop? puts commands elsif not args.skip? - if args.chained? - execute_command_chain - else - exec(*args.to_exec) - end + execute_command_chain args.commands end end - def execute_command_chain - commands = args.commands + def execute_command_chain commands commands.each_with_index do |cmd, i| if cmd.respond_to?(:call) then cmd.call elsif i == commands.length - 1 @@ -1982,6 +2138,14 @@ module Hub end end end + + def exec *args + if args.first == 'echo' && Context::windows? + puts args[1..-1].join(' ') + else + super + end + end end end @@ -1991,7 +2155,7 @@ __END__ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "HUB" "1" "May 2012" "DEFUNKT" "Git Manual" +.TH "HUB" "1" "July 2013" "GITHUB" "Git Manual" . .SH "NAME" \fBhub\fR \- git + hub = github @@ -2051,7 +2215,10 @@ __END__ \fBgit fork\fR [\fB\-\-no\-remote\fR] . .br -\fBgit pull\-request\fR [\fB\-f\fR] [\fITITLE\fR|\fB\-i\fR \fIISSUE\fR] [\fB\-b\fR \fIBASE\fR] [\fB\-h\fR \fIHEAD\fR] +\fBgit pull\-request\fR [\fB\-f\fR] [\fB\-m\fR \fIMESSAGE\fR|\fB\-F\fR \fIFILE\fR|\fB\-i\fR \fIISSUE\fR|\fIISSUE\-URL\fR] [\fB\-b\fR \fIBASE\fR] [\fB\-h\fR \fIHEAD\fR] +. +.br +\fBgit ci\-status\fR [\fICOMMIT\fR] . .SH "DESCRIPTION" hub enhances various git commands to ease most common workflows with GitHub\. @@ -2121,30 +2288,40 @@ Create a new public GitHub repository from the current git repository and add re . .TP \fBgit browse\fR [\fB\-u\fR] [[\fIUSER\fR\fB/\fR]\fIREPOSITORY\fR] [SUBPAGE] -Open repository\'s GitHub page in the system\'s default web browser using \fBopen(1)\fR or the \fBBROWSER\fR env variable\. If the repository isn\'t specified, \fBbrowse\fR opens the page of the repository found in the current directory\. If SUBPAGE is specified, the browser will open on the specified subpage: one of "wiki", "commits", "issues" or other (the default is "tree")\. +Open repository\'s GitHub page in the system\'s default web browser using \fBopen(1)\fR or the \fBBROWSER\fR env variable\. If the repository isn\'t specified, \fBbrowse\fR opens the page of the repository found in the current directory\. If SUBPAGE is specified, the browser will open on the specified subpage: one of "wiki", "commits", "issues" or other (the default is "tree")\. With \fB\-u\fR, outputs the URL rather than opening the browser\. . .TP \fBgit compare\fR [\fB\-u\fR] [\fIUSER\fR] [\fISTART\fR\.\.\.]\fIEND\fR -Open a GitHub compare view page in the system\'s default web browser\. \fISTART\fR to \fIEND\fR are branch names, tag names, or commit SHA1s specifying the range of history to compare\. If a range with two dots (\fBa\.\.b\fR) is given, it will be transformed into one with three dots\. If \fISTART\fR is omitted, GitHub will compare against the base branch (the default is "master")\. +Open a GitHub compare view page in the system\'s default web browser\. \fISTART\fR to \fIEND\fR are branch names, tag names, or commit SHA1s specifying the range of history to compare\. If a range with two dots (\fBa\.\.b\fR) is given, it will be transformed into one with three dots\. If \fISTART\fR is omitted, GitHub will compare against the base branch (the default is "master")\. With \fB\-u\fR, outputs the URL rather than opening the browser\. . .TP \fBgit fork\fR [\fB\-\-no\-remote\fR] Forks the original project (referenced by "origin" remote) on GitHub and adds a new remote for it under your username\. . .TP -\fBgit pull\-request\fR [\fB\-f\fR] [\fITITLE\fR|\fB\-i\fR \fIISSUE\fR|\fIISSUE\-URL\fR] [\fB\-b\fR \fIBASE\fR] [\fB\-h\fR \fIHEAD\fR] +\fBgit pull\-request\fR [\fB\-f\fR] [\fB\-m\fR \fIMESSAGE\fR|\fB\-F\fR \fIFILE\fR|\fB\-i\fR \fIISSUE\fR|\fIISSUE\-URL\fR] [\fB\-b\fR \fIBASE\fR] [\fB\-h\fR \fIHEAD\fR] Opens a pull request on GitHub for the project that the "origin" remote points to\. The default head of the pull request is the current branch\. Both base and head of the pull request can be explicitly given in one of the following formats: "branch", "owner:branch", "owner/repo:branch"\. This command will abort operation if it detects that the current topic branch has local commits that are not yet pushed to its upstream branch on the remote\. To skip this check, use \fB\-f\fR\. . .IP -If \fITITLE\fR is omitted, a text editor will open in which title and body of the pull request can be entered in the same manner as git commit message\. +Without \fIMESSAGE\fR or \fIFILE\fR, a text editor will open in which title and body of the pull request can be entered in the same manner as git commit message\. Pull request message can also be passed via stdin with \fB\-F \-\fR\. . .IP If instead of normal \fITITLE\fR an issue number is given with \fB\-i\fR, the pull request will be attached to an existing GitHub issue\. Alternatively, instead of title you can paste a full URL to an issue on GitHub\. . +.TP +\fBgit ci\-status\fR [\fICOMMIT\fR] +Looks up the SHA for \fICOMMIT\fR in GitHub Status API and displays the latest status\. Exits with one of: +. +.br +success (0), error (1), failure (1), pending (2), no status (3) +. .SH "CONFIGURATION" Hub will prompt for GitHub username & password the first time it needs to access the API and exchange it for an OAuth token, which it saves in "~/\.config/hub"\. . .P +To avoid being prompted, use \fIGITHUB_USER\fR and \fIGITHUB_PASSWORD\fR environment variables\. +. +.P If you prefer the HTTPS protocol for GitHub repositories, you can set "hub\.protocol" to "https"\. This will affect \fBclone\fR, \fBfork\fR, \fBremote add\fR and other operations that expand references to GitHub repositories as full URLs that otherwise use git and ssh protocols\. . .IP "" 4 @@ -2286,7 +2463,7 @@ $ git pull\-request [ opened pull request on GitHub for "YOUR_USER:feature" ] # explicit title, pull base & head: -$ git pull\-request "I\'ve implemented feature X" \-b defunkt:master \-h mislav:feature +$ git pull\-request \-m "Implemented feature X" \-b defunkt:master \-h mislav:feature $ git pull\-request \-i 123 [ attached pull request to issue #123 ] @@ -2412,8 +2589,18 @@ $ hub submodule add wycats/bundler vendor/bundler $ hub submodule add \-p wycats/bundler vendor/bundler > git submodule add git@github\.com:wycats/bundler\.git vendor/bundler -$ hub submodule add \-b ryppl ryppl/pip vendor/pip -> git submodule add \-b ryppl git://github\.com/ryppl/pip\.git vendor/pip +$ hub submodule add \-b ryppl \-\-name pip ryppl/pip vendor/pip +> git submodule add \-b ryppl \-\-name pip git://github\.com/ryppl/pip\.git vendor/pip +. +.fi +. +.SS "git ci\-status" +. +.nf + +$ hub ci\-status [commit] +> (prints CI state of commit and exits with appropriate code) +> One of: success (0), error (1), failure (1), pending (2), no status (3) . .fi . @@ -2429,10 +2616,10 @@ $ git help hub .fi . .SH "BUGS" -\fIhttps://github\.com/defunkt/hub/issues\fR +\fIhttps://github\.com/github/hub/issues\fR . .SH "AUTHORS" -\fIhttps://github\.com/defunkt/hub/contributors\fR +\fIhttps://github\.com/github/hub/contributors\fR . .SH "SEE ALSO" -git(1), git\-clone(1), git\-remote(1), git\-init(1), \fIhttp://github\.com\fR, \fIhttps://github\.com/defunkt/hub\fR +git(1), git\-clone(1), git\-remote(1), git\-init(1), \fIhttp://github\.com\fR, \fIhttps://github\.com/github/hub\fR