Page MenuHomePhabricator

Ignore "Auditors: author" when inferring auditors from commit messages
ClosedPublic

Authored by epriestley on Mar 16 2017, 7:25 PM.
Tags
None
Referenced Files
F18952025: D17507.id.diff
Wed, Nov 12, 5:26 AM
F18843289: D17507.diff
Tue, Oct 28, 9:13 PM
F18831946: D17507.id.diff
Sat, Oct 25, 5:10 PM
F18815106: D17507.diff
Tue, Oct 21, 12:54 AM
F18788371: D17507.id.diff
Oct 15 2025, 4:33 AM
F18745607: D17507.diff
Oct 3 2025, 8:19 AM
F18733507: D17507.id.diff
Sep 30 2025, 10:36 PM
F18459824: D17507.id42104.diff
Sep 1 2025, 6:03 PM
Subscribers

Details

Summary

Fixes T12406. When importing commits, we automatically add auditors if the message lists "Auditors: username".

If the list of auditors includes the commit author, this edit fails because you can't audit your own commits (previously, you sometimes could and/or we didn't validate).

Instead, just ignore "Auditors: author".

Test Plan
  • Made a commit with "Auditors: epriestley".
  • Pushed it.
  • Saw the HeraldWorker get stuck with the error in T12406.
  • Applied the change; worker now succeeded.

Diff Detail

Repository
rP Phabricator
Branch
audit1
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 16008
Build 21225: Run Core Tests
Build 21224: arc lint + arc unit

Event Timeline

alexmv added inline comments.
src/applications/audit/editor/PhabricatorAuditEditor.php
310–313

It's not clear what this short-circuit accomplishes -- if the array is empty, the foreach does no iterations, and the equivalent short-circuit below it kicks in.

Oh -- it avoids foreach (null as ...) for commits with no "Auditors" field, which emits a warning since foreach (...) wants an array.

This revision is now accepted and ready to land.Mar 16 2017, 8:30 PM

Oh -- it avoids foreach (null as ...) for commits with no "Auditors" field, which emits a warning since foreach (...) wants an array.

Ah -- it's to catch the null case. I was just thinking in terms of the empty list case.

Thanks!

This revision was automatically updated to reflect the committed changes.