Re: [PATCH] show-ref: Allow --head to work with --verify

2017-01-20 Thread Vladimir Panteleev
On 2017-01-20 23:29, Junio C Hamano wrote: By the way, I have no strong preference between "read-ref, check quiet and show-one" and "show-ref", so if you make --verify to consistently call "show_ref()" for both refs/heads/master and HEAD, that is also perfectly fine. This sounds like a good ide

Re: [PATCH] show-ref: Allow --head to work with --verify

2017-01-20 Thread Junio C Hamano
Junio C Hamano writes: > If two codepaths are called "I don't see a meaningful difference", > then it is really better to share the same code. Today, they may > happen to behave identically. When we need to update the behaviour > of one, we'd be forced to update the other one to match. > > IOW,

Re: [PATCH] show-ref: Allow --head to work with --verify

2017-01-20 Thread Junio C Hamano
Vladimir Panteleev writes: > --quiet will still work correctly with the current patch, because > show_ref already checks quiet. Granted, the original --verify code > used show_one and not show_ref; however, I don't see a meaningful > difference between calling show_ref and show_one for HEAD, othe

Re: [PATCH] show-ref: Allow --head to work with --verify

2017-01-20 Thread Junio C Hamano
Junio C Hamano writes: > Your log message for the patch needs to be updated by summarizing > the above better. Here is my attempt. "git show-ref HEAD" used with "--verify" (because the user is not interested in seeing refs/remotes/origin/HEAD), and used with "--head" (because the

Re: [PATCH] show-ref: Allow --head to work with --verify

2017-01-20 Thread Vladimir Panteleev
On 2017-01-20 19:03, Junio C Hamano wrote: and viewed in the wider context, I notice that quiet is not honored in the added code. I think that is easily fixable by replacing this hunk with something like: --quiet will still work correctly with the current patch, because show_ref already check

Re: [PATCH] show-ref: Allow --head to work with --verify

2017-01-20 Thread Junio C Hamano
Junio C Hamano writes: >> My use case was the following series of steps: >> ... long and readable if a bit too verbose description ... > Your log message for the patch needs to be updated by summarizing > the above better. That raises the number of things to improve in the patch to 3 (so far):

Re: [PATCH] show-ref: Allow --head to work with --verify

2017-01-20 Thread Junio C Hamano
Vladimir Panteleev writes: > Hi Junio, > > On 2017-01-20 19:03, Junio C Hamano wrote: >> Having said all that, using --verify on HEAD does not make much >> sense, because if HEAD is missing in .git/, I do not think Git >> considers that directory as a Git repository to begin with. So from >> tha

Re: [PATCH] show-ref: Allow --head to work with --verify

2017-01-20 Thread Vladimir Panteleev
And to clarify: On 2017-01-20 20:26, Vladimir Panteleev wrote: On 2017-01-20 19:03, Junio C Hamano wrote: Having said all that, using --verify on HEAD does not make much sense, because if HEAD is missing in .git/, I do not think Git considers that directory as a Git repository to begin with.

Re: [PATCH] show-ref: Allow --head to work with --verify

2017-01-20 Thread Vladimir Panteleev
Hi Junio, On 2017-01-20 19:03, Junio C Hamano wrote: Having said all that, using --verify on HEAD does not make much sense, because if HEAD is missing in .git/, I do not think Git considers that directory as a Git repository to begin with. So from that point of view, I am not sure what value th

Re: [PATCH] show-ref: Allow --head to work with --verify

2017-01-20 Thread Junio C Hamano
Vladimir Panteleev writes: > This patch adds --head support to show-ref's --verify logic, by > explicitly checking if the "HEAD" ref is specified when --head is > present. > @@ -207,6 +207,8 @@ int cmd_show_ref(int argc, const char **argv, const char > *prefix) > i

[PATCH] show-ref: Allow --head to work with --verify

2017-01-20 Thread Vladimir Panteleev
Previously, when --verify was specified, --head was being ignored, and "show-ref --verify --head HEAD" would always print "fatal: 'HEAD' - not a valid ref". As such, when using show-ref to look up any ref (including HEAD) precisely by name, one would have to special-case looking up the HEAD ref. T