git gurus: Any way to set it up to auto-warn contributors abouttab indents?

Jacob Carlborg doob at me.com
Mon Aug 15 07:26:09 PDT 2011


On 2011-08-14 22:34, Jonathan M Davis wrote:
> On Sunday, August 14, 2011 16:05:03 Nick Sabalausky wrote:
>> "Brad Roberts"<braddr at puremagic.com>  wrote in message
>> news:mailman.2309.1313347727.14074.digitalmars-d at puremagic.com...
>>
>>> google -->  git pre-commit hook
>>>
>>> Setup whatever sort of checks you want on your local repository and
>>> it'll be correct before pushing to github to even get into a pull
>>> request.
>>
>> That's not really what I was hoping for.
>>
>> Here's the problem with that: It's a per-user solution. We can crusade all
>> we want with "SET UP A PRE-COMMIT HOOK IN YOUR REPO TO CHECK FOR TABS!!" but
>> it'll *never* solve the problem because there will always be people who,
>> for whatever reason, don't do that.
>>
>> Maybe I didn't word it clearly in the OP, but what I'm suggesting is needed
>> is something that *automatically propagates* from the official
>> "D-Programming-Language" repos to the local cloned repos. That's the only
>> way that the issue is *really* going to be taken care of.
>
> I don't think that you can do that with git. You can setup commit hooks in the
> repository to reject commits which don't fit a particular criteria (like having
> tabs or trailing whitespace), but none of that kind of stuff is actually part
> of the repository. It's in the .git directory. So, commits could be blocked
> from benig merged into the main repository, but pull requests could still have
> the issue, and I don't know if github is able to catch that and tell you that
> the pull request can't be automatically merged. I would _guess_ that it can,
> but it would probably also just tell you that it can't be automatically merged
> and not _why_, so that could be a bit annoying. We could experiment with it, I
> suppose.
>
> But the hooks aren't cloned with the repository, so we can't prevent pull
> requests with tabs.
>
> - Jonathan M Davis

I think you could add a hook for the "update" or the "pre-receive" 
events in the remote repository. I'm not sure if it will cover 
everything, like pushes and merging pull requests.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list