From: W. Trevor King Date: Sun, 22 Mar 2015 22:51:41 +0000 (+1700) Subject: [PATCH v4] nmbug-status: Use 'show-ref --heads' for loading configs X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0077c855934a69f74901785f318aeee08b122c82;p=notmuch-archives.git [PATCH v4] nmbug-status: Use 'show-ref --heads' for loading configs --- diff --git a/72/7ca120958252e3bdd6475f93fc61bd99b21951 b/72/7ca120958252e3bdd6475f93fc61bd99b21951 new file mode 100644 index 000000000..b92030c15 --- /dev/null +++ b/72/7ca120958252e3bdd6475f93fc61bd99b21951 @@ -0,0 +1,148 @@ +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 85B43431FC4 + for ; Sun, 22 Mar 2015 15:51:52 -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 F6JAVr9Bvbcy for ; + Sun, 22 Mar 2015 15:51:49 -0700 (PDT) +Received: from resqmta-po-04v.sys.comcast.net (resqmta-po-04v.sys.comcast.net + [96.114.154.163]) + (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 4053E431FBF + for ; Sun, 22 Mar 2015 15:51:49 -0700 (PDT) +Received: from resomta-po-04v.sys.comcast.net ([96.114.154.228]) + by resqmta-po-04v.sys.comcast.net with comcast + id 6mrX1q0024vw8ds01mroCG; Sun, 22 Mar 2015 22:51:48 +0000 +Received: from odin.tremily.us ([67.168.81.176]) + by resomta-po-04v.sys.comcast.net with comcast + id 6mrm1q00N3oF5yT01mrm4y; Sun, 22 Mar 2015 22:51:48 +0000 +Received: by odin.tremily.us (Postfix, from userid 1000) + id C36E316DE2B7; Sun, 22 Mar 2015 15:51:45 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tremily.us; s=odin; + t=1427064705; bh=9AXyGYUCwg9cInTygObei5wz79J9BhhmTI994Ow84fk=; + h=From:To:Cc:Subject:Date; + b=Qx9htPQkvXf8NIZpAHDDI2cUUa2z4AhA7CIkx/GflfrFP0ZqWUl7DO1nn9STCOWLj + PesTYSO8oEzQP+OHzP+XSyvL1hG//+W1Fdu3tLVeSRb0yD5dxKW1APagJNnyih5CiD + x5JnZN+H4r+G91mIAfpj2ShO6S8Zc2n1GiXd7ZhU= +From: "W. Trevor King" +To: notmuch@notmuchmail.org +Subject: [PATCH v4] nmbug-status: Use 'show-ref --heads' for loading configs +Date: Sun, 22 Mar 2015 15:51:41 -0700 +Message-Id: + <27b065bda7a31387f8f08069f30a2c2103ffc4e2.1427064160.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=1427064708; + bh=XlQLfk4tBvzkL+u9Cmu97EMOMrS52rLkr44DxJ3fV6c=; + h=Received:Received:Received:From:To:Subject:Date:Message-Id; + b=dA7Cu4zv78pSz6117rl2AELbwpyqGUpd1ecPspX0wF97EpOCZO+p2NkYg7FO9SzNN + k9OofNtTRYLY0EDEnomLT/kjFNMNrOQKpkKc07Boq0Tf1qrh2AfMPK9KT4N22TBS6n + kgx2sKmJYboo7YTnLTqKpG8R0xYi1BexxSj+1tp3rOBXVsHSnYucnHSdSqwk+ouvJB + 17DGhmb9/JyU3GLEriYVhN2nk0oNyVQJpFhU6E1ZyCe6ynM0XOa3t/pwo59c45SNlc + ikTRPnHacVjTDqE5Llae1LAMb9gX0vmIEnShkDa/Uzl/bBt5OT9PZpNMTfsLRM4LWx + bmLjKlU1UoTEA== +Cc: Tomi Ollila +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, 22 Mar 2015 22:51:52 -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. +--- +The only change from v3 [1] is dropping the accidental indentation +hunk that started with '@@ -178,14 +193,14 @@ nmbug-status'. Thanks +to Tomi for pointing this out on IRC. + +[1]: id: e9d25cc269b7bcc058627466adfa2835256b6e76.1427012574.git.wking@tremily.us + http://thread.gmane.org/gmane.mail.notmuch.general/20356 + + NEWS | 15 +++++++++++++++ + devel/nmbug/nmbug | 1 + + devel/nmbug/nmbug-status | 2 +- + 3 files changed, 17 insertions(+), 1 deletion(-) + +diff --git a/NEWS b/NEWS +index 70ad3f3..336a7c3 100644 +--- a/NEWS ++++ b/NEWS +@@ -23,6 +23,21 @@ Contrib + previously provided by `notmuch-deliver` should now be provided by + `notmuch insert`, provided by the main notmuch binary. + ++nmbug-status ++------------ ++ ++`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`). ++ + Notmuch 0.19 (2014-11-14) + ========================= + +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: +-- +2.1.0.60.g85f0837 +