databricks-cli/cmd
Pieter Noordhuis 424499ec1d
Abstract over filesystem interaction with libs/vfs (#1452)
## Changes

Introduce `libs/vfs` for an implementation of `fs.FS` and friends that
_includes_ the absolute path it is anchored to.

This is needed for:
1. Intercepting file operations to inject custom logic (e.g., logging,
access control).
2. Traversing directories to find specific leaf directories (e.g.,
`.git`).
3. Converting virtual paths to OS-native paths.

Options 2 and 3 are not possible with the standard `fs.FS` interface.
They are needed such that we can provide an instance to the sync package
and still detect the containing `.git` directory and convert paths to
native paths.

This change focuses on making the following packages use `vfs.Path`:
* libs/fileset
* libs/git
* libs/sync

All entries returned by `fileset.All` are now slash-separated. This has
2 consequences:
* The sync snapshot now always uses slash-separated paths
* We don't need to call `filepath.FromSlash` as much as we did

## Tests

* All unit tests pass
* All integration tests pass
* Manually confirmed that a deployment made on Windows by a previous
version of the CLI can be deployed by a new version of the CLI while
retaining the validity of the local sync snapshot as well as the remote
deployment state.
2024-05-30 07:41:50 +00:00
..
account Update Go SDK to v0.41.0 (#1445) 2024-05-22 07:41:32 +00:00
api Add usage string when command fails with incorrect arguments (#1276) 2024-03-12 14:12:34 +00:00
auth Improve token refresh flow (#1434) 2024-05-16 10:22:09 +00:00
bundle Fix bundle documentation URL (#1399) 2024-04-25 11:25:26 +00:00
configure Filter out system clusters for `--configure-cluster` (#1031) 2023-11-30 09:59:11 +00:00
fs Add usage string when command fails with incorrect arguments (#1276) 2024-03-12 14:12:34 +00:00
labs Improve token refresh flow (#1434) 2024-05-16 10:22:09 +00:00
root Improve token refresh flow (#1434) 2024-05-16 10:22:09 +00:00
sync Abstract over filesystem interaction with libs/vfs (#1452) 2024-05-30 07:41:50 +00:00
version Add usage string when command fails with incorrect arguments (#1276) 2024-03-12 14:12:34 +00:00
workspace Update Go SDK to v0.41.0 (#1445) 2024-05-22 07:41:32 +00:00
cmd.go Add `databricks labs` command group (#914) 2023-11-17 12:47:37 +00:00