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. src/
  2. .gitignore
  3. BUILD
  4. LICENSE