From 0c00ddef72dbd5f09080f837f470b7ef803c58f3 Mon Sep 17 00:00:00 2001 From: Denis Bilenko Date: Thu, 28 Nov 2024 16:54:04 +0100 Subject: [PATCH] fix API response path --- libs/git/info.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libs/git/info.go b/libs/git/info.go index e5ef77eb4..52dade81e 100644 --- a/libs/git/info.go +++ b/libs/git/info.go @@ -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 {