From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 6DC436DE0F35 for ; Tue, 2 Apr 2019 18:28:56 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.022 X-Spam-Level: X-Spam-Status: No, score=-0.022 tagged_above=-999 required=5 tests=[AWL=-0.021, SPF_PASS=-0.001] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EXCb3OEhk7aF for ; Tue, 2 Apr 2019 18:28:55 -0700 (PDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id 4349A6DE0A6C for ; Tue, 2 Apr 2019 18:28:55 -0700 (PDT) Received: from remotemail by fethera.tethera.net with local (Exim 4.89) (envelope-from ) id 1hBUhu-0004c7-Rr; Tue, 02 Apr 2019 21:28:50 -0400 Received: (nullmailer pid 3805 invoked by uid 1000); Wed, 03 Apr 2019 01:28:48 -0000 From: David Bremner To: Michael J Gruber , notmuch@notmuchmail.org Subject: Re: [PATCH v2] introduce new.rename_tags for renamed (moved) messages In-Reply-To: <587fa8b9dbaa8b8583e83eaa3825e74a24b5ba20.1537284357.git.git@grubix.eu> References: <87lg8cizmp.fsf@tethera.net> <587fa8b9dbaa8b8583e83eaa3825e74a24b5ba20.1537284357.git.git@grubix.eu> Date: Tue, 02 Apr 2019 22:28:48 -0300 Message-ID: <87tvffev1r.fsf@tethera.net> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Apr 2019 01:28:56 -0000 Michael J Gruber writes: > Changed since v1: > - acted upon review comments (blank line, _thaw position) > - added 3 tests (mv, cp, cp-rm) > - treat copies as renames, too Apologies for taking so long to get back to this. As a general comment, does this same tagging "hook" make sense for notmuch-insert as well? That's not meant to delay this series, just food for thought. > The reasoning behind the latter is: If you use a mapping between folders > and tags, then a copy to an additional location should alert the > "mapper" to update that mapping; that's what the rename tag is for. > Maybe it should be named "renew" after all? But it's just the > folder/label name that is/needs to be renewed, nothing else about the > message. It _is_ confusing to use rename to refer to copies as well as actual renames. I don't find "renew" better though. I wonder about something like "new.new_path_tags". That's a bit weird with the repeated "new", I grant you. Maybe "new.path_change_tags" > +**new.rename_tags** > + A list of tags that will be added to all messages which > + **notmuch new** identifies as renamed (moved). > + > + Default: not set. > + Even if the name stays the same, you'll need to update the blurb to mention copies. > +void > +notmuch_config_set_rename_tags (notmuch_config_t *config, > + const char *rename_tags[], > + size_t length); > + If this is only used in notmuch-config.c, I don't think it needs to be exported (at least until they are needed). Of course it's also worth asking if we want to call them notmuch-setup.c; I suspect not doing so is OK, but I haven't checked in detail. > diff --git a/test/T340-maildir-sync.sh b/test/T340-maildir-sync.sh These tests don't really have to do with maildir syncing (in the sense that notmuch uses the word), that's about syncing maildir flags to notmuch tags. I think they'd be better in T050-new.sh. > index 7fece5f2..44f32ad2 100755 > --- a/test/T340-maildir-sync.sh > +++ b/test/T340-maildir-sync.sh > @@ -196,6 +196,36 @@ notmuch search 'subject:"File in new"' | notmuch_search_sanitize > output > test_expect_equal "$(< output)" \ > "thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; File in new/ (test unread)" > > +test_begin_subtest "Renamed files get default renamed tags" > +OLDCONFIG=$(notmuch config get new.rename_tags) > +notmuch config set new.rename_tags "renamed" > +mv $MAIL_DIR/new/file-in-new $MAIL_DIR/new/file-in-new-renamed > +notmuch new > +notmuch config set new.rename_tags $OLDCONFIG > +notmuch search 'subject:"File in new"' | notmuch_search_sanitize > output > +test_expect_equal "$(< output)" \ > +"thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; File in new/ (renamed test unread)" Most of the newer tests use the pattern cat << EOF > EXPECTED thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; File in new/ (renamed test unread) EOF test_expect_equal_file EXPECTED output we also mainly use OUTPUT for the file, and $output as a variable containing output. Unfortunately the searches would need to be updated as well to work in T050-new.