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
|
gi := response.GitInfo
|
||||||
// XXX log warning if missing
|
// XXX log warning if missing
|
||||||
if gi != nil {
|
if gi != nil {
|
||||||
|
fixedPath := fixResponsePath(gi.Path)
|
||||||
return GitRepositoryInfo{
|
return GitRepositoryInfo{
|
||||||
OriginURL: gi.URL,
|
OriginURL: gi.URL,
|
||||||
LatestCommit: gi.HeadCommitID,
|
LatestCommit: gi.HeadCommitID,
|
||||||
CurrentBranch: gi.Branch,
|
CurrentBranch: gi.Branch,
|
||||||
WorktreeRoot: vfs.MustNew(gi.Path),
|
WorktreeRoot: vfs.MustNew(fixedPath),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,6 +83,13 @@ func FetchRepositoryInfoAPI(ctx context.Context, path vfs.Path, w *databricks.Wo
|
||||||
}, nil
|
}, 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) {
|
func FetchRepositoryInfoDotGit(ctx context.Context, path vfs.Path) (GitRepositoryInfo, error) {
|
||||||
rootDir, err := vfs.FindLeafInTree(path, GitDirectoryName)
|
rootDir, err := vfs.FindLeafInTree(path, GitDirectoryName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue