Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge with empty commit changes commit message title #7573

Open
cheng-liven opened this issue Mar 11, 2025 · 4 comments
Open

Merge with empty commit changes commit message title #7573

cheng-liven opened this issue Mar 11, 2025 · 4 comments
Labels
bug Something isn't working feedback requested Feedback was requested to help resolve the issue

Comments

@cheng-liven
Copy link

Version

0.14.10

Operating System

Windows

Distribution Method

msi (Windows)

Describe the issue

See reproduce steps.

Reason for this action: to update the commit time to current time after add more changes to an existing commit.

How to reproduce (Optional)

  1. Create a new commit with changes and commit message title and empty message body
  2. Create a new empty commit above
  3. Merge 1st commit into the empty commit
  4. Now the 1st commit message title become message body in the new commit while new commit message title become empty

Expected behavior (Optional)

Preserve the commit message title. (This was the behaviour prior 0.14.8 I think.)

Relevant log output (Optional)

@cheng-liven cheng-liven added the bug Something isn't working label Mar 11, 2025
@Byron Byron added the feedback requested Feedback was requested to help resolve the issue label Mar 11, 2025
@Byron
Copy link
Collaborator

Byron commented Mar 11, 2025

Thanks a lot for reporting!

I tried to reproduce the issue but failed.

Screen.Recording.2025-03-11.at.11.18.01.mov

Could you have a look at the video and help me understand what went wrong when trying to reproduce the issue? Thank you.

@cheng-liven
Copy link
Author

cheng-liven commented Mar 11, 2025

Hi @Byron , the new commit message looks correct on app UI, however after I push the combined commit to gitlab, the commit title is empty while the old commit title is in the folded "description" on gitlab pages.

If I manually edit the combined commit message again, just "submit" the message dialog directly without change anything, the message will be correct on gitlab after force push the "newly edited" (save message directly without changing anything) commit.

This issue only occurs in recent versions.

Image

@Byron
Copy link
Collaborator

Byron commented Mar 11, 2025

Thanks, that's very helpful!

My first hypothesis is that the UI may show something stale, so after creating a commit that would show up incorrectly in GitLab, but shows correctly in GitButler, could you hit Ctrl + R (or View -> Reload View)? If after reloading the view it still looks correct, there must be something going on with whitespace.

To check whitespace, could you show the last line of this invocation (assuming the commit in question sits directly on a branch named branch):

git cat-file -p branch-name | hexyl

This would show the whitespace in the 'bad' state.

(hexyl can be downloaded here).

Then, after editing the 'broken' commit in the UI, invoke the command again to show the 'good' state.

I'd expect some difference in whitespace. After testing, I already noticed that GitButler leaves two newlines after the message title…

│00000140│ 0a 65 64 69 74 65 64 20 ┊ 69 6e 20 55 49 0a 0a    │_edited ┊in UI__ │

…while Git leaves only one if the body is empty.

│00000440│ 2d 0a 0a 61 64 64 20 62 ┊ 61 72 0a                │-__add b┊ar_     │

Thanks again.

@cheng-liven
Copy link
Author

Refresh View does not change anything and it still looks correct.

On my device: | hexyl gives 3 0a before the title content for the merged commit initially, and after "edit", only 2 0a left before title, "edit" again and it's still 2 0a. Other git branches (without empty titles) also have 2 0a before title. (Ubuntu 22.04 WSL on Windows 11)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feedback requested Feedback was requested to help resolve the issue
Projects
None yet
Development

No branches or pull requests

2 participants