Documented in `man git`, though not that using `git difftool` sets the 
variable. 

On Sunday, February 26, 2023 at 10:16:01 PM UTC-5 Gary Johnson wrote:

> On 2023-02-26, Gary Johnson wrote:
> > On 2023-02-26, huang bin bin wrote:
> > > Steps to reproduce
> > > 
> > > 1.git config difftool = vimdiff ,
> > > 2.use git difftool open vimdiff compare git index file .
> > > 3. execute :r ! git diff or !git diff > newfile then you will see bash 
> get
> > > hung, it can't back to vim . yout will have to ctrl+z to back terminal 
> ,but vim
> > > and previous bash process still alive background.
> > > 
> > > by the way, use vim without git , this bug can't reproduct,even in 
> vimdiff mode
> > > 
> > > Expected behaviour
> > > 
> > > git difftool = vimdiff
> > > compare git index , can use "!git diff >newfile" write data to a new 
> file
> > > 
> > > Version of Vim
> > > 
> > > VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Jul 25 2021 21:26:36)
> > > 
> > > Environment
> > > 
> > > windows
> > > git bash
> > > xterm
> > 
> > I can reproduce this with:
> > 
> > - Vim 9.0.1355
> > - Git 2.34.1
> > - Ubuntu 22.04
> > 
> > I made sure my vimrc was not a factor by creating a file named vim
> > in my home directory:
> > 
> > #!/bin/bash
> > exec /usr/local/bin/vim -N -u NONE -i NONE "$@"
> > 
> > and starting git like this:
> > 
> > $ PATH=$HOME:$PATH git difftool
> > 
> > :r!git diff
> > 
> > I did notice that with my normal vimrc, the ":r!git diff" command
> > does not hang Vim, but instead inserts these three lines into the
> > buffer:
> > 
> > Vim: Warning: Output is not to a terminal
> > ^[[24;1H^[[23;2t^[[23;1t^[[J2 files to edit
> > fatal: external diff died, stopping at src/search.c
> > 
> > where those ^[ are Vim's rendering of escape characters and
> > src/search.c is the only modified file in my Vim repo, where I ran
> > these commands. The difference is probably due to some workarounds
> > in my vimrc for other problems Vim has with launching sub-shells.
> > I haven't tried to identify the settings that affect this problem.
>
> This appears to be a bug in git rather than a bug in vim. The 'git
> diff' command normally pipes a context diff to less. Under the
> conditions of this bug report, it appears that git is using 'vim -d
> ...' _and_ piping the output to less. I can't tell exactly what git
> thinks it's doing, but I think I've found a workaround: after
> executing 'git difftool', in Vim, execute:
>
> :unlet $GIT_EXTERNAL_DIFF
>
> before executing ':r!git diff' or any other git command. That could
> probably be put in your vimrc, but I haven't tried that yet to check
> for side-effects.
>
> HTH,
> Gary
>
>

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/9fd1a2ed-260d-4b5c-aa6f-8c9082ea0b2cn%40googlegroups.com.

Raspunde prin e-mail lui