Re: [PATCH] run-command.c: add hint when hook is not executable
- Date: Thu, 5 Oct 2017 22:48:52 +0200
- From: Damien <damien@xxxxxx>
- Subject: Re: [PATCH] run-command.c: add hint when hook is not executable
On Wed, Oct 4, 2017 at 6:40 AM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> Damien <damien@xxxxxx> writes:
> Please explain why this change makes sense to those who find this
> commit in "git log" output six months down the line, without having
> read the original thread that motivated you to add this feature
> above this line with three dashes. Use your full name on the From:
> header of your mail (or alternatively, you can use an in-body "From:"
> to override what your MUA places there) and add sign-off with the
> same name (cf. Documentation/SubmittingPatches).
Thanks, I'm gonna post another version via submitGit. I'm not sure
how to send the "cover letter" via submitGit so I'm just gonna explain
the patch here and then send it in another message.
First, I changed the name of the config to "advice.ignoredHook"
since it's more generic and it will allow us to add other cases
such as the bad permission case..
> But for the purpose of your patch, you now do care. access(X_OK)
> may have failed with EACCESS (i.e. you have no permission to run the
> script), in which case your new advise() call may make sense. But
> it may have failed with ENOENT or ENOTDIR. And your new advise()
> call is a disaster, if the user didn't even have such a hook.
For sure, the previous version was really broken. I've now added a
EACCES check. But I see two shortcomings left:
- the message is shown twice (for a "pre-commit" hook at least)
- I tried to take into account the STRIP_EXTENSION case but
it's not tested yet
> Writing a test would have helped notice this, I would think. You'd
> need at least the following variations to cover possibilities:
As you will see, I've added tests but my scripting skills are a bit
lacking and I used a simple "if...then false else true". I've tried
`grep -v` and similar things but this solution is the only one that
I found that really works.
Thanks for the review, see PATCH in a coming email.