提交 c41d4cfb 编写于 作者: J Jingwen Owen Ou

Merge pull request #550 from github/merge_jingweno_gh

gh: Backport changes from gh master
......@@ -5,7 +5,7 @@
"ResourcesInclude": "INSTALL*,README*,LICENSE*",
"ResourcesExclude": "*.go",
"MainDirsExclude": "Godeps",
"PackageVersion": "1.0.0",
"PackageVersion": "2.0.0",
"Verbosity": "v",
"TaskSettings": {
"downloads-page": {
......
......@@ -122,7 +122,7 @@ func parseFlagBrowseURLOnly(args *Args) bool {
}
func branchInURL(branch *github.Branch) string {
parts := strings.Split(strings.Replace(branch.ShortName(), ".", "/", -1), "/")
parts := strings.Split(branch.ShortName(), "/")
newPath := make([]string, len(parts))
for i, s := range parts {
newPath[i] = url.QueryEscape(s)
......
......@@ -116,7 +116,7 @@ GitHub Commands:
ci-status Show the CI status of a commit
See 'git help <command>' for more information on a specific command.
Run 'git update' to update to the latest version of gh.
Run 'git selfupdate' to update to the latest version of gh.
`
func printUsage() {
......
......@@ -5,19 +5,19 @@ import (
"os"
)
var cmdUpdate = &Command{
var cmdSelfupdate = &Command{
Run: update,
Usage: "update",
Usage: "selfupdate",
Short: "Update gh",
Long: `Update gh to the latest version.
Examples:
git update
git selfupdate
`,
}
func init() {
CmdRunner.Use(cmdUpdate)
CmdRunner.Use(cmdSelfupdate)
}
func update(cmd *Command, args *Args) {
......
......@@ -93,6 +93,10 @@ func getTitleAndBodyFromFlags(messageFlag, fileFlag string) (title, body string,
func readMsg(msg string) (title, body string) {
split := strings.SplitN(msg, "\n\n", 2)
if len(split) == 1 {
split = strings.SplitN(msg, "\\n\\n", 2)
}
title = strings.TrimSpace(split[0])
if len(split) > 1 {
body = strings.TrimSpace(split[1])
......
package commands
import (
"github.com/bmizerany/assert"
"io/ioutil"
"os"
"testing"
"github.com/bmizerany/assert"
)
func TestGetTitleAndBodyFromFlags(t *testing.T) {
s := "just needs raven\n\nnow it works"
title, body, err := getTitleAndBodyFromFlags(s, "")
assert.Equal(t, nil, err)
assert.Equal(t, "just needs raven", title)
assert.Equal(t, "now it works", body)
s = "just needs raven\\n\\nnow it works"
title, body, err = getTitleAndBodyFromFlags(s, "")
assert.Equal(t, nil, err)
assert.Equal(t, "just needs raven", title)
assert.Equal(t, "now it works", body)
}
func TestDirIsNotEmpty(t *testing.T) {
dir := createTempDir(t)
defer os.RemoveAll(dir)
......
......@@ -7,7 +7,7 @@ import (
"os"
)
const Version = "1.0.0"
const Version = "2.0.0"
var cmdVersion = &Command{
Run: runVersion,
......
......@@ -107,13 +107,20 @@ Feature: hub browse
Then there should be no output
# Then "open https://github.com/jashkenas/coffee-script/issues" should be run
Scenario: Complex branch
Scenario: Forward Slash Delimited branch
Given I am in "git://github.com/mislav/dotfiles.git" git repo
And git "push.default" is set to "upstream"
And I am on the "foo/bar" branch with upstream "origin/baz/qux/moo"
When I successfully run `hub browse`
Then "open https://github.com/mislav/dotfiles/tree/baz/qux/moo" should be run
Scenario: Dot Delimited branch
Given I am in "git://github.com/mislav/dotfiles.git" git repo
And git "push.default" is set to "upstream"
And I am on the "fix-glob-for.js" branch with upstream "origin/fix-glob-for.js"
When I successfully run `hub browse`
Then "open https://github.com/mislav/dotfiles/tree/fix-glob-for.js" should be run
Scenario: Wiki repo
Given I am in "git://github.com/defunkt/hub.wiki.git" git repo
When I successfully run `hub browse`
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册