gitbutlerapp / gitbutler

The GitButler version control client, backed by Git, powered by Tauri/Rust/Svelte
https://gitbutler.com
Other
12.91k stars 517 forks source link

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

Open cheng-liven opened 2 months ago

cheng-liven commented 2 months ago

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

Byron commented 2 months ago

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.