GCommit不能在windows xp下使用fugitive.vim?

问题描述:

我刚刚发现fugitive.vim,这很酷。但是,我遇到了一个问题(这是使用Windows XP,MSYS GIT 1.7,fugitive.vim 1.1和GVIM 7.2)。将文件添加到索引并检查状态工作得很好,但是当我执行:GCommit时,命令提示符闪烁一秒钟,没有任何反应。没有办法输入提交信息,也没有提交。这是一个错误?难道我做错了什么?GCommit不能在windows xp下使用fugitive.vim?

它看起来像是msysgit的issue 428
(从issue 467

通过michaelrgeddes报道,2010年4月7日

哪些步骤将重现该问题?
从CMD壳

set GIT_EDITOR=false 
set ERRORLEVEL= 
git commit 
if errorlevel 1 echo Has an error %ERRORLEVEL% 

希望看到 “有一个错误1”,但没有。

git版本1.7.0.2.msysgit.0在Vista上运行。

很重要,因为它会导致:Gcommit在'fugitive'vim集成中失败。


解决方案:补丁您当前msysgit安装cmd/git.cmd脚本。

cmd/git.cmd | 6个++++ - 1个文件改变时,插入4(+),2个缺失( - )

diff --git a/cmd/git.cmd b/cmd/git.cmd 
index 048f615..8cd4397 100644 
--- a/cmd/git.cmd 
+++ b/cmd/git.cmd 
@@ -19,13 +19,15 @@ 
@rem Set the console codepage to match the GUI codepage. 
@chcp %cp_ansi% > nul 
@git.exe %* 
[email protected] ErrorLevel=%ErrorLevel% 
@rem Restore the original console codepage. 
@chcp %cp_oem% > nul 
@goto quit 

:gui 
@if "%2"=="citool" @goto default 
[email protected] wish.exe "%git_install_root%\libexec\git-core\git-gui" -- %2 %3 %4 %5 %6 %7 %8 %9 
[email protected] /f "tokens=1-1*" %%a in ("%*") do @set args=%%b 
[email protected] "git-gui" wish.exe "%git_install_root%\libexec\git-core\git-gui" -- %args% 

:quit 
[email protected]%COMSPEC% /c exit /b %ErrorLevel% 
[email protected]"%COMSPEC%" /c exit /b %ErrorLevel% 

下面是一个可能的情形,可引起问题,这是我的经验。我在这里列出它,以便它可以帮助其他任何遇到相同问题的人。

它发生了,我安装git后(从http://git-scm.com/下载),我没有设置git全局配置user.email。在我通过命令行安装之后,Gcommit可以工作。所以如果有人遇到同样的问题,请确保您可以从命令行提交,然后尝试Gcommit。