mirror of https://github.com/databricks/cli.git
fix API response path
This commit is contained in:
parent
0905d36e9d
commit
0c00ddef72
|
@ -69,11 +69,12 @@ func FetchRepositoryInfoAPI(ctx context.Context, path vfs.Path, w *databricks.Wo
|
|||
gi := response.GitInfo
|
||||
// XXX log warning if missing
|
||||
if gi != nil {
|
||||
fixedPath := fixResponsePath(gi.Path)
|
||||
return GitRepositoryInfo{
|
||||
OriginURL: gi.URL,
|
||||
LatestCommit: gi.HeadCommitID,
|
||||
CurrentBranch: gi.Branch,
|
||||
WorktreeRoot: vfs.MustNew(gi.Path),
|
||||
WorktreeRoot: vfs.MustNew(fixedPath),
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
@ -82,6 +83,13 @@ func FetchRepositoryInfoAPI(ctx context.Context, path vfs.Path, w *databricks.Wo
|
|||
}, nil
|
||||
}
|
||||
|
||||
func fixResponsePath(path string) string {
|
||||
if strings.HasPrefix(path, "/Users/") {
|
||||
return "/Workspace/" + path
|
||||
}
|
||||
return path
|
||||
}
|
||||
|
||||
func FetchRepositoryInfoDotGit(ctx context.Context, path vfs.Path) (GitRepositoryInfo, error) {
|
||||
rootDir, err := vfs.FindLeafInTree(path, GitDirectoryName)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue