Merge Result pipeline commits and squash commits create new commits with commit author set to Full Name if commit author is username instead of Full Name
<!--IssueSummary start-->
<details>
<summary>
Everyone can contribute. [Help move this issue forward](https://handbook.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows/#contributor-links) while earning points, leveling up and collecting rewards.
</summary>
- [Close this issue](https://contributors.gitlab.com/manage-issue?action=close&projectId=278964&issueIid=449141)
</details>
<!--IssueSummary end-->
### Summary
When using `username` as the commit author, any commits created internally by GitLab will have the user's `Full Name` as the author instead of the username. This affects temporary commits created for Merged Result Pipelines, and commits created by squashing on merging an MR.
### Steps to reproduce
1. set git config user.name to GitLab username `git config --local --add user.name {your username}`
2. (not sure if required) Set repository merging strategy to Fast-forward merging
3. create 2 commits on a branch
4. create a Merge Request for said branch
5. set `squash` on merge
6. merge the Merge Request. The commit author on the target branch will now be the `Full Name` instead of the username
### Example Project
Example repo, uses Fast-forward merging:
https://gitlab.com/casper.schroder/reproduce-username-commit-author-issue/-/commits/main?ref_type=heads
https://gitlab.com/casper.schroder/reproduce-username-commit-author-issue/-/merge_requests/2
```
main git log --pretty=format:"%h%x09%an%x09%ad%x09%s"
0e30fe8 Casper Schroder Tue Mar 12 10:59:50 2024 +0000 Username author squash 2
```
```
username-author-squash-2 git log --pretty=format:"%h%x09%an%x09%ad%x09%s"
fcf82a6 casper.schroder Tue Mar 12 11:58:12 2024 +0100 commit 2
665fdca casper.schroder Tue Mar 12 11:57:58 2024 +0100 commit 1
```
### What is the current *bug* behavior?
On repositories on our self hosted GitLab instance, we use LDAP usernames as commit authors. This generally fares well throughout GitLab as it maps to the correct users and most features work as expected.
However, specifically on commits created internally by GitLab (temporarily for merged result pipelines, or permanently when `squash` is used on a Merge Request,) this causes problems. The git commit author turns into the user's `Full Name`, instead of the aforementioned LDAP username.
I've found a part of the code where this happens for squashing:
https://gitlab.com/gitlab-org/gitaly/-/blob/master/internal/gitaly/service/operations/squash.go?ref_type=heads#L125
as provided by:
https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/git/user.rb?ref_type=heads#L40
This part of the code assumes that the commit author name will always be the user's Full Name, even though the rest of the application seems to map the user's username to the user correctly.
### What is the expected *correct* behavior?
Ideally this should either:
* Respect the original commit Author and use the value for the author of squashed and temporary commits
* (as a workaround) Be configurable by the user just like `Commit email` is.
### Relevant logs and/or screenshots
see Example Project
### Output of checks
This bug happens on GitLab.com
#### Results of GitLab environment info
None required as far as I can tell, it happens on our self hosted and on gitlab.com
#### Results of GitLab application Check
None required as far as I can tell, it happens on our self hosted and on gitlab.com
### Possible fixes
I'm not an expert on the GitLab repos, but I believe it would either consist of changing something regarding the following code:
https://gitlab.com/gitlab-org/gitaly/-/blob/master/internal/gitaly/service/operations/squash.go?ref_type=heads#L125
https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/git/user.rb?ref_type=heads#L40
to respect the original commit author. So conditionally use the user's username as the commit author.
Alternatively, this can be made configurable for the user just like `Commit email` is. See https://gitlab.com/-/user_settings/profile
issue