mirror of https://github.com/perkeep/perkeep.git
pkg/fs: add sha224-xx...xx hint dir
And fix sha1 assumption for file name. Fixes #1169 Change-Id: I2a907c6cf11631a4a86268a4dc393c64402b5d35
This commit is contained in:
parent
f95d49f99c
commit
5789ec4b8d
|
@ -35,6 +35,7 @@ Execute the following commands in a shell to mount a Perkeep directory in your h
|
|||
recent
|
||||
roots
|
||||
sha1-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
sha224-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
tag
|
||||
|
||||
|
||||
|
@ -70,10 +71,10 @@ The at directory contains full instructions in the README.txt file contained wit
|
|||
|
||||
Accessing a specific Node
|
||||
|
||||
You can directly access a specific directory by using the full sha1 identifier.
|
||||
You can directly access a specific directory by using the full sha224 identifier.
|
||||
|
||||
cd ~/Perkeep
|
||||
cd sha1-xxx # where xxx is the full 16 character identifier
|
||||
cd sha224-xxx # where xxx is the full 56 character identifier
|
||||
|
||||
|
||||
Full Command Line Usage
|
||||
|
|
|
@ -217,7 +217,7 @@ func TestRoot(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
sort.Strings(names)
|
||||
want := []string{"WELCOME.txt", "at", "date", "recent", "roots", "sha1-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "tag", "versions"}
|
||||
want := []string{"WELCOME.txt", "at", "date", "recent", "roots", "sha1-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "sha224-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "tag", "versions"}
|
||||
if !reflect.DeepEqual(names, want) {
|
||||
t.Errorf("root directory = %q; want %q", names, want)
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@ func (n *recentDir) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) {
|
|||
if ext == "" && ccMeta.File != nil && strings.HasSuffix(ccMeta.File.MIMEType, "image/jpeg") {
|
||||
ext = ".jpg"
|
||||
}
|
||||
name = strings.TrimPrefix(ccMeta.BlobRef.String(), "sha1-")[:10] + ext
|
||||
name = strings.TrimPrefix(ccMeta.BlobRef.String(), ccMeta.BlobRef.HashName()+"-")[:10] + ext
|
||||
if n.ents[name] != nil {
|
||||
continue
|
||||
}
|
||||
|
|
|
@ -64,6 +64,7 @@ func (n *root) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) {
|
|||
{Name: "roots"},
|
||||
{Name: "at"},
|
||||
{Name: "sha1-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"},
|
||||
{Name: "sha224-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"},
|
||||
{Name: "versions"},
|
||||
}, nil
|
||||
}
|
||||
|
@ -123,6 +124,8 @@ func (n *root) Lookup(ctx context.Context, name string) (fs.Node, error) {
|
|||
return n.getVersionsDir(), nil
|
||||
case "sha1-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx":
|
||||
return notImplementDirNode{}, nil
|
||||
case "sha224-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx":
|
||||
return notImplementDirNode{}, nil
|
||||
case ".camli_fs_stats":
|
||||
return statsDir{}, nil
|
||||
case "mach_kernel", ".hidden", "._.":
|
||||
|
|
Loading…
Reference in New Issue