Page MenuHomePhabricator

Install pre-commit hooks in Git repositories
ClosedPublic

Authored by epriestley on Dec 2 2013, 9:46 PM.
Tags
None
Referenced Files
F18854236: D7682.id.diff
Fri, Oct 31, 10:39 PM
F18850992: D7682.diff
Thu, Oct 30, 9:06 PM
F18785708: D7682.diff
Oct 14 2025, 10:00 AM
F18780397: D7682.id17346.diff
Oct 12 2025, 11:07 AM
F18722075: D7682.id.diff
Sep 29 2025, 10:07 PM
F18708037: D7682.diff
Sep 28 2025, 9:03 PM
F18658887: D7682.id17351.diff
Sep 23 2025, 8:56 AM
F18404265: D7682.id.diff
Aug 29 2025, 10:17 PM
Subscribers

Details

Summary

Ref T4189. T4189 describes most of the intent here:

  • When updating hosted repositories, sync a pre-commit hook into them instead of doing a git fetch.
  • The hook calls into Phabricator. The acting Phabricator user is sent via PHABRICATOR_USER in the environment. The active repository is sent via CLI.
  • The hook doesn't do anything useful yet; it just veifies basic parameters, does a little parsing, and exits 0 to allow the commit.
Test Plan
  • Performed Git pushes and pulls over SSH and HTTP.

Diff Detail

Branch
hooks
Lint
Lint Passed
SeverityLocationCodeMessage
Advicesrc/applications/diffusion/engine/DiffusionCommitHookEngine.php:52XHP16TODO Comment
Unit
Tests Passed

Event Timeline

Cool. Excited to see how the 3rd party hook stuff ends up working (see T4189)

src/applications/repository/engine/PhabricatorRepositoryPullEngine.php
310

are we implicitly in the.git folder in this case or?

src/applications/repository/engine/PhabricatorRepositoryPullEngine.php
310

Yeah, in the bare case the top level folder is basically the same as ".git/".