mirror of
https://github.com/restic/restic.git
synced 2026-09-24 21:10:30 +00:00
Merge pull request #2584 from greatroar/mount-cache-uid-gid
Cache uid and gid for top directories in internal/fuse
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
package fuse
|
||||
|
||||
import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/restic/restic/internal/debug"
|
||||
@@ -37,6 +38,8 @@ type Root struct {
|
||||
lastCheck time.Time
|
||||
|
||||
*MetaDir
|
||||
|
||||
uid, gid uint32
|
||||
}
|
||||
|
||||
// ensure that *Root implements these interfaces
|
||||
@@ -56,6 +59,11 @@ func NewRoot(ctx context.Context, repo restic.Repository, cfg Config) (*Root, er
|
||||
blobSizeCache: NewBlobSizeCache(ctx, repo.Index()),
|
||||
}
|
||||
|
||||
if !cfg.OwnerIsRoot {
|
||||
root.uid = uint32(os.Getuid())
|
||||
root.gid = uint32(os.Getgid())
|
||||
}
|
||||
|
||||
entries := map[string]fs.Node{
|
||||
"snapshots": NewSnapshotsDir(root, fs.GenerateDynamicInode(root.inode, "snapshots"), "", ""),
|
||||
"tags": NewTagsDir(root, fs.GenerateDynamicInode(root.inode, "tags")),
|
||||
|
||||
Reference in New Issue
Block a user