Skip to content
This repository has been archived by the owner on May 27, 2022. It is now read-only.

Commit

Permalink
Merge pull request #193 from getantibody/fix-repo-not-found
Browse files Browse the repository at this point in the history
fixed asking for the username when repo not found
  • Loading branch information
caarlos0 authored Sep 10, 2017
2 parents fa2ce0d + 5eb40a4 commit 171c1c0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
8 changes: 4 additions & 4 deletions project/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ func NewGit(cwd, line string) Project {

func (g gitProject) Download() error {
if _, err := os.Stat(g.folder); os.IsNotExist(err) {
if bts, err := exec.Command(
"git", "clone",
var cmd = exec.Command("git", "clone",
"--recursive",
"--depth", "1",
"-b", g.Version,
g.URL,
g.folder,
).CombinedOutput(); err != nil {
g.folder)
cmd.Env = append(cmd.Env, "GIT_TERMINAL_PROMPT=0")
if bts, err := cmd.CombinedOutput(); err != nil {
log.Println("git clone failed for", g.URL, string(bts))
return err
}
Expand Down
9 changes: 8 additions & 1 deletion project/git_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,14 @@ func TestUpdateNonExistentLocalRepo(t *testing.T) {
assert.Error(repo.Update())
}

func TestDownloadNonExistenRepo(t *testing.T) {
func TestDownloadNonExistentRepo(t *testing.T) {
var assert = assert.New(t)
home := home()
repo := project.NewGit(home, "caarlos0/not-a-real-repo")
assert.Error(repo.Download())
}

func TestDownloadMalformedRepo(t *testing.T) {
assert := assert.New(t)
home := home()
repo := project.NewGit(home, "doesn-not-exist-really branch:also-nope")
Expand Down

0 comments on commit 171c1c0

Please sign in to comment.