[PATCH v2] nmbug-status: Use 'show-ref --heads' for loading configs
authorW. Trevor King <wking@tremily.us>
Sun, 15 Mar 2015 09:46:57 +0000 (02:46 +1700)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 21:48:29 +0000 (14:48 -0700)
7a/18e2accfbd68c4bf7639455487fa00896241cc [new file with mode: 0644]

diff --git a/7a/18e2accfbd68c4bf7639455487fa00896241cc b/7a/18e2accfbd68c4bf7639455487fa00896241cc
new file mode 100644 (file)
index 0000000..68f176b
--- /dev/null
@@ -0,0 +1,146 @@
+Return-Path: <wking@tremily.us>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 01CE8431FC4\r
+       for <notmuch@notmuchmail.org>; Sun, 15 Mar 2015 02:47:09 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 2.338\r
+X-Spam-Level: **\r
+X-Spam-Status: No, score=2.338 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       DNS_FROM_AHBL_RHSBL=2.438, RCVD_IN_DNSWL_NONE=-0.0001]\r
+       autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id CjJMek3gPs6t for <notmuch@notmuchmail.org>;\r
+       Sun, 15 Mar 2015 02:47:06 -0700 (PDT)\r
+Received: from resqmta-ch2-01v.sys.comcast.net\r
+       (resqmta-ch2-01v.sys.comcast.net [69.252.207.33])\r
+       (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id A30F7431FC2\r
+       for <notmuch@notmuchmail.org>; Sun, 15 Mar 2015 02:47:06 -0700 (PDT)\r
+Received: from resomta-ch2-11v.sys.comcast.net ([69.252.207.107])\r
+       by resqmta-ch2-01v.sys.comcast.net with comcast\r
+       id 3ln61q0012Ka2Q501ln6e1; Sun, 15 Mar 2015 09:47:06 +0000\r
+Received: from odin.tremily.us ([67.168.81.176])\r
+       by resomta-ch2-11v.sys.comcast.net with comcast\r
+       id 3ln51q0023oF5yT01ln5Se; Sun, 15 Mar 2015 09:47:06 +0000\r
+Received: by odin.tremily.us (Postfix, from userid 1000)\r
+       id DEABA16B96F8; Sun, 15 Mar 2015 02:47:04 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tremily.us; s=odin;\r
+       t=1426412824; bh=PVWy/83C9JYKpIA1mRf6WJqZ7ieYLvgX5FMgFEk/qJ0=;\r
+       h=From:To:Cc:Subject:Date;\r
+       b=qCHLbwpqf+CVnUzvGQaSz1VDaeMRVTbW7zDDLQ8S0R5y2605gswi367o0Tl4ui4XR\r
+       RDJ5zm1K1VQVuZ69lB5AUgHlO410zaXIfN9qJOsiyZ3Qe75q4/HCwzY1tIrUQfwA3Y\r
+       9DTRI5EWTvX7viOwoitYlLb5LFQ5BBBOb4ZGDJqU=\r
+From: "W. Trevor King" <wking@tremily.us>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2] nmbug-status: Use 'show-ref --heads' for loading configs\r
+Date: Sun, 15 Mar 2015 02:46:57 -0700\r
+Message-Id:\r
+ <5e97afaab6c01e980ca6194a1c04aa0310e28ab8.1426412504.git.wking@tremily.us>\r
+X-Mailer: git-send-email 2.0.5\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;\r
+       s=q20140121; t=1426412826;\r
+       bh=iAZAwbhekfTKo4GGxkCdtIlQluxJmoX1yxFL1WY5mlo=;\r
+       h=Received:Received:Received:From:To:Subject:Date:Message-Id;\r
+       b=FZ0f9vFws9G/j8RbTrpEHjIxDnMTKk+zucbSmFJNEMIpIKRuIEJ8p/06GMz443cYo\r
+       09CxgnzO9DDtLXo3RbGekJiJrNRyKpeLiG9xYcRmRh8UPtzoJQ9GoE9RYU0nn+sek5\r
+       1aGQ8O8FOzMRp7JxZKs23IdOsKGQvc7SekqePQXJP+HlxX0OAqTQP0wucrQSWG96pb\r
+       CPNz785ribZBZW/tVGhk9G0GWKRz0fJyyDmjIuz+07WT13b0daQOBKAXSUC8l/12TL\r
+       L52JZCDJo8OwnWGneOiC+g/BsiMtzaZZJGb5VK6WbSUZQhWzp35YDtGyUvS11WjrTo\r
+       m3x3FbNmQKPaA==\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://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: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 15 Mar 2015 09:47:10 -0000\r
+\r
+When loading configs from Git, the bare branch name (without a\r
+refs/heads/ prefix or similar) matches all branches of that name\r
+(including remote-tracking branches):\r
+\r
+  .nmbug $ git show-ref config\r
+  48f3bbf1d1492e5f3d2f01de6ea79a30d3840f20 refs/heads/config\r
+  48f3bbf1d1492e5f3d2f01de6ea79a30d3840f20 refs/remotes/origin/config\r
+  4b6dbd9ffd152e7476f5101eff26747f34497cee refs/remotes/wking/config\r
+\r
+Instead of relying on the ordering of the matching references, use\r
+--heads to ensure we only match local branches.\r
+---\r
+This is v2 of [1], with the only changes being:\r
+\r
+* Relocate the NEWS blurb to fit into the current pending release\r
+  (0.20).\r
+* Translate the 'nmbug' patch from Perl to Python.\r
+\r
+[1]: id:7ddcf7368895768aa0a2d37dac0d4f96e9666f16.1399749244.git.wking@tremily.us\r
+     http://article.gmane.org/gmane.mail.notmuch.general/18306\r
+\r
+ NEWS                     | 12 ++++++++++++\r
+ devel/nmbug/nmbug        |  1 +\r
+ devel/nmbug/nmbug-status |  2 +-\r
+ 3 files changed, 14 insertions(+), 1 deletion(-)\r
+\r
+diff --git a/NEWS b/NEWS\r
+index 70ad3f3..0441587 100644\r
+--- a/NEWS\r
++++ b/NEWS\r
+@@ -187,6 +187,18 @@ from the config file.  Use something like:\r
+       ...\r
+     },\r
\r
++`nmbug-status` now only matches local branches when reading\r
++`status-config.json` from the `config` branch of the `NMBGIT`\r
++repository.  To help new users running `nmbug-status`, `nmbug clone`\r
++now creates a local `config` branch tracking `origin/config`.  Folks\r
++who use `nmbug-status` with an in-Git config (i.e. you don't use the\r
++`--config` option) who already have `NMBGIT` set up are encouraged to\r
++run:\r
++\r
++    git checkout config origin/config\r
++\r
++in their `NMBGIT` repository (usually `~/.nmbug`).\r
++\r
+ Python Bindings\r
+ ---------------\r
\r
+diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug\r
+index 932ec12..81f582c 100755\r
+--- a/devel/nmbug/nmbug\r
++++ b/devel/nmbug/nmbug\r
+@@ -308,6 +308,7 @@ def clone(repository):\r
+             wait=True)\r
+     _git(args=['config', '--unset', 'core.worktree'], wait=True)\r
+     _git(args=['config', 'core.bare', 'true'], wait=True)\r
++    _git(args=['branch', 'config', 'origin/config'], wait=True)\r
\r
\r
+ def _is_committed(status):\r
+diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status\r
+index 19dc48a..e845c2a 100755\r
+--- a/devel/nmbug/nmbug-status\r
++++ b/devel/nmbug/nmbug-status\r
+@@ -92,7 +92,7 @@ def read_config(path=None, encoding=None):\r
\r
+         # read only the first line from the pipe\r
+         sha1_bytes = subprocess.Popen(\r
+-            ['git', '--git-dir', nmbhome, 'show-ref', '-s', branch],\r
++            ['git', '--git-dir', nmbhome, 'show-ref', '-s', '--heads', branch],\r
+             stdout=subprocess.PIPE).stdout.readline()\r
+         sha1 = sha1_bytes.decode(encoding).rstrip()\r
+         if not sha1:\r
+-- \r
+1.8.4\r
+\r