all: Add receive only folder type (#5027)

Adds a receive only folder type that does not send changes, and where the user can optionally revert local changes. Also changes some of the icons to make the three folder types distinguishable.
This commit is contained in:
Jakob Borg
2018-07-12 11:15:57 +03:00
committed by GitHub
parent 1a6c7587c2
commit f822b10550
29 changed files with 1136 additions and 144 deletions

View File

@@ -68,6 +68,8 @@ type Config struct {
ProgressTickIntervalS int
// Whether to use large blocks for large files or the old standard of 128KiB for everything.
UseLargeBlocks bool
// Local flags to set on scanned files
LocalFlags uint32
}
type CurrentFiler interface {
@@ -367,10 +369,11 @@ func (w *walker) walkRegular(ctx context.Context, relPath string, info fs.FileIn
ModifiedBy: w.ShortID,
Size: info.Size(),
RawBlockSize: int32(blockSize),
LocalFlags: w.LocalFlags,
}
if hasCurFile {
if curFile.IsEquivalent(f, w.IgnorePerms, true) {
if curFile.IsEquivalentOptional(f, w.IgnorePerms, true, w.LocalFlags) {
return nil
}
if curFile.ShouldConflict() {
@@ -407,10 +410,11 @@ func (w *walker) walkDir(ctx context.Context, relPath string, info fs.FileInfo,
ModifiedS: info.ModTime().Unix(),
ModifiedNs: int32(info.ModTime().Nanosecond()),
ModifiedBy: w.ShortID,
LocalFlags: w.LocalFlags,
}
if ok {
if cf.IsEquivalent(f, w.IgnorePerms, true) {
if cf.IsEquivalentOptional(f, w.IgnorePerms, true, w.LocalFlags) {
return nil
}
if cf.ShouldConflict() {
@@ -463,10 +467,11 @@ func (w *walker) walkSymlink(ctx context.Context, relPath string, dchan chan pro
NoPermissions: true, // Symlinks don't have permissions of their own
SymlinkTarget: target,
ModifiedBy: w.ShortID,
LocalFlags: w.LocalFlags,
}
if ok {
if cf.IsEquivalent(f, w.IgnorePerms, true) {
if cf.IsEquivalentOptional(f, w.IgnorePerms, true, w.LocalFlags) {
return nil
}
if cf.ShouldConflict() {