v2.14.4
HookArgs: Use IdentifiedUser.getNameEmail to format account name

In most of the hooks, the account is being formatted as either:

  Name Surname (email@domain.com)

when the account has an email address, or:

  Name Surname

when the account does not have an email address. If the account name
is empty the anonymous coward name is used.

Instead of implementing this logic in the hook, defer it to the
existing implementation in IdentifiedUser which properly formats
the name when there is an email address:

  Name Surname <email@domain.com>

and also handles the cases where the account does not have an email
address but instead has a username, or falls back to the account Id.

The names used in the ref-update and commit-received hooks were already
formatted like this, so this change makes the rest of the hooks
consistent.

Change-Id: I99eeab1759dcedfdcc8c689ee6ac4599e3b58325
2 files changed
tree: 06883a473a62b31c4fcfb53058888f79ddb0fe0b
  1. .gitignore
  2. BUILD
  3. LICENSE
  4. src/