Re: [PATCH] sha1-name.c: for ":/", find detached HEAD commits

2018-07-11 Thread William Chargin
> > Does for_each_ref() iterate over per-worktree refs (like "bisect", > > perhaps)? > > No. To be clear: it iterates only over the per-worktree refs for the current worktree. So, if you mark an unreachable commit as "bad" with bisect, then that commit is reachable (and found by ":/") in the

Re: [PATCH] sha1-name.c: for ":/", find detached HEAD commits

2018-07-11 Thread Duy Nguyen
On Wed, Jul 11, 2018 at 7:20 PM Junio C Hamano wrote: > > Duy Nguyen writes: > > >> diff --git a/sha1-name.c b/sha1-name.c > >> index 60d9ef3c7..641ca12f9 100644 > >> --- a/sha1-name.c > >> +++ b/sha1-name.c > >> @@ -1650,6 +1650,7 @@ static int get_oid_with_context_1(const char *name, > >>

Re: [PATCH] sha1-name.c: for ":/", find detached HEAD commits

2018-07-11 Thread Junio C Hamano
Duy Nguyen writes: >> diff --git a/sha1-name.c b/sha1-name.c >> index 60d9ef3c7..641ca12f9 100644 >> --- a/sha1-name.c >> +++ b/sha1-name.c >> @@ -1650,6 +1650,7 @@ static int get_oid_with_context_1(const char *name, >> struct commit_list *list = NULL; >> >>

Re: [PATCH] sha1-name.c: for ":/", find detached HEAD commits

2018-07-11 Thread Jeff King
On Wed, Jul 11, 2018 at 05:45:09PM +0200, Duy Nguyen wrote: > > diff --git a/sha1-name.c b/sha1-name.c > > index 60d9ef3c7..641ca12f9 100644 > > --- a/sha1-name.c > > +++ b/sha1-name.c > > @@ -1650,6 +1650,7 @@ static int get_oid_with_context_1(const char *name, > > struct

Re: [PATCH] sha1-name.c: for ":/", find detached HEAD commits

2018-07-11 Thread Junio C Hamano
Jeff King writes: > On Tue, Jul 10, 2018 at 11:18:22PM -0700, William Chargin wrote: > >> > Also, I am not sure if "or from HEAD" is even needed when we say >> > "from ANY ref" already, as we count things like HEAD as part of the >> > ref namespace. >> >> My two cents: with the docs as is, I

Re: [PATCH] sha1-name.c: for ":/", find detached HEAD commits

2018-07-11 Thread Duy Nguyen
On Tue, Jul 10, 2018 at 5:44 PM William Chargin wrote: > > This patch broadens the set of commits matched by ":/" pathspecs to > include commits reachable from HEAD but not any named ref. This avoids > surprising behavior when working with a detached HEAD and trying to > refer to a commit that

Re: [PATCH] sha1-name.c: for ":/", find detached HEAD commits

2018-07-11 Thread Jeff King
On Tue, Jul 10, 2018 at 11:18:22PM -0700, William Chargin wrote: > > Also, I am not sure if "or from HEAD" is even needed when we say > > "from ANY ref" already, as we count things like HEAD as part of the > > ref namespace. > > My two cents: with the docs as is, I wasn't sure whether HEAD was >

Re: [PATCH] sha1-name.c: for ":/", find detached HEAD commits

2018-07-11 Thread William Chargin
> we care about reachability only from the detached HEAD here, so this > must _not_ use test_commit, which creates an extra tag. Right. I can add a comment to that effect. > Please avoid unnecessary reflowing of earlier lines of the paragrpah > when the only change is to insert "or from HEAD" in

Re: [PATCH] sha1-name.c: for ":/", find detached HEAD commits

2018-07-10 Thread Junio C Hamano
William Chargin writes: > This patch broadens the set of commits matched by ":/" pathspecs to > include commits reachable from HEAD but not any named ref. This avoids > surprising behavior when working with a detached HEAD and trying to > refer to a commit that was recently created and only

Re: [PATCH] sha1-name.c: for ":/", find detached HEAD commits

2018-07-10 Thread Jeff King
On Tue, Jul 10, 2018 at 08:41:06AM -0700, William Chargin wrote: > This patch broadens the set of commits matched by ":/" pathspecs to > include commits reachable from HEAD but not any named ref. This avoids > surprising behavior when working with a detached HEAD and trying to > refer to a commit

[PATCH] sha1-name.c: for ":/", find detached HEAD commits

2018-07-10 Thread William Chargin
This patch broadens the set of commits matched by ":/" pathspecs to include commits reachable from HEAD but not any named ref. This avoids surprising behavior when working with a detached HEAD and trying to refer to a commit that was recently created and only exists within the detached state.