git-split-diffs icon indicating copy to clipboard operation
git-split-diffs copied to clipboard

`git log` breaks echo on terminal (urxvt)

Open fernandocanizo opened this issue 3 years ago • 8 comments

Great tool! :) However it's also used to display git log, and when I do that on my urxvt terminal, which also uses gbt, I get a broken terminal:

  • no echo
  • pressing ENTER on an empty command line doesn't advance the prompt (it seems it's sending only a CR character without the LF one)

Probably both things are caused by the same issue. I have to reset my terminal after each git log, which makes this beautiful tool unusable.

Tried removing the -X | --no-init parameter for less, but the problem persists. So I left it configured as README says:

$ git config --global --get core.pager
git-split-diffs --color | less -RFX

UPDATE: forgot to mention that the terminal doesn't break on git diff, so maybe that's a hint to solve the problem. Obviously git diff does something different than git log.

fernandocanizo avatar May 06 '21 22:05 fernandocanizo

Ah I've run into something like this very occasionally on iTerm2/xterm but haven't been able to repro consistently enough to find a fix. For me, it only occurs when I've been making local changes for a while and then I run git diff for the first time. It stops reproing if I run git diff again. I also don't get the other issues about having to reset my terminal. So maybe they are not the same issue, but I suspect that they are (and I suspect it has to do with an ANSI color sequence being broken up by less or something)

It sounds like you have a consistent repro, do you mind explaining your setup in more detail? And maybe trying a more minimal repro if that's easy? That is, eliminate things like gbt from your bashrc, zshrc and git config and see if it still repros?

banga avatar May 10 '21 02:05 banga

Tried to reproduce it with a minimal setup and I couldn't.

In the process I discovered that I cannot reproduce it on a brand new repository neither on some others I got, but it still breaks on the repository that lead me to file this issue (https://github.com/fernandocanizo/my-env), even if I remove it and re-clone it.

So I guess you can close this. I'll keep investigating why breaks on my repo and will post if I find the problem.

fernandocanizo avatar May 19 '21 17:05 fernandocanizo

Oh I see, thanks. If I can repro consistently that would actually be really useful, so I'll keep this open. Does it break when you show this particular diff: https://github.com/fernandocanizo/my-env/commit/4434b1010d20fe8688eb324d0f8b979329c2dda4. Or is it just anything in that repo?

banga avatar May 21 '21 06:05 banga

No, I checkout on a couple of old commits and it still breaks. I have a witched repo :P

fernandocanizo avatar May 22 '21 18:05 fernandocanizo

I'm consistently seeing this issue as well on windows terminal running bash on ubuntu WSL2. I think I can make a consistent repro; I'll ping back here with the repro when I get it set up.

NorthWindH avatar Jul 21 '21 16:07 NorthWindH

Great, thanks. Please do!

banga avatar Jul 25 '21 17:07 banga

Hey, guys!

Let me chime in on this issue. I was experiencing same issue on my repos on and off but it looked pretty randomly, one time it breaks, next it is not.

What I've found: I'm not sure what mechanics in Less it is but git-log/git-show/git-diff all use Less in such manner that it does not load all log at once if log is large enough. For me it loads only 59 lines of log rightaway (press ctrl-G to see buffer size). If you force Less to load it all going to the very end of the log (pressing shift-G), then exiting Less will keep terminal ok. But if log was not loaded completely into Less buffer then exiting it will break the terminal.

I guess it has something to do with unclosed pipe from git-log to less? But I'm not sure what mechanism is used to 'pause' the pipe if log is large. Any ideas?

morokhovets avatar Sep 28 '21 17:09 morokhovets

I'm having the same issue in Yakuake and Konsole with bash. I can confirm that the issue occurs after I run git log with a (relatively) long history and then press q to quit. The issue does not occur if I go to the end of the log (G) before I close it.

levitsky avatar Nov 22 '21 15:11 levitsky