* [PATCH v2] nmbug-status: Use 'show-ref --heads' for loading configs
@ 2015-03-15 9:46 W. Trevor King
2015-03-21 8:28 ` Tomi Ollila
0 siblings, 1 reply; 3+ messages in thread
From: W. Trevor King @ 2015-03-15 9:46 UTC (permalink / raw)
To: notmuch
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] nmbug-status: Use 'show-ref --heads' for loading configs
2015-03-15 9:46 [PATCH v2] nmbug-status: Use 'show-ref --heads' for loading configs W. Trevor King
@ 2015-03-21 8:28 ` Tomi Ollila
2015-03-22 8:33 ` W. Trevor King
0 siblings, 1 reply; 3+ messages in thread
From: Tomi Ollila @ 2015-03-21 8:28 UTC (permalink / raw)
To: W. Trevor King, notmuch
On Sun, Mar 15 2015, "W. Trevor King" <wking@tremily.us> wrote:
> 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 looks OK, nmbug works as it used to be. I did not test cloning but
the oneline change in the patch looks good (just adds that config branch).
The nmbug-status change also looks good... and it works (tried using --config
option as I did not have working tree of config branch checked out just now).
But why is the NEWS brurb added deep into 0.19 NEWS content ?
Tomi
> 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
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] nmbug-status: Use 'show-ref --heads' for loading configs
2015-03-21 8:28 ` Tomi Ollila
@ 2015-03-22 8:33 ` W. Trevor King
0 siblings, 0 replies; 3+ messages in thread
From: W. Trevor King @ 2015-03-22 8:33 UTC (permalink / raw)
To: Tomi Ollila; +Cc: notmuch
[-- Attachment #1: Type: text/plain, Size: 565 bytes --]
On Sat, Mar 21, 2015 at 10:28:05AM +0200, Tomi Ollila wrote:
> But why is the NEWS brurb added deep into 0.19 NEWS content ?
Oops, I was just looking for the nmbug section and didn't see that
we're now post 0.19 ;). Fixed in v3 [1].
Cheers,
Trevor
[3]: id:e9d25cc269b7bcc058627466adfa2835256b6e76.1427012574.git.wking@tremily.us
http://article.gmane.org/gmane.mail.notmuch.general/20356
--
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-03-22 8:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-15 9:46 [PATCH v2] nmbug-status: Use 'show-ref --heads' for loading configs W. Trevor King
2015-03-21 8:28 ` Tomi Ollila
2015-03-22 8:33 ` W. Trevor King
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).