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

tig --first-parent -m does not show diffs like git log -p --first-parent -m #861

Closed
ivan opened this issue Aug 2, 2018 · 2 comments
Closed

Comments

@ivan
Copy link

ivan commented Aug 2, 2018

I use git log -p --first-parent -m to look at a repository that makes heavy use of merges, but of course, I'd much rather be using tig. Unfortunately, tig doesn't show the diffs I expect, and I don't know if this is a bug or some unfortunate defaults that I have to work around.

For background, git log's -m is:

-m
  This flag makes the merge commits show the full diff like regular commits;
  for each merge parent, a separate log entry and diff is generated. An exception
  is that only diff against the first parent is shown when --first-parent option
  is given; in that case, the output represents the changes the merge brought
  into the then-current branch.

Here's a repro case:

git clone https://github.com/NixOS/nixpkgs
cd nixpkgs
git checkout 117680b0e9f4472e6161427ac0814fc2c6f998ba
tig --first-parent -m

and press Enter on the commit.

For NixOS/nixpkgs@117680b, tig --first-parent -m shows a ~27662 line diff, while git log -p --first-parent -m shows the ~45 line diff I expect.

# tig --version
tig version 2.4.0
ncursesw version 6.1.20180127
readline version 6.3

# git --version
git version 2.18.0
@ivan
Copy link
Author

ivan commented Aug 3, 2018

I figured out that git show shows the longer diffs when using git show -m instead of git show --first-parent -m, and that tig is indeed executing git show without --first-parent when showing the commit:

git show --encoding=UTF-8 --pretty=fuller --root --patch-with-stat --show-notes -m --no-color 117680b0e9f4472e6161427ac0814fc2c6f998ba --

I don't know why -m makes it into the arguments but --first-parent doesn't, but as a workaround, I found:

TIG_DIFF_OPTS=--first-parent tig --first-parent -m

@jamescassell
Copy link

Would it be possible to add a keyboard shortcut to enable this mode from within tig?

koutcher added a commit to koutcher/tig that referenced this issue Feb 8, 2019
jonas pushed a commit that referenced this issue Mar 22, 2019
timabell added a commit to timabell/dotmatrix that referenced this issue May 21, 2021
So you can see the patch to mainline.

jonas/tig#861

https://www.git-scm.com/docs/git-log#Documentation/git-log.txt--m

I tried the longer option `diff-merges=separate` but it didn't work, I'm guessing it failed to pass through tig.
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

No branches or pull requests

2 participants