Page MenuHomePhabricator

Pass repository PHID to custom hooks in PHABRICATOR_REPOSITORY instead of callsign

Authored by epriestley on Feb 18 2016, 1:06 AM.



Ref T4245. We pass this exclusively for use by additional third-party hooks.

This is technically a backward compatibility break, but I suspect it doesn't affect anyone:

  • Probably almost no one is using this (there are few reasons to, even for the tiny number of installs with custom commit hooks).
  • If they are, there's a good chance the PHID will work anyway, since nearly all scripts and Conduit methods will accept it in place of a callsign now, and if it's in logging or debugging code the PHID is a reasonable substitute
  • Even if it doesn't just keep working, the break should be very obvious in most reasonable cases.

I'll call this out explicitly in the changelog, though -- almost everything else will just continue working, but this is a strict compatibility break.

Test Plan
  • Ugh.
  • Picked a hosted Git repo out of Diffusion.
  • Went to the path on disk.
  • Went into hooks/.
  • Went into pre-receive-phabricator.d/.
  • Wrote this hook and gave it chmod +x:

echo $PHABRICATOR_REPOSITORY >> /tmp/stuff.log
  • Pushed to the repository.
  • Saw a PHID show up in the log:
$ cat /tmp/stuff.log

Diff Detail

rP Phabricator
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

epriestley updated this revision to Diff 36897.Feb 18 2016, 1:06 AM
epriestley retitled this revision from to Pass repository PHID to custom hooks in PHABRICATOR_REPOSITORY instead of callsign.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: chad.
avivey accepted this revision.Feb 18 2016, 1:08 AM
avivey added a reviewer: avivey.
avivey added a subscriber: avivey.


This revision is now accepted and ready to land.Feb 18 2016, 1:08 AM

Plausible reason #4 is:

  • Many things you might want to do with custom commit hooks can be done more flexibly with custom Herald fields or actions now, anyway.
This revision was automatically updated to reflect the committed changes.