TeXStudio 4.0:git commit 遇到 GIT_DISCOVERY_ACROSS_FILESYSTEM

TeXStudio 4.0:git commit 遇到 GIT_DISCOVERY_ACROSS_FILESYSTEM

在过去的几年中,我成功地在 Fedora Linux 系统上使用了一个 TeXstudio 脚本,灵感来自https://ritm.knu.ua/general/how-to-use-git-with-texstudio/允许我提交更改所有文件将 tex 文件的文件夹中复制到该文件夹​​中的 git 存储库(指定.gitignore不提交哪些文件)。

我使用了带触发器的宏?close-file和此脚本

%SCRIPT
dialog = new UniversalInputDialog()
dialog.setWindowTitle("Git commit all")
dialog.add("Committed within TeXstudio", "Comment", "comment")
if (dialog.exec() != 0) {
    comment = dialog.get("comment")
    buildManager.runCommand("git commit -a -m \"" + comment + "\" > txs:///messages", editor.fileName())
}

最近,它停止了工作,尽管我不知道我是否会改变底层的 git 系统(尽管自动软件更新可能会改变一些东西)。

我现在收到此错误信息

Process started: git commit -a -m "test"

fatal: not a git repository (or any parent up to mount point /) Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
Process exited with error(s)

但是,在 shell 中,该命令git commit -a -m "test"在 tex 文件所在的目录中运行正常。因此,我得出结论,该文件夹确实是(分配的)git repo。

当我将宏元素更改buildManager.runCommand("git commit -a -m \"" + comment + "\" > txs:///messages", editor.fileName())为时, buildManager.runCommand("**pwd;**git commit -a -m \"" + comment + "\" > txs:///messages", editor.fileName())出现此错误。

 results in 'Error: Could not start the command: pwd;git commit -a -m "test"'. 

并且,如果我在最后指定pwd,即buildManager.runCommand("git commit -a -m \"" + comment + "\"; pwd > txs:///messages", editor.fileName())我得到

Process started: git commit -a -m "test"; pwd

fatal: not a git repository (or any parent up to mount point /) Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
Process exited with error(s)

因此,关键问题是,我是否需要重写脚本以便 TeXstudio 能够成功与文件夹及其 git repo 交互? 怎么做?

答案1

根据来自 github 开发页面的反馈https://github.com/texstudio-org/texstudio/issues/1873我现在用buildManager.runCommand(whatever,editor.fileInfo())

因此,带有触发器的宏?close-file现在调用此脚本

%SCRIPT
dialog = new UniversalInputDialog()
dialog.setWindowTitle("Git commit all")
dialog.add("Committed within TeXstudio", "Comment", "comment")
if (dialog.exec() != 0) {
    comment = dialog.get("comment")
    buildManager.runCommand("git commit -a -m \"" + comment + "\" > txs:///messages", editor.fileInfo())
}

相关内容