--- /dev/null
+Return-Path: <jani@nikula.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 60B996DE0318\r
+ for <notmuch@notmuchmail.org>; Sun, 10 Apr 2016 12:44:55 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.558\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.558 tagged_above=-999 required=5 tests=[AWL=0.162,\r
+ DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7,\r
+ RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id 8oAW6XbvSnxj for <notmuch@notmuchmail.org>;\r
+ Sun, 10 Apr 2016 12:44:47 -0700 (PDT)\r
+Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com\r
+ [74.125.82.66]) by arlo.cworth.org (Postfix) with ESMTPS id 0B3AC6DE02C6 for\r
+ <notmuch@notmuchmail.org>; Sun, 10 Apr 2016 12:44:41 -0700 (PDT)\r
+Received: by mail-wm0-f66.google.com with SMTP id a140so16811877wma.2\r
+ for <notmuch@notmuchmail.org>; Sun, 10 Apr 2016 12:44:41 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=nikula-org.20150623.gappssmtp.com; s=20150623;\r
+ h=from:to:cc:subject:date:message-id:in-reply-to:references;\r
+ bh=86TDUTEbDlV8CGHHO1dqy+YaduKPRR0cn6tN5KNFINk=;\r
+ b=1jMKvYBbAtqCdt2xNtCoh2do7nbBNPawWNYl+RLFW87o5VBZW99QLbKwqkMCVOfuka\r
+ IIamqMJOG7l+KWWrlRb1emt/Q3wKyFjGnuPcwPZ1OhYPd+Icbs/PmLGZ/f0iQ6nSWBfo\r
+ PV7assZYyDH4fmN6Gri3iMkHzCpTgQCJu44pKMcKtQP2Wbp1XNq9tTHNBgrkvF9NlFxn\r
+ r/UzzpIrw+eTZvnL7KjBaLKPTFIqqfRpoBHMDKnBT1/EezTUWjS13RTZv2HQyQq/f9gQ\r
+ OLqR9xKOvOnr4Kd5Ir7anbkkpG+6PI+Up5Yd6BIXpKCh9DzKJHic2S5cjt+oCSuPNHji\r
+ aBZA==\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\r
+ :references;\r
+ bh=86TDUTEbDlV8CGHHO1dqy+YaduKPRR0cn6tN5KNFINk=;\r
+ b=GczvSy4sDCDWBql/puVaTzAk8XIKfm3CFgFGlgdTbWrzvTksn1O4oRfhgFsAcTM6bE\r
+ RIcxHImHQLdP7AFD/UYe5ov93N8WQj3Lhjsb8QotjlDJWn2uPK+XsLdyBlWCJFCFns3M\r
+ 7V/ljIhPSNlWgdMXwMJ39YzQxqsV+1GAQOAew/AfUZkzZjI956cR5AwZykZMaDQl763g\r
+ Lnt0uRxZnIk/HBWdUglIjJliHElXErH4avagMbuHHx88xhblqumLpuvrCoZsgUJJY7s/\r
+ NCWjniQWsVFhn5E6cBzhzgBXxt327Z461S9zRp5lMu6ECbhnRACZDubh48UQpaX/pmfN\r
+ w0Vg==\r
+X-Gm-Message-State:\r
+ AD7BkJLEmTGFtnsdAtLI0ADgZxsUe/MlHs+vysbY4iRtox3BpzOafehMaFxFdV5m5TARSA==\r
+X-Received: by 10.28.58.77 with SMTP id h74mr14264048wma.82.1460317480615;\r
+ Sun, 10 Apr 2016 12:44:40 -0700 (PDT)\r
+Received: from localhost (mobile-access-bcee7f-102.dhcp.inet.fi.\r
+ [188.238.127.102])\r
+ by smtp.gmail.com with ESMTPSA id o128sm13596863wmb.19.2016.04.10.12.44.39\r
+ (version=TLSv1/SSLv3 cipher=OTHER);\r
+ Sun, 10 Apr 2016 12:44:40 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 3/3] lib: clean up _notmuch_database_split_path\r
+Date: Sun, 10 Apr 2016 22:43:23 +0300\r
+Message-Id: <1460317403-13714-3-git-send-email-jani@nikula.org>\r
+X-Mailer: git-send-email 2.1.4\r
+In-Reply-To: <1460317403-13714-1-git-send-email-jani@nikula.org>\r
+References: <1460317403-13714-1-git-send-email-jani@nikula.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 10 Apr 2016 19:44:55 -0000\r
+\r
+Make the logic it a bit easier to read. No functional changes.\r
+---\r
+ lib/database.cc | 17 +++--------------\r
+ 1 file changed, 3 insertions(+), 14 deletions(-)\r
+\r
+diff --git a/lib/database.cc b/lib/database.cc\r
+index b8486f7d5271..c8c5e26106ad 100644\r
+--- a/lib/database.cc\r
++++ b/lib/database.cc\r
+@@ -1761,18 +1761,11 @@ _notmuch_database_split_path (void *ctx,\r
+ slash = path + strlen (path) - 1;\r
+ \r
+ /* First, skip trailing slashes. */\r
+- while (slash != path) {\r
+- if (*slash != '/')\r
+- break;\r
+-\r
++ while (slash != path && *slash == '/')\r
+ --slash;\r
+- }\r
+ \r
+ /* Then, find a slash. */\r
+- while (slash != path) {\r
+- if (*slash == '/')\r
+- break;\r
+-\r
++ while (slash != path && *slash != '/') {\r
+ if (basename)\r
+ *basename = slash;\r
+ \r
+@@ -1780,12 +1773,8 @@ _notmuch_database_split_path (void *ctx,\r
+ }\r
+ \r
+ /* Finally, skip multiple slashes. */\r
+- while (slash != path) {\r
+- if (*(slash - 1) != '/')\r
+- break;\r
+-\r
++ while (slash != path && *(slash - 1) == '/')\r
+ --slash;\r
+- }\r
+ \r
+ if (slash == path) {\r
+ if (directory)\r
+-- \r
+2.1.4\r
+\r