mirror of
https://github.com/x-motemen/ghq.git
synced 2026-09-10 07:26:27 -04:00
remove logs and whitespace
This commit is contained in:
parent
623dbc2f01
commit
fc24528603
|
|
@ -194,7 +194,7 @@ func TestCommandGet(t *testing.T) {
|
|||
tmpd := newTempDir(t)
|
||||
t.Cleanup(gitconfig.WithConfig(t, fmt.Sprintf(`
|
||||
[ghq "https://github.com/motemen"]
|
||||
root = "%s"
|
||||
root = "%s"
|
||||
`, filepath.ToSlash(tmpd))))
|
||||
app.Run([]string{"", "get", "motemen/ghq-test-repo"})
|
||||
|
||||
|
|
|
|||
|
|
@ -148,15 +148,12 @@ func (g *getter) getRemoteRepository(remote RemoteRepository, branch string) (ge
|
|||
|
||||
func detectLocalRepoRoot(remotePath, repoPath string) string {
|
||||
remotePath = strings.TrimSuffix(strings.TrimSuffix(remotePath, "/"), ".git")
|
||||
logger.Log("remotePath", fmt.Sprintf("%s", remotePath))
|
||||
repoPath = strings.TrimSuffix(strings.TrimSuffix(repoPath, "/"), ".git")
|
||||
logger.Log("repoPath", fmt.Sprintf("%s", repoPath))
|
||||
pathParts := strings.Split(repoPath, "/")
|
||||
pathParts = pathParts[1:]
|
||||
for i := 0; i < len(pathParts); i++ {
|
||||
subPath := "/" + path.Join(pathParts[i:]...)
|
||||
if subIdx := strings.Index(remotePath, subPath); subIdx >= 0 {
|
||||
logger.Log("Returning from detectLocalRepoRoot", fmt.Sprintf("subidx %d, subPath %s", subIdx, subPath))
|
||||
return remotePath[0:subIdx] + subPath
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue