isync

mailbox synchronization program
git clone https://git.code.sf.net/p/isync/isync
Log | Files | Refs | README | LICENSE

commit 44ad8f036165a5086298de26f5a75fd6588a0da7
parent e70a20477cde4b6ef4fd6608b5197a66d8891a69
Author: Oswald Buddenhagen <ossi@users.sf.net>
Date:   Thu, 13 Jan 2022 14:05:45 +0100

handle mixing simple and compound sync options more explicitly

Diffstat:
Msrc/config.c | 22+++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/src/config.c b/src/config.c @@ -324,18 +324,30 @@ merge_ops( int cops, int ops[], const char *chan_name ) return 1; } // Mix in non-overlapping Push/Pull or New, etc. - // Do the ops first, so e.g. PullNew Push Flags will error out. - ops[F] |= cops & OP_MASK_TYPE; - ops[N] |= cops & OP_MASK_TYPE; if (cops & XOP_PULL) { + if (cops & (XOP_PUSH | OP_MASK_TYPE)) { + // Mixing instant effect flags with row/column flags would be confusing, + // so instead everything is instant effect. This implies that mixing + // direction with type would cause overlaps, so PullNew Push Delete, etc. + // is invalid. + // Pull Push covers everything, so makes no sense to combine. + ivl: + error( "Invalid combination of simple and compound Sync options %s.\n", + channel_str( chan_name ) ); + return 1; + } if (ops[N] & OP_MASK_TYPE) goto ovl; ops[N] |= OP_MASK_TYPE; - } - if (cops & XOP_PUSH) { + } else if (cops & XOP_PUSH) { + if (cops & OP_MASK_TYPE) + goto ivl; if (ops[F] & OP_MASK_TYPE) goto ovl; ops[F] |= OP_MASK_TYPE; + } else { + ops[F] |= cops & OP_MASK_TYPE; + ops[N] |= cops & OP_MASK_TYPE; } } else if (cops & (OP_MASK_TYPE | XOP_MASK_DIR)) { // Pull New, etc. if (ops[F] & XOP_TYPE_NOOP)