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

forgit log cannot diff merge commits #416

Open
5 of 10 tasks
carlfriedrich opened this issue Dec 28, 2024 · 0 comments · May be fixed by #417
Open
5 of 10 tasks

forgit log cannot diff merge commits #416

carlfriedrich opened this issue Dec 28, 2024 · 0 comments · May be fixed by #417

Comments

@carlfriedrich
Copy link
Collaborator

Check list

  • I have read through the README
  • I have the latest version of forgit
  • I have searched through the existing issues

Environment info

  • OS
    • Linux
    • Mac OS X
    • Windows
    • Others:
  • Shell
    • bash
    • zsh
    • fish

Problem / Steps to reproduce

Merge commits cannot be diffed from within forgit log.

Steps to reproduce:

git init
touch 1.txt
git add 1.txt
git commit -m "Add file 1"
git checkout -b branch
touch 2.txt
git add 2.txt
git commit -m "Add file 2"
git checkout main
git merge --no-ff branch -m "Merge branch"

Afterwards call git forgit log and try to view the merge commit by pressing enter. It does not work (immediately returns).

The reason is that our current implementation using the ^! operator on the commit does not work for merge commits. According to this stack overflow answer there are only three ways to correctly show the diff for a merge commit:

git show -m c05f017
git show --first-parent c05f017
git diff c05f017^ c05f017

A quick fix would be to change our implementation to the third option. The cleaner solution IMO, though, would be to implement a forgit show command. I am planning to do the latter.

carlfriedrich added a commit to carlfriedrich/forgit that referenced this issue Dec 29, 2024
Use the new command in git log enter. This fixes the display of diffs
for merge commits.

Fixes wfxr#416.
@carlfriedrich carlfriedrich linked a pull request Dec 29, 2024 that will close this issue
15 tasks
carlfriedrich added a commit to carlfriedrich/forgit that referenced this issue Jan 1, 2025
Use the new command in git log enter. This fixes the display of diffs
for merge commits.

Fixes wfxr#416.
carlfriedrich added a commit to carlfriedrich/forgit that referenced this issue Jan 4, 2025
Use the new command in git log enter. This fixes the display of diffs
for merge commits.

Fixes wfxr#416.
carlfriedrich added a commit to carlfriedrich/forgit that referenced this issue Jan 4, 2025
Use the new command in git log enter. This fixes the display of diffs
for merge commits.

Fixes wfxr#416.
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 a pull request may close this issue.

1 participant