gitbutler icon indicating copy to clipboard operation
gitbutler copied to clipboard

`commentChar` isn't working in git butler cli

Open UeberTimei opened this issue 6 months ago • 14 comments

Version

but 0.19.10

Operating System

macOS

Distribution Method

dmg (Mac OS - Apple Silicon)

Describe the issue

I used git config --global core.commentChar ";" to set commentChar to ";". I tried to commit with git - it worked. I tried to commit with but - it showed me # as a commentChar instead of ;. I tried something at least with but and wrote but config --global core.commentChar ";" - and of course I got error, because commentChar as a parameter isn't implemented

How to reproduce (Optional)

  1. Set another commentChar - e. g. git config --global core.commentChar ";"
  2. Try to commit anything with but
  3. Got comments with #

Expected behavior (Optional)

  1. Set another commentChar - e. g. git config --global core.commentChar ";"
  2. Try to commit anything with but
  3. Get comments with ;

UeberTimei avatar May 16 '26 13:05 UeberTimei

Im curios what the reason is to changing the comment char. I’ve never needed to do that myself.

davidpdrsn avatar May 16 '26 16:05 davidpdrsn

Im curios what the reason is to changing the comment char. I’ve never needed to do that myself.

I already implemented this feature, and as you can see in pull requst I wrote in "affected issues" section number of the issue, it's "#13845". So, at my work we also use these numbers that indicate issues to navigate through issues. And we write commit messages with them in the start of the commit message.

As far as they written with "#" means when I'm using but commit and write #13845 - made this and that ... - whole message for a commit would be commented. So I need to change commentChar

UeberTimei avatar May 16 '26 18:05 UeberTimei

As far as they written with "#" means when I'm using but commit and write #13845 - made this and that ..., so whole message for a commit would be commented. So I need to change commentChar

That makes sense. Thanks for clarifying.

Makes me wonder if we should instead use a different char/string. Jujutsu uses JJ: which I imagine you're less likely to start lines with. We could use BUT:.

davidpdrsn avatar May 16 '26 19:05 davidpdrsn

I would definitely consider using the common char instead as clearly it is expected that but behaves similar to git as configured, in similar situations, and this seems to be one of them.

To me it seems that would solve the problem at hand and be the least surprising to users, while also being less verbose, i.e. a single characters X vs BUT.

Byron avatar May 16 '26 21:05 Byron

I would definitely consider using the common char instead as clearly it is expected that but behaves similar to git as configured, in similar situations, and this seems to be one of them.

To me it seems that would solve the problem at hand and be the least surprising to users, while also being less verbose, i.e. a single characters X vs BUT.

Ok, then let's leave my solution as is? What else needs to be discussed? I reckon it's just basic setting that must be in git butler CLI

UeberTimei avatar May 17 '26 08:05 UeberTimei

I reckon it's just basic setting that must be in git butler CLI

I disagree. I think if we could find a way to fix your issue without adding more configs then thats better.

davidpdrsn avatar May 17 '26 09:05 davidpdrsn

I reckon it's just basic setting that must be in git butler CLI

I disagree. I think if we could find a way to fix your issue without adding more configs then thats better.

but this is flexability, you can set any comment char that you want, just like in classic git

UeberTimei avatar May 17 '26 11:05 UeberTimei

Taking the role of the moderator here. To me, it seems everybody can have their way.

My suggestion is to support core.commentChar, but to actually treat it as string. Then those who set it get what they set, even if it's a prefix like BUT.

And GitButler can decide what it wants to do if it's unset - it could easily fall back to BUT if that's the desire. I for one would want to change that to something makes my editor highlighting work correctly, and with this suggestion I can (I just set commentChar explicitly).

For this PR it would mean to change char to String.

What do you think @davidpdrsn?

Byron avatar May 17 '26 23:05 Byron

Sure!

davidpdrsn avatar May 18 '26 08:05 davidpdrsn

@Byron @davidpdrsn I made change char to String. Check it out in PR.

UeberTimei avatar May 18 '26 15:05 UeberTimei

I'll take a look!

davidpdrsn avatar May 18 '26 15:05 davidpdrsn

Is there any progress on this? I randomly ran into the same issue and can't figure out how to change the commentChar as of now ...

jwickers avatar Sep 15 '26 02:09 jwickers

Is there any progress on this? I randomly ran into the same issue and can't figure out how to change the commentChar as of now ...

I've implemented this feature and requested review 4 month ago... I guess they don't care.... So I just built git butler locally with this feature and using it, and it works flawlessly. So I guess you can just clone my fork of that repo and just build git butler locally to use that feature.

UeberTimei avatar Sep 23 '26 20:09 UeberTimei

While I understand any frustration coming from not getting something seemingly simple done after such a long time, the reasons for this are often quite mundane, but not caring is not one of them 😅.

I advise against using the fork of @UeberTimei though as the respective PR is conflicting and very old - you wouldn't get the best version of GitButler if built locally. I closed it for now, maybe @davidpdrsn has time to push a substitute, or close this issue if it's not anything he wants to tackle right now.

Byron avatar Sep 24 '26 02:09 Byron