-
Notifications
You must be signed in to change notification settings - Fork 245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a Git-backed storage.ReadBucket
via storagegit
#2114
Changes from 1 commit
adcb9fa
e1be76c
4abbae1
272ef82
880c8bb
c057bd6
4d06edc
9e154b1
29ab534
90c274b
41b3a97
ddc7fcc
73ec4cb
41b5e6b
07fb6c3
45e3331
46a3c26
05f3da7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,7 +95,7 @@ func (b *bucket) Stat(ctx context.Context, path string) (storage.ObjectInfo, err | |
|
||
func (b *bucket) Walk(ctx context.Context, prefix string, f func(storage.ObjectInfo) error) error { | ||
walkChecker := storageutil.NewWalkChecker() | ||
saquibmian marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return b.walk(b.root, b.objectReader, prefix, func(path string, te git.TreeEntry) error { | ||
return b.walk(b.root, b.objectReader, prefix, func(path string, te git.Node) error { | ||
saquibmian marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if err := walkChecker.Check(ctx); err != nil { | ||
return err | ||
} | ||
|
@@ -107,7 +107,7 @@ func (b *bucket) walk( | |
root git.Tree, | ||
objectReader git.ObjectReader, | ||
prefix string, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess that partial prefixes won't work then, so for a valid dir There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's correct, that's be design for buckets. The prefix is a segment prefix, but a path key prefix. |
||
walkFn func(string, git.TreeEntry) error, | ||
walkFn func(string, git.Node) error, | ||
) error { | ||
prefix = normalpath.Normalize(prefix) | ||
if prefix != "." { | ||
|
@@ -131,9 +131,9 @@ func walkTree( | |
root git.Tree, | ||
saquibmian marked this conversation as resolved.
Show resolved
Hide resolved
|
||
objectReader git.ObjectReader, | ||
prefix string, | ||
walkFn func(string, git.TreeEntry) error, | ||
walkFn func(string, git.Node) error, | ||
) error { | ||
for _, entry := range root.Entries() { | ||
for _, entry := range root.Nodes() { | ||
saquibmian marked this conversation as resolved.
Show resolved
Hide resolved
|
||
path := normalpath.Join(prefix, entry.Name()) | ||
switch entry.Mode() { | ||
case git.ModeFile, git.ModeExe, git.ModeSymlink: | ||
saquibmian marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the left padded zeroes in all of them? I think at least one zero can be removed in all of them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, these are octal literals :)