Skip to content

Commit

Permalink
[app][git] current dir is removed from base path
Browse files Browse the repository at this point in the history
- the default clone behaviour does not require destination, so just an
  empty string is enough
  • Loading branch information
at15 committed Aug 10, 2016
1 parent 07b822e commit 0189e7f
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 13 deletions.
2 changes: 1 addition & 1 deletion app/git/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ It can do the following:
- [x] support default http clone url in `remote.go`'s `NewFromURL`
- [x] support default ssh clone url in `remote.go`'s `NewFromURL`
- [x] handle non default ssh port in `GetSSH`
- [x] detect workspace, config -> gopath -> ~~askuser input~~ current dir and clone to workspace
- [x] detect workspace, config -> gopath -> ~~askuser input~~ ~~current dir~~ and clone to workspace
- [ ] clone project by host order if using short url, and let user choose if there are same project on multiple hosts
- [ ] cleanup duplicated code `remote.go`, all the checking and error logging can be merged
2 changes: 1 addition & 1 deletion app/git/clone.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ func CloneFromURL(repoURL string) error {
// Clone clones a remote git repo
func Clone(r Remote) error {
log.Info(r.GetSSH())
log.Info("git clone " + r.GetSSH())
log.Info("git clone " + r.GetSSH() + " " + GetRepoBasePath() + "/" + r.Repo)
return nil
}
8 changes: 1 addition & 7 deletions app/git/workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,5 @@ func GetRepoBasePath() string {
if gopath != "" {
return filepath.FromSlash(gopath + "/src")
}
// use current folder as repo base path
cwd, err := os.Getwd()
if err != nil {
log.Warn("Can't get working directory " + err.Error())
return ""
}
return cwd
return ""
}
4 changes: 0 additions & 4 deletions app/git/workspace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,5 @@ func TestGetRepoBasePath(t *testing.T) {
viper.Set("git.repositories", "")
os.Setenv("GOPATH", p)
assert.Equal(filepath.FromSlash(p+"/src"), GetRepoBasePath())
// current dir is used if both config file and gopath are not set
os.Setenv("GOPATH", "")
cwd, _ := os.Getwd()
assert.Equal(cwd, GetRepoBasePath())

}

0 comments on commit 0189e7f

Please sign in to comment.