[PATCH v3 5/5] show-ref: Remove dead `if (verify)' check

2017-01-23 Thread Vladimir Panteleev
As show_ref is only ever called on the path where --verify is not specified, `verify' can never possibly be true here. Signed-off-by: Vladimir Panteleev <g...@thecybershadow.net> --- builtin/show-ref.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/builtin/show-ref.c b/builtin/show

[PATCH v3 2/5] show-ref: Allow -d to work with --verify

2017-01-23 Thread Vladimir Panteleev
Move handling of -d into show_one, so that it takes effect when --verify is present as well as when it is absent. This is useful when the user wishes to avoid the costly iteration of refs. Signed-off-by: Vladimir Panteleev <g...@thecybershadow.net> --- builtin/show-ref.c

[PATCH v3 3/5] show-ref: Move --quiet handling into show_one

2017-01-23 Thread Vladimir Panteleev
Do the same with --quiet as was done with -d, to remove the need to perform this check at show_one's call site from the --verify branch. Signed-off-by: Vladimir Panteleev <g...@thecybershadow.net> --- builtin/show-ref.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff

[PATCH v3 1/5] show-ref: Accept HEAD with --verify

2017-01-23 Thread Vladimir Panteleev
not work as expected. Instead of insisting that the input begins with "refs/", allow "HEAD" as well in the codepath that handles "--verify", so that all valid full refnames including HEAD are passed to the same output machinery. Signed-off-by: Vladimir Panteleev <g

[PATCH v3 4/5] show-ref: Detect dangling refs under --verify as well

2017-01-23 Thread Vladimir Panteleev
Move detection of dangling refs into show_one, so that they are detected when --verify is present as well as when it is absent. Signed-off-by: Vladimir Panteleev <g...@thecybershadow.net> --- builtin/show-ref.c | 16 t/t1403-show-ref.sh | 22 ++ 2

[PATCH v3 0/5] show-ref: Allow -d, --head to work with --verify

2017-01-23 Thread Vladimir Panteleev
Third iteration, according to Junio's comments. This time we keep show_ref and show_one separate, accept HEAD with --verify even without --head, and add tests for dangling ref validation with --verify.

[PATCH v2 4/4] show-ref: Inline show_one

2017-01-20 Thread Vladimir Panteleev
As the small function is now only called from a single place, there is no point in keeping it as a separate function any longer. Signed-off-by: Vladimir Panteleev <g...@thecybershadow.net> --- builtin/show-ref.c | 15 +-- 1 file changed, 5 insertions(+), 10 deletions(-) diff

[PATCH v2 1/4] show-ref: Allow --head to work with --verify

2017-01-20 Thread Vladimir Panteleev
t all valid full refnames including HEAD are passed to the same output machinery. Signed-off-by: Vladimir Panteleev <g...@thecybershadow.net> --- builtin/show-ref.c | 3 ++- t/t1403-show-ref.sh | 14 ++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/builtin/show

[PATCH v2 3/4] show-ref: Optimize show_ref a bit

2017-01-20 Thread Vladimir Panteleev
with a reference exactly matching pattern. Signed-off-by: Vladimir Panteleev <g...@thecybershadow.net> --- builtin/show-ref.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/builtin/show-ref.c b/builtin/show-ref.c index bcdc1a95e..3cf344d47 100644 --- a/builtin/show-ref.c

[PATCH v2 2/4] show-ref: Allow -d to work with --verify

2017-01-20 Thread Vladimir Panteleev
Use the same output machinery when --verify is absent or present, which allows tag dereferencing (-d) to work with --verify. This is useful when the user wishes to avoid the costly iteration of refs. Signed-off-by: Vladimir Panteleev <g...@thecybershadow.net> --- builtin/show-ref.c | 3

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

2017-01-20 Thread Vladimir Panteleev
This is the second take for "[PATCH] show-ref: Allow --head to work with --verify". Thanks to Junio for his extensive feedback.

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

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

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

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

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

2017-01-20 Thread Vladimir Panteleev
king up the HEAD ref. This patch adds --head support to show-ref's --verify logic, by explicitly checking if the "HEAD" ref is specified when --head is present. Signed-off-by: Vladimir Panteleev <g...@thecybershadow.net> --- builtin/show-ref.c | 2 ++ t/t1403-show-ref.sh | 8