[PATCH 2/2] nmbug-status: Use 'show-ref --heads' for loading configs

2014-07-14 Thread W. Trevor King
On Mon, Jul 14, 2014 at 06:51:22AM -0300, David Bremner wrote:
> W. Trevor King writes:
> > On Sun, Jul 13, 2014 at 09:30:56AM -0300, David Bremner wrote:
> >> I consider it a useful feature that it works without the user
> >> configuring a local branch.  I agree that in more complex setups
> >> this ambiguity is not as nice, but I'd rather it was only the
> >> minority of users with unusual setups (e.g. multiple remotes)
> >> have to do configuration.
> >
> > I could work up a patch that tried ?git show-ref -s config? first,
> > and only fell back to ?show-ref -s --heads? if there were multiple
> > matches.  That way folks with only origin/config wouldn't need a
> > local branch, but folks with multiple config-carrying remotes (or
> > a single config-carrying remote and a local branch) would have to
> > have a local config to break the tie.  That's possible, and not
> > *too* complicated, but I personally prefer the consistency of just
> > requiring a local config branch.
>
> It might be simpler to implement (and understand) to try first the
> local config branch and then fall back to "origin/config".

I'd rather avoid hard-coding an upstream name here.  We do hard-code
?origin? as the default remote for ?fetch?, ?pull?, and ?push?.  I'd
rather drop those in favor of the configured Git defaults (for
example, running a bare ?git fetch? if the user doesn't specify a
remote).  For most configurations, falling back to ?Is ?git show-ref
-s config? a unique hash?? should be equivalent to hard-coding ?git
show-ref -s origin/config?.

Cheers,
Trevor

-- 
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
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: 



[PATCH 2/2] nmbug-status: Use 'show-ref --heads' for loading configs

2014-07-14 Thread David Bremner
"W. Trevor King"  writes:

> On Sun, Jul 13, 2014 at 09:30:56AM -0300, David Bremner wrote:
>> I consider it a useful feature that it works without the user
>> configuring a local branch.  I agree that in more complex setups
>> this ambiguity is not as nice, but I'd rather it was only the
>> minority of users with unusual setups (e.g. multiple remotes) have
>> to do configuration.
>
> I could work up a patch that tried ?git show-ref -s config? first, and
> only fell back to ?show-ref -s --heads? if there were multiple
> matches.  That way folks with only origin/config wouldn't need a local
> branch, but folks with multiple config-carrying remotes (or a single
> config-carrying remote and a local branch) would have to have a local
> config to break the tie.  That's possible, and not *too* complicated,
> but I personally prefer the consistency of just requiring a local
> config branch.

It might be simpler to implement (and understand) to try first the local
config branch and then fall back to "origin/config".

d


Re: [PATCH 2/2] nmbug-status: Use 'show-ref --heads' for loading configs

2014-07-14 Thread David Bremner
W. Trevor King wk...@tremily.us writes:

 On Sun, Jul 13, 2014 at 09:30:56AM -0300, David Bremner wrote:
 I consider it a useful feature that it works without the user
 configuring a local branch.  I agree that in more complex setups
 this ambiguity is not as nice, but I'd rather it was only the
 minority of users with unusual setups (e.g. multiple remotes) have
 to do configuration.

 I could work up a patch that tried ‘git show-ref -s config’ first, and
 only fell back to ‘show-ref -s --heads’ if there were multiple
 matches.  That way folks with only origin/config wouldn't need a local
 branch, but folks with multiple config-carrying remotes (or a single
 config-carrying remote and a local branch) would have to have a local
 config to break the tie.  That's possible, and not *too* complicated,
 but I personally prefer the consistency of just requiring a local
 config branch.

It might be simpler to implement (and understand) to try first the local
config branch and then fall back to origin/config.

d
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 2/2] nmbug-status: Use 'show-ref --heads' for loading configs

2014-07-14 Thread W. Trevor King
On Mon, Jul 14, 2014 at 06:51:22AM -0300, David Bremner wrote:
 W. Trevor King writes:
  On Sun, Jul 13, 2014 at 09:30:56AM -0300, David Bremner wrote:
  I consider it a useful feature that it works without the user
  configuring a local branch.  I agree that in more complex setups
  this ambiguity is not as nice, but I'd rather it was only the
  minority of users with unusual setups (e.g. multiple remotes)
  have to do configuration.
 
  I could work up a patch that tried ‘git show-ref -s config’ first,
  and only fell back to ‘show-ref -s --heads’ if there were multiple
  matches.  That way folks with only origin/config wouldn't need a
  local branch, but folks with multiple config-carrying remotes (or
  a single config-carrying remote and a local branch) would have to
  have a local config to break the tie.  That's possible, and not
  *too* complicated, but I personally prefer the consistency of just
  requiring a local config branch.

 It might be simpler to implement (and understand) to try first the
 local config branch and then fall back to origin/config.

I'd rather avoid hard-coding an upstream name here.  We do hard-code
‘origin’ as the default remote for ‘fetch’, ‘pull’, and ‘push’.  I'd
rather drop those in favor of the configured Git defaults (for
example, running a bare ‘git fetch’ if the user doesn't specify a
remote).  For most configurations, falling back to “Is ‘git show-ref
-s config’ a unique hash?” should be equivalent to hard-coding ‘git
show-ref -s origin/config’.

Cheers,
Trevor

-- 
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


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 2/2] nmbug-status: Use 'show-ref --heads' for loading configs

2014-07-13 Thread W. Trevor King
On Sun, Jul 13, 2014 at 09:30:56AM -0300, David Bremner wrote:
> I consider it a useful feature that it works without the user
> configuring a local branch.  I agree that in more complex setups
> this ambiguity is not as nice, but I'd rather it was only the
> minority of users with unusual setups (e.g. multiple remotes) have
> to do configuration.

I could work up a patch that tried ?git show-ref -s config? first, and
only fell back to ?show-ref -s --heads? if there were multiple
matches.  That way folks with only origin/config wouldn't need a local
branch, but folks with multiple config-carrying remotes (or a single
config-carrying remote and a local branch) would have to have a local
config to break the tie.  That's possible, and not *too* complicated,
but I personally prefer the consistency of just requiring a local
config branch.

There's probably a project-size threshold after which you want better
access controls than a shared public repository like nmbug.tethera.net
gives you.  At that point, most folks are going to want their own,
personal public repository.  Once you have that, the folks using the
?config? branch (maybe not very many?) are going to need to keep their
own local branches.

Cheers,
Trevor

-- 
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
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: 



[PATCH 2/2] nmbug-status: Use 'show-ref --heads' for loading configs

2014-07-13 Thread David Bremner
"W. Trevor King"  writes:

> 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.

ah. I should have read both patches before replying. 

I consider it a useful feature that it works without the user
configuring a local branch.  I agree that in more complex setups this
ambiguity is not as nice, but I'd rather it was only the minority of
users with unusual setups (e.g. multiple remotes) have to do
configuration.

d


Re: [PATCH 2/2] nmbug-status: Use 'show-ref --heads' for loading configs

2014-07-13 Thread David Bremner
W. Trevor King wk...@tremily.us writes:

 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.

ah. I should have read both patches before replying. 

I consider it a useful feature that it works without the user
configuring a local branch.  I agree that in more complex setups this
ambiguity is not as nice, but I'd rather it was only the minority of
users with unusual setups (e.g. multiple remotes) have to do
configuration.

d
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 2/2] nmbug-status: Use 'show-ref --heads' for loading configs

2014-07-13 Thread W. Trevor King
On Sun, Jul 13, 2014 at 09:30:56AM -0300, David Bremner wrote:
 I consider it a useful feature that it works without the user
 configuring a local branch.  I agree that in more complex setups
 this ambiguity is not as nice, but I'd rather it was only the
 minority of users with unusual setups (e.g. multiple remotes) have
 to do configuration.

I could work up a patch that tried ‘git show-ref -s config’ first, and
only fell back to ‘show-ref -s --heads’ if there were multiple
matches.  That way folks with only origin/config wouldn't need a local
branch, but folks with multiple config-carrying remotes (or a single
config-carrying remote and a local branch) would have to have a local
config to break the tie.  That's possible, and not *too* complicated,
but I personally prefer the consistency of just requiring a local
config branch.

There's probably a project-size threshold after which you want better
access controls than a shared public repository like nmbug.tethera.net
gives you.  At that point, most folks are going to want their own,
personal public repository.  Once you have that, the folks using the
‘config’ branch (maybe not very many?) are going to need to keep their
own local branches.

Cheers,
Trevor

-- 
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


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 2/2] nmbug-status: Use 'show-ref --heads' for loading configs

2014-05-10 Thread W. Trevor King
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.
---
 NEWS | 18 ++
 devel/nmbug/nmbug|  1 +
 devel/nmbug/nmbug-status |  2 +-
 3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index bcd311d..5f7d30a 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,21 @@
+Notmuch 0.19 (UNRELEASED)
+=
+
+nmbug
+-
+
+`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.18~rc0 (2014-04-22)
 =

diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug
index b18ded7..c6793a5 100755
--- a/devel/nmbug/nmbug
+++ b/devel/nmbug/nmbug
@@ -135,6 +135,7 @@ sub do_clone {
 or die "'git clone' exited with nonzero value\n";
   git ('config', '--unset', 'core.worktree');
   git ('config', 'core.bare', 'true');
+  git ('branch', 'config', 'origin/config');
 }

 sub is_committed {
diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index 75a6e47..610c281 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -72,7 +72,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.9.1.353.gc66d89d



[PATCH 2/2] nmbug-status: Use 'show-ref --heads' for loading configs

2014-05-10 Thread W. Trevor King
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.
---
 NEWS | 18 ++
 devel/nmbug/nmbug|  1 +
 devel/nmbug/nmbug-status |  2 +-
 3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index bcd311d..5f7d30a 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,21 @@
+Notmuch 0.19 (UNRELEASED)
+=
+
+nmbug
+-
+
+`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.18~rc0 (2014-04-22)
 =
 
diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug
index b18ded7..c6793a5 100755
--- a/devel/nmbug/nmbug
+++ b/devel/nmbug/nmbug
@@ -135,6 +135,7 @@ sub do_clone {
 or die 'git clone' exited with nonzero value\n;
   git ('config', '--unset', 'core.worktree');
   git ('config', 'core.bare', 'true');
+  git ('branch', 'config', 'origin/config');
 }
 
 sub is_committed {
diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index 75a6e47..610c281 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -72,7 +72,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.9.1.353.gc66d89d

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch