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