remove logs and whitespace

This commit is contained in:
Tejas Sharma 2025-07-21 11:50:31 -07:00
parent 623dbc2f01
commit fc24528603
No known key found for this signature in database
GPG key ID: 2A079F6B67CA03C3
2 changed files with 1 additions and 4 deletions

View file

@ -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"})

View file

@ -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
}
}