Skip to content

Commit

Permalink
Fixed review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
idanovo committed Mar 18, 2024
1 parent 2e82348 commit a35f28c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion esti/lakectl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ func TestLakectlFsUpload(t *testing.T) {
})
t.Run("single_file_with_recursive", func(t *testing.T) {
vars["FILE_PATH"] = "data/ro/ro_1k.0"
RunCmdAndVerifyFailure(t, Lakectl()+" fs upload --recursive -s files/ro_1k lakefs://"+repoName+"/"+mainBranch+"/"+vars["FILE_PATH"], false, "\ndiff 'local://files/ro_1k/' <--> 'lakefs://${REPO}/${BRANCH}/${FILE_PATH}'...\nmkdir /lakefs/esti/files/ro_1k: not a directory\nError executing command.\n", vars)
RunCmdAndVerifyFailure(t, Lakectl()+" fs upload --recursive -s files/ro_1k lakefs://"+repoName+"/"+mainBranch+"/"+vars["FILE_PATH"], false, "\ndiff 'local://files/ro_1k/' <--> 'lakefs://${REPO}/${BRANCH}/${FILE_PATH}'...\nlstat files/ro_1k/: not a directory\nError executing command.\n", vars)
})
t.Run("dir", func(t *testing.T) {
vars["FILE_PATH"] = "data/ro/"
Expand Down
4 changes: 2 additions & 2 deletions pkg/block/local/walker.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"github.com/treeverse/lakefs/pkg/block/params"
)

const CacheDirName = "_lakefs_cache"
const cacheDirName = "_lakefs_cache"

type Walker struct {
mark block.Mark
Expand All @@ -33,7 +33,7 @@ func NewLocalWalker(params params.Local) *Walker {
// without Path, we do not keep cache - will make walker very slow
var cacheLocation string
if params.Path != "" {
cacheLocation = filepath.Join(params.Path, CacheDirName)
cacheLocation = filepath.Join(params.Path, cacheDirName)
}
return &Walker{
mark: block.Mark{HasMore: true},
Expand Down
7 changes: 3 additions & 4 deletions pkg/local/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ func DiffLocalWithHead(left <-chan apigen.ObjectStats, rightPath string) (Change
return nil, err
}
uri := url.URL{Scheme: "local", Path: absPath}
adapter, err := local.NewAdapter(absPath, local.WithRemoveEmptyDir(false), local.WithAllowedExternalPrefixes([]string{"/"}))
adapter, err := local.NewAdapter("", local.WithRemoveEmptyDir(false), local.WithAllowedExternalPrefixes([]string{absPath}))
if err != nil {
return nil, err
}
Expand All @@ -215,11 +215,10 @@ func DiffLocalWithHead(left <-chan apigen.ObjectStats, rightPath string) (Change
if err != nil {
return err
}
if info.IsDir() || diffShouldIgnore(info.Name()) || strings.HasPrefix(e.RelativeKey, local.CacheDirName) {
if info.IsDir() || diffShouldIgnore(info.Name()) {
return nil
}
filePath := e.RelativeKey
localPath := strings.TrimPrefix(filePath, rightPath)
localPath := e.RelativeKey
localPath = strings.TrimPrefix(localPath, string(filepath.Separator))
localPath = filepath.ToSlash(localPath) // normalize to use "/" always

Expand Down

0 comments on commit a35f28c

Please sign in to comment.