GCommit 在 Windows XP 下不能与 fugitive.vim 一起使用吗?

发布于 2024-09-02 13:12:31 字数 207 浏览 0 评论 0原文

我刚刚发现了 fugitive.vim,它非常酷。但是,我遇到了一个问题(这是使用 windows xp、msys git 1.7、fugitive.vim 1.1 和 gvim 7.2)。将文件添加到索引并检查状态效果很好,但是当我执行 :GCommit 时,命令提示符会闪烁一秒钟,但什么也没有发生。无法输入提交消息,也不会提交任何内容。这是一个错误吗?我做错了什么吗?

I've just discovered fugitive.vim, which is pretty cool. However, I've run into a problem (this is using windows xp, msys git 1.7, fugitive.vim 1.1, and gvim 7.2). Adding files to the index and checking the status works just fine, but when I do a :GCommit, a command prompt flashes for a second and nothing happens. No way to type a commit message and nothing is committed. Is this a bug? Am I doing something wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

被翻牌 2024-09-09 13:12:31

它看起来像 msysgit 的第 428 期
(摘自问题 467

由 michaelrgeddes 报告,4 月 7 日, 2010年

什么步骤会重现该问题?
从 cmd shell

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

预计会看到“有错误 1”,但没有。

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

很重要,因为它会导致“逃逸”vim 集成中的 :Gcommit 失败。


解决方案:修补当前 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 %*
+@set ErrorLevel=%ErrorLevel%
 @rem Restore the original console codepage.
 @chcp %cp_oem% > nul
 @goto quit 

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

 :quit
-@%COMSPEC% /c exit /b %ErrorLevel%
+@"%COMSPEC%" /c exit /b %ErrorLevel%

It looks like issue 428 of msysgit.
(From issue 467)

Reported by michaelrgeddes, Apr 07, 2010

What steps will reproduce the problem?
From cmd shell

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

Expect to see "Has an error 1" but don't.

git version 1.7.0.2.msysgit.0 running on Vista.

Important since it causes :Gcommit failure in 'fugitive' vim integration.


Solution: patch the cmd/git.cmd script of your current msysgit installation.

cmd/git.cmd | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)

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 %*
+@set ErrorLevel=%ErrorLevel%
 @rem Restore the original console codepage.
 @chcp %cp_oem% > nul
 @goto quit 

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

 :quit
-@%COMSPEC% /c exit /b %ErrorLevel%
+@"%COMSPEC%" /c exit /b %ErrorLevel%
岁月蹉跎了容颜 2024-09-09 13:12:31

这是我经历过的可能导致该问题的情况。我将其列在这里,以防它可以帮助遇到相同问题的其他人。

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

Here is an possible situation that can cause the problem, which I experienced. I list it here in case it can help any one else that met with the same issue.

It happened that after I installed git (downloaed from http://git-scm.com/), I didn't set the git global config user.email. After I setup that via command line, Gcommit works. So if some one met with the same issue, please make sure that you can commit from command line, and then try Gcommit.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文