Commit filtering by author does not work for users with multiple emails
### Summary
When using the "search by author" widget in the commits list, only the commits using their main e-mail show up. In our case, after being acquired our emails changed, so we have commits with our old and new emails.
### Steps to reproduce
1. Create a user with a Git user email (for example, `john.black@oldcorp.com`) ([see documentation](https://docs.gitlab.com/ee/gitlab-basics/start-using-git.html#configure-git)).
2. Create a commit to the repository
3. <span dir="">Update GitLab email from </span>`john.black@oldcorp.com`<span dir=""> to </span>`john.black@newcorp.com`
4. Update Git user name to `john.black@newcorp.com`
5. Create a new commit in the repository
6. Go to _Code -\> Commits_ and use the search widget, select their name
7. You won't be able to discover old commits (before the change of email)
### Proposal
GitLab uses `git log --author="John Black"` command to discover commits made by the user. This approach stops working when the Git email changes.
We can additionally provide an user email to search parameters:
`git log --author="john.black@oldcorp.com" --author=john.black@newcorp.com`
This will allow detection of old commits by email if the username match fails.
### What is the current _bug_ behavior?
No commits are shown
### What is the expected _correct_ behavior?
Commits are shown
### Output of checks
#### Results of GitLab environment info
<details>
<summary>Expand for output related to GitLab environment info</summary>
<pre>System information System: RedHatEnterprise 8.6 Proxy: no Current User: gitlab Using RVM: no Ruby Version: 3.0.6p216 Gem Version: 3.4.19 Bundler Version:2.4.20 Rake Version: 13.0.6 Redis Version: 7.0.13 Sidekiq Version:6.5.7 Go Version: unknown GitLab information Version: 16.5.2-ee Revision: 54c8732b102 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: PostgreSQL DB Version: 13.11 URL: https:// HTTP Clone URL: https:///some-group/some-project.git SSH Clone URL: gitlab@:some-group/some-project.git Elasticsearch: no Geo: yes Geo node: Primary Using LDAP: yes Using Omniauth: yes Omniauth Providers: GitLab Shell Version: 14.29.0 Repository storages: - default: unix:/var/opt/gitlab/gitaly/gitaly.socket - tintri: unix:/var/opt/gitlab/gitaly/gitaly.socket GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell Gitaly - default Address: unix:/var/opt/gitlab/gitaly/gitaly.socket - default Version: 16.5.2 - default Git Version: 2.42.0 - tintri Address: unix:/var/opt/gitlab/gitaly/gitaly.socket - tintri Version: 16.5.2 - tintri Git Version: 2.42.0 </pre>
</details>
#### Results of GitLab application Check
<details>
<summary>Expand for output related to the GitLab application check</summary>
<pre>
Checking GitLab subtasks ... Checking GitLab Shell ... GitLab Shell: ... GitLab Shell version \\\>= 14.29.0 ? ... OK (14.29.0) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Internal API available: OK Redis available via internal API: OK gitlab-shell self-check successful Checking GitLab Shell ... Finished Checking Gitaly ... Gitaly: ... default ... OK tintri ... OK Checking Gitaly ... Finished Checking Sidekiq ... Sidekiq: ... Running? ... yes Number of Sidekiq processes (cluster/worker) ... 1/4 Checking Sidekiq ... Finished Checking Incoming Email ... Incoming Email: ... Reply by email is disabled in config/gitlab.yml Checking Incoming Email ... Finished Checking LDAP ... LDAP: ... Server: ldapmain LDAP authentication... Anonymous. No \\\`bind_dn\\\` or \\\`password\\\` configured LDAP users with access to your GitLab server (only showing the first 100 results) User output sanitized. Found 100 users of 100 limit. Checking LDAP ... Finished Checking GitLab App ... Database config exists? ... yes Tables are truncated? ... skipped All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Cable config exists? ... yes Resque config exists? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Systemd unit files or init script exist? ... skipped (omnibus-gitlab has neither init script nor systemd units) Systemd unit files or init script up-to-date? ... skipped (omnibus-gitlab has neither init script nor systemd units) Projects have namespace: ... Redis version \\\>= 6.0.0? ... yes Ruby version \\\>= 3.0.6 ? ... yes (3.0.6) Git user has default SSH configuration? ... yes Active users: ... 432 Is authorized keys file accessible? ... skipped (authorized keys not enabled) GitLab configured to store new projects in hashed storage? ... yes All projects are in hashed storage? ... yes Elasticsearch version 7.x-8.x or OpenSearch version 1.x ... skipped (Advanced Search is disabled) All migrations must be finished before doing a major upgrade ... skipped (Advanced Search is disabled) Checking GitLab App ... Finished Checking Geo ... GitLab Geo is available ... GitLab Geo is enabled ... yes This machine's Geo node name matches a database record ... yes, found a primary node named "Wilsonville" HTTP/HTTPS repository cloning is enabled ... yes Machine clock is synchronized ... warning Reason: Connection to the NTP Server pool.ntp.org took more than 60 seconds (Timeout) Try fixing it: Check whether you have a connectivity problem or if there is a firewall blocking it If this is an offline environment, you can ignore this error, but make sure you have a way to keep clocks synced. For more information see: administration/geo/replication/troubleshooting#health-check-rake-task Git user has default SSH configuration? ... yes OpenSSH configured to use AuthorizedKeysCommand ... skipped Reason: Cannot access OpenSSH configuration file Try fixing it: This is expected if you are using SELinux. You may want to check configuration manually For more information see: doc/administration/operations/fast_ssh_key_lookup.md GitLab configured to disable writing to authorized_keys file ... yes GitLab configured to store new projects in hashed storage? ... yes All projects are in hashed storage? ... yes Checking Geo ... Finished Checking GitLab subtasks ... Finished
</pre>
</details>
### Possible fixes
Use all the emails in the user's profile to match commits.
issue