R git提交抛出错误';[<;-&x27;

R git提交抛出错误';[<;-&x27;,r,windows,git,rstudio,githooks,R,Windows,Git,Rstudio,Githooks,有人知道我该如何解决这个问题吗?git commit-a-m”消息在这里对其他项目很好,今天以前的提交都可以。 现在,它抛出错误: [中的错误感谢@Carsten:使用print语句,我可以跟踪钩子文件中的错误。最后,这是一个愚蠢的错误,在描述文件中,Date被意外删除(=缺失)。缺失最后有帮助吗?没有。我尝试了RStudio和终端…我还尝试了一个git init,重新启动RStudio,重新启动笔记本电脑。我甚至还原到上一次提交,拉拽,做了一个微小的更改-但即使是简单的提交git commit

有人知道我该如何解决这个问题吗?
git commit-a-m”消息在这里
对其他项目很好,今天以前的提交都可以。 现在,它抛出错误:


[中的错误感谢@Carsten:使用
print
语句,我可以跟踪钩子文件中的错误。最后,这是一个愚蠢的错误,在
描述
文件中,
Date
被意外删除(=缺失)。

缺失最后有帮助吗?没有。我尝试了RStudio和终端…我还尝试了一个
git init
,重新启动RStudio,重新启动笔记本电脑。我甚至
还原到上一次提交,拉拽,做了一个微小的更改-但即使是简单的提交
git commit-a-m“Test”
抛出了错误。输出看起来更像一个“R”错误大于git错误。可能git钩子失败了?查看文件夹
.git/hooks/
,您可能会发现一个文件
准备提交msg
预提交
正在执行一些R脚本。有关更多信息,请参阅@Carsten:谢谢您的提示。我对R代码感到惊讶,但现在它有意义了。您知道我该怎么做吗解决问题?我贴了钩子,但不知道如何在钩子里大喊大叫。
#!C:/R/R-3.2.2/bin/x64/Rscript

# License: CC0 (just be nice and point others to where you got this)
# Author: Robert M Flight <rflight79@gmail.com>, github.com/rmflight
inc <- TRUE # default
# get the environment variable and modify if necessary
tmpEnv <- as.logical(Sys.getenv("inc"))
if (!is.na(tmpEnv)) {
  inc <- tmpEnv
}

# check that there are files that will be committed, don't want to increment version if there won't be a commit
fileDiff <- system("git diff HEAD --name-only", intern = TRUE)

if ((length(fileDiff) > 0) && inc) {

  currDir <- getwd() # this should be the top level directory of the git repo
  currDCF <- read.dcf("DESCRIPTION")
  currVersion <- currDCF[1,"Version"]
  splitVersion <- strsplit(currVersion, ".", fixed = TRUE)[[1]]
  nVer <- length(splitVersion)
  currEndVersion <- as.integer(splitVersion[nVer])
  newEndVersion <- as.character(currEndVersion + 1)
  splitVersion[nVer] <- newEndVersion
  newVersion <- paste(splitVersion, collapse = ".")
  currDCF[1,"Version"] <- newVersion
  currDCF[1, "Date"] <- strftime(as.POSIXlt(Sys.Date()), "%Y-%m-%d")
  write.dcf(currDCF, "DESCRIPTION")
  system("git add DESCRIPTION")
  cat("Incremented package version and added to commit!\n")
}