gitbutler icon indicating copy to clipboard operation
gitbutler copied to clipboard

GitButler set itself as the only commit author when global git user is not configured

Open cheng-liven opened this issue 1 year ago • 1 comments

Version

0.12.15

Operating System

Windows

Distribution Method

msi (Windows)

Describe the issue

While it's not GitBulter's fault, it's not intuitive to find out what went wrong and how to fix it, as Credit GitButler as the committer is actually off (by default) and set GitButler profile info doesn't fix the problem.

I realized the cause as JetBrain IDE prompts to set global git user info when I try to commit with their git commit feature.

How to reproduce

Commit in a new OS env without git global user/email configured.

Expected behavior

Ask user to set git global user name and email before commit, or use GitButler profile name and email as commit author if git global one not set.

Relevant log output

No response

cheng-liven avatar Jul 29 '24 07:07 cheng-liven

Thanks for reporting! The respective code can be found here, and it's clear it will just default to its own user if no user-information can be found. I absolutely see how this is undesirable and surprising.

https://github.com/gitbutlerapp/gitbutler/blob/6f4a190464c6e9d4afd124013e40111e3a75c4a8/crates/gitbutler-repo/src/repository.rs#L455-L459

I could imagine the function to fail, with a marker so that the frontend can respond to it, helping to set a user instead.

CC @krlvi for good measure.

Byron avatar Jul 29 '24 15:07 Byron