> Unfortunately, that's not as simple to implement as I'd hoped, because 
> git.py:git_run removes all leading and trailing whitespace from the output 
> of the git command it runs, so the code checking commit messages can't 
> tell whether there was whitespace at the start of the first line (or the 
> end of the last line, I suppose) at all.  I don't know what git commands 
> the hooks are using that might depend on removing leading whitespace (no 
> doubt the removal of trailing whitespace is needed in various places to 
> remove a final newline output by commands giving single-line output).

A quick run of the testsuite reveals that this assumption is made
all over. I am opposed to having this feature be a standard feature
of the git-hooks, so you wouldn't have to add an ad hoc check.
The way I would do it is by enhancing the git_run function to check
for a parameter named "_no_strip" and block the strip() operation
when passed as True. You can then implement your check using the usual
git interface, with the extra "_no_strip=True" parameter.

Do open a GitHub issue if you'd like me to add this check to
the git-hooks. I will likely give it less priority because
you'll have a way to implement it on your on, but I will get to it
eventually.

-- 
Joel

Reply via email to