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
Unknown Object (File)
Fri, Dec 13, 2:24 AM
Unknown Object (File)
Fri, Dec 6, 1:26 PM
Unknown Object (File)
Fri, Dec 6, 8:30 AM
Unknown Object (File)
Fri, Dec 6, 4:55 AM
Unknown Object (File)
Wed, Nov 27, 10:21 PM
Unknown Object (File)
Tue, Nov 26, 2:45 PM
Unknown Object (File)
Nov 23 2024, 12:19 AM
Unknown Object (File)
Nov 19 2024, 5:15 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.