Set WorktreeRoot to sync root outside git repo (#2197)

## Changes
If git is not detected, set default worktree root to sync root.
Otherwise NewFileSet/View raise an error about worktree root being
outside view root in acceptance/bundle/sync-paths-dotdot.

This behavior is introduced in
https://github.com/databricks/cli/pull/1945

Stacked on https://github.com/databricks/cli/pull/2202

## Tests
Existing tests.
This commit is contained in:
Denis Bilenko 2025-01-22 11:50:13 +01:00 committed by GitHub
parent c224be5c1f
commit e9902036b8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 6 deletions

View File

@ -1,11 +1,7 @@
Error: path "$TMPDIR_PARENT" is not within repository root "$TMPDIR"
Name: test-bundle
Target: default
Workspace:
User: $USERNAME
Path: /Workspace/Users/$USERNAME/.bundle/test-bundle/default
Found 1 error
Exit code: 1
Validation OK!

View File

@ -32,7 +32,7 @@ func (m *loadGitDetails) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagn
}
if info.WorktreeRoot == "" {
b.WorktreeRoot = b.BundleRoot
b.WorktreeRoot = b.SyncRoot
} else {
b.WorktreeRoot = vfs.MustNew(info.WorktreeRoot)
}