Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into limit-flags
Browse files Browse the repository at this point in the history
  • Loading branch information
mislav committed Jan 29, 2018
2 parents 1aedd0c + 70e63ec commit 420d212
Show file tree
Hide file tree
Showing 452 changed files with 153,959 additions and 12,053 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -2,7 +2,7 @@
*~
/bin
.bundle
vendor/bundle/
bundle/
share/man/*
!share/man/man1/hub.1.ronn
tmp/
Expand Down
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Expand Up @@ -46,6 +46,10 @@ feature is a good idea for hub if it improves some workflow for a GitHub user.
8. Open a pull request describing your changes:
`bin/hub pull-request`

Vendored Go dependencies are managed with [`dep`](https://golang.github.io/dep/docs/daily-dep.html).
Check `dep help ensure` for information on how to add or update a vendored
dependency.

## How to write tests

The new test suite is written in Cucumber under `features/` directory. Each
Expand Down
90 changes: 90 additions & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 43 additions & 0 deletions Gopkg.toml
@@ -0,0 +1,43 @@
[[constraint]]
name = "github.com/BurntSushi/toml"
version = "0.3.0"

[[constraint]]
branch = "master"
name = "github.com/atotto/clipboard"

[[constraint]]
branch = "master"
name = "github.com/bmizerany/assert"

[[constraint]]
branch = "master"
name = "github.com/kballard/go-shellquote"

[[constraint]]
name = "github.com/mattn/go-colorable"
version = "0.0.9"

[[constraint]]
name = "github.com/mattn/go-isatty"
version = "0.0.3"

[[constraint]]
branch = "master"
name = "github.com/mitchellh/go-homedir"

[[constraint]]
name = "github.com/ogier/pflag"
version = "0.0.1"

[[constraint]]
branch = "master"
name = "golang.org/x/crypto"

[[constraint]]
branch = "v1"
name = "gopkg.in/yaml.v1"

[prune]
go-tests = true
unused-packages = true
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -142,8 +142,8 @@ New-Item -Type file -Force $PROFILE
### Shell tab-completion
hub repository contains tab-completion scripts for bash and zsh. These scripts
complement existing completion scripts that ship with git.
hub repository contains tab-completion scripts for bash, zsh and fish.
These scripts complement existing completion scripts that ship with git.
[Installation instructions](etc)
Expand Down
4 changes: 2 additions & 2 deletions commands/clone.go
Expand Up @@ -47,13 +47,13 @@ func clone(command *Command, args *Args) {

func transformCloneArgs(args *Args) {
isSSH := parseClonePrivateFlag(args)
hasValueRegxp := regexp.MustCompile("^(--(upload-pack|template|depth|origin|branch|reference|name)|-[ubo])$")
hasValueRegexp := regexp.MustCompile("^(--(upload-pack|template|depth|origin|branch|reference|name)|-[ubo])$")
nameWithOwnerRegexp := regexp.MustCompile(NameWithOwnerRe)
for i := 0; i < args.ParamsSize(); i++ {
a := args.Params[i]

if strings.HasPrefix(a, "-") {
if hasValueRegxp.MatchString(a) {
if hasValueRegexp.MatchString(a) {
i++
}
} else {
Expand Down
6 changes: 3 additions & 3 deletions commands/fetch.go
Expand Up @@ -34,12 +34,12 @@ func init() {

func fetch(command *Command, args *Args) {
if !args.IsParamsEmpty() {
err := tranformFetchArgs(args)
err := transformFetchArgs(args)
utils.Check(err)
}
}

func tranformFetchArgs(args *Args) error {
func transformFetchArgs(args *Args) error {
names := parseRemoteNames(args)

localRepo, err := github.LocalRepo()
Expand All @@ -61,7 +61,7 @@ func tranformFetchArgs(args *Args) error {
continue
}

projects[project] = repo.Private
projects[project] = repo.Private || repo.Permissions.Push
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions commands/fork.go
Expand Up @@ -84,7 +84,7 @@ func fork(cmd *Command, args *Args) {
if err == nil {
var parentURL *github.URL
if parent := existingRepo.Parent; parent != nil {
parentURL, _ = github.ParseURL(parent.HTMLURL)
parentURL, _ = github.ParseURL(parent.HtmlUrl)
}
if parentURL == nil || !project.SameAs(parentURL.Project) {
err = fmt.Errorf("Error creating fork: %s already exists on %s",
Expand All @@ -111,7 +111,7 @@ func fork(cmd *Command, args *Args) {
if err == nil {
currentProject, err := currentRemote.Project()
if err == nil {
if currentProject.SameAs(forkProject){
if currentProject.SameAs(forkProject) {
ui.Printf("existing remote: %s\n", newRemoteName)
return
}
Expand Down
4 changes: 2 additions & 2 deletions commands/init.go
Expand Up @@ -50,13 +50,13 @@ func transformInitArgs(args *Args) error {

var err error
dirToInit := "."
hasValueRegxp := regexp.MustCompile("^--(template|separate-git-dir|shared)$")
hasValueRegexp := regexp.MustCompile("^--(template|separate-git-dir|shared)$")

// Find the first argument that isn't related to any of the init flags.
// We assume this is the optional `directory` argument to git init.
for i := 0; i < args.ParamsSize(); i++ {
arg := args.Params[i]
if hasValueRegxp.MatchString(arg) {
if hasValueRegexp.MatchString(arg) {
i++
} else if !strings.HasPrefix(arg, "-") {
dirToInit = arg
Expand Down
40 changes: 19 additions & 21 deletions commands/issue.go
Expand Up @@ -359,43 +359,39 @@ func createIssue(cmd *Command, args *Args) {

gh := github.NewClient(project.Host)

var title string
var body string
var editor *github.Editor
messageBuilder := &github.MessageBuilder{
Filename: "ISSUE_EDITMSG",
Title: "issue",
}

messageBuilder.AddCommentedSection(fmt.Sprintf(`Creating an issue for %s
Write a message for this issue. The first block of
text is the title and the rest is the description.`, project))

if cmd.FlagPassed("message") {
title, body = readMsg(flagIssueMessage)
messageBuilder.Message = flagIssueMessage
messageBuilder.Edit = flagIssueEdit
} else if cmd.FlagPassed("file") {
title, body, editor, err = readMsgFromFile(flagIssueFile, flagIssueEdit, "ISSUE", "issue")
messageBuilder.Message, err = msgFromFile(flagIssueFile)
utils.Check(err)
messageBuilder.Edit = flagIssueEdit
} else {
cs := git.CommentChar()
message := strings.Replace(fmt.Sprintf(`
# Creating an issue for %s
#
# Write a message for this issue. The first block of
# text is the title and the rest is the description.
`, project), "#", cs, -1)
messageBuilder.Edit = true

workdir, _ := git.WorkdirName()
if workdir != "" {
template, err := github.ReadTemplate(github.IssueTemplate, workdir)
utils.Check(err)
if template != "" {
message = template + "\n" + message
messageBuilder.Message = template
}
}

editor, err := github.NewEditor("ISSUE", "issue", message)
utils.Check(err)

title, body, err = editor.EditTitleAndBody()
utils.Check(err)
}

if editor != nil {
defer editor.DeleteFile()
}
title, body, err := messageBuilder.Extract()
utils.Check(err)

if title == "" {
utils.Check(fmt.Errorf("Aborting creation due to empty issue title"))
Expand Down Expand Up @@ -427,4 +423,6 @@ func createIssue(cmd *Command, args *Args) {

printBrowseOrCopy(args, issue.HtmlUrl, flagIssueBrowse, flagIssueCopy)
}

messageBuilder.Cleanup()
}

0 comments on commit 420d212

Please sign in to comment.