HomePhabricator

Pass repository PHID to custom hooks in PHABRICATOR_REPOSITORY instead of…

Authored by epriestley on Feb 18 2016, 12:58 AM.

Description

Pass repository PHID to custom hooks in PHABRICATOR_REPOSITORY instead of callsign

Summary:
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:
stuff.sh
#!/bin/sh

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

Reviewers: chad, avivey

Reviewed By: avivey

Subscribers: avivey

Maniphest Tasks: T4245

Differential Revision: https://secure.phabricator.com/D15294