Skip to content

Conversation

@stefanhaller
Copy link
Collaborator

  • PR Description

The detection of the first pushed commit (commits above this are colored red,
below this yellow) didn't work for the sub-commits view of the branches panel.

In the following picture, the coloring is correct for the local commits panel,
but not for the branches panel when showing the same branch. This PR fixes that.

image

  • Please check if the PR fulfills these requirements
  • Cheatsheets are up-to-date (run go run scripts/cheatsheet/main.go generate)
  • Code has been formatted (see here)
  • Tests have been added/updated (see here for the integration test guide)
  • Text is internationalised (see here)
  • Docs (specifically docs/Config.md) have been updated if necessary
  • You've read through your own file changes for silly mistakes etc

@github-actions
Copy link
Contributor

github-actions bot commented Feb 18, 2023

Uffizzi Preview Environment

☁️ https://app.uffizzi.com/github.com/jesseduffield/lazygit/pull/2448

⚙️ Updating now by workflow run 4211348134.

What is Uffizzi? Learn more

The test shows that we are using "refs/heads/mybranch"@{u} in the git merge-base
call that tries to determine the first pushed commit. This doesn't work, the
@{u} suffix only works with short ref names. We'll fix this in the next commit.
…panel

The detection of the first pushed commit (commits above this are colored red,
below this yellow) didn't work for the sub-commits view of the branches panel.
The reason is that we were calling

  git merge-base refs/heads/mybranch refs/heads/mybranch@{u}

to detect the merge base; this doesn't work, the @{u} prefix only works for
short ref names, not full refs. So change the call to

  git merge-base refs/heads/mybranch mybranch@{u}
@stefanhaller stefanhaller force-pushed the fix-getFirstPushedCommit-in-branches-panel branch from 7b40d20 to 401d3f4 Compare February 18, 2023 13:12
@jesseduffield
Copy link
Owner

Nice work! I had no idea this would be such a simple change. I'm gonna squash+merge cos the test may as well live in the same commit as the code it's testing

@jesseduffield jesseduffield merged commit 979c3d6 into jesseduffield:master Feb 18, 2023
@stefanhaller stefanhaller deleted the fix-getFirstPushedCommit-in-branches-panel branch February 19, 2023 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants