[PATCH v5] test: add database upgrade test from format version 1 to 2
[notmuch-archives.git] / 9f / b4102f411994484befd8cd9b11358ebfe4df51
1 Return-Path: <sojkam1@fel.cvut.cz>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 2A19840DDC2\r
6         for <notmuch@notmuchmail.org>; Sat, 20 Nov 2010 15:28:07 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -1.9\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5\r
12         tests=[BAYES_00=-1.9] autolearn=ham\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id Fy9O07VicXNe for <notmuch@notmuchmail.org>;\r
16         Sat, 20 Nov 2010 15:27:53 -0800 (PST)\r
17 Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36])\r
18         by olra.theworths.org (Postfix) with ESMTP id 51FE640DEEC\r
19         for <notmuch@notmuchmail.org>; Sat, 20 Nov 2010 15:27:53 -0800 (PST)\r
20 Received: from localhost (unknown [192.168.200.4])\r
21         by max.feld.cvut.cz (Postfix) with ESMTP id A9ADD19F3356;\r
22         Sun, 21 Nov 2010 00:27:52 +0100 (CET)\r
23 X-Virus-Scanned: IMAP AMAVIS\r
24 Received: from max.feld.cvut.cz ([192.168.200.1])\r
25         by localhost (styx.feld.cvut.cz [192.168.200.4]) (amavisd-new,\r
26         port 10044)\r
27         with ESMTP id b86LBBIQJ7FU; Sun, 21 Nov 2010 00:27:51 +0100 (CET)\r
28 Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34])\r
29         by max.feld.cvut.cz (Postfix) with ESMTP id EFE3E19F3363;\r
30         Sun, 21 Nov 2010 00:27:50 +0100 (CET)\r
31 Received: from wsheee.2x.cz (unknown [213.29.198.144])\r
32         (Authenticated sender: sojkam1)\r
33         by imap.feld.cvut.cz (Postfix) with ESMTPSA id ECD29FA003;\r
34         Sun, 21 Nov 2010 00:27:50 +0100 (CET)\r
35 Received: from wsh by wsheee.2x.cz with local (Exim 4.72)\r
36         (envelope-from <sojkam1@fel.cvut.cz>)\r
37         id 1PJwqU-0000Ox-Gx; Sun, 21 Nov 2010 00:27:50 +0100\r
38 From: Michal Sojka <sojkam1@fel.cvut.cz>\r
39 To: notmuch@notmuchmail.org\r
40 Subject: [PATCH 2/2] Include 'unread' tag only to mails in new\r
41 Date: Sun, 21 Nov 2010 00:27:40 +0100\r
42 Message-Id: <1290295660-1508-2-git-send-email-sojkam1@fel.cvut.cz>\r
43 X-Mailer: git-send-email 1.7.1.90.g94d6d4\r
44 In-Reply-To: <87pqtzk254.fsf@wsheee.2x.cz>\r
45 References: <87pqtzk254.fsf@wsheee.2x.cz>\r
46 X-BeenThere: notmuch@notmuchmail.org\r
47 X-Mailman-Version: 2.1.13\r
48 Precedence: list\r
49 List-Id: "Use and development of the notmuch mail system."\r
50         <notmuch.notmuchmail.org>\r
51 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
52         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
53 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
54 List-Post: <mailto:notmuch@notmuchmail.org>\r
55 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
56 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
57         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
58 X-List-Received-Date: Sat, 20 Nov 2010 23:28:07 -0000\r
59 \r
60 Ruben's previous patch fixed the problem that he experienced, but it\r
61 also caused the test "Removing info from filename leaves tags unchanged"\r
62 to fail. This is an attempt to make all tests to pass.\r
63 \r
64 The Ruben's change is restricted to be only effective in 'new' directory.\r
65 ---\r
66  lib/message.cc |    9 +++++++--\r
67  1 files changed, 7 insertions(+), 2 deletions(-)\r
68 \r
69 diff --git a/lib/message.cc b/lib/message.cc\r
70 index 996c1df..e769bf5 100644\r
71 --- a/lib/message.cc\r
72 +++ b/lib/message.cc\r
73 @@ -905,6 +905,7 @@ notmuch_message_maildir_flags_to_tags (notmuch_message_t *message)\r
74      char *combined_flags = talloc_strdup (message, "");\r
75      unsigned i;\r
76      int seen_maildir_info = 0;\r
77 +    const char *dir;\r
78  \r
79      for (filenames = notmuch_message_get_filenames (message);\r
80          notmuch_filenames_valid (filenames);\r
81 @@ -912,13 +913,17 @@ notmuch_message_maildir_flags_to_tags (notmuch_message_t *message)\r
82      {\r
83         filename = notmuch_filenames_get (filenames);\r
84  \r
85 -       if (! _filename_is_in_maildir(filename))\r
86 +       dir = _filename_is_in_maildir(filename);\r
87 +       if (! dir)\r
88             continue;\r
89 -       seen_maildir_info = 1;\r
90 +\r
91 +       if (STRNCMP_LITERAL (dir, "new/") == 0)\r
92 +           seen_maildir_info = 1;\r
93  \r
94         flags = strstr (filename, ":2,");\r
95         if (! flags)\r
96             continue;\r
97 +       seen_maildir_info = 1;\r
98  \r
99         flags += 3;\r
100  \r
101 -- \r
102 1.7.1.90.g94d6d4\r
103 \r