Commit hash doesn't match when create a commit through the Gitlab UI
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Setting the stage
- I can't use Git Bundles on the system (I know, pretty unfortunate).
- I use self-hosted Gitlab in two environments.
- Gitlab Webhooks are used to generate a Git Patch on PR, then utilize a script to apply the patch like so:
git am --keep-non-patch --committer-date-is-author-date ${path-to-patch}
.
The Issue
I'd expect that, regardless of where the commit was made (locally or in the Gitlab UI), the commit hash from the generated patch would match in each environment.
When applying the Git Patch, the commit hashes match in all use-cases, but one: when making a commit via the Gitlab UI. The commit hashes don't match when applied on the other system. When I run git log --format=raw
, all of the fields (tree, parent, author, committer) match perfectly on both systems, but the commit hash changes. There is no obviously discernible difference between the applied patches on either end.
What I've Tried
After force-apply pushing to a previous commit, I reapplied the patch locally and it resulted in a different hash. However, the patch would then match on the other environment.
Desired Outcome
The patches that are generated by the commits, regardless of how the commit is created, should match the commit hash.