git commit抛出错误'[< - '

时间:2016-07-29 11:53:25

标签: r windows git rstudio githooks

有人有想法,我该如何解决这个问题? git commit -a -m "message here适用于其他项目,而且此前的提交都可以。 现在,它抛出了错误:

  

[<-中的错误(*tmp*,1,“日期”,值=“2016-07-29”):
  IndizierungaußerhalbderGrenzen
  Ausführungangehalten

错误消息类似于:

  

索引越界

如果您需要任何进一步的信息,请与我们联系。

以下是截图:enter image description here

编辑:@Carsten猜对了!我有一个钩子跑。但是我不明白为什么它应该停止工作从一个到另一个......(它仍然无效)

#!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")
}

1 个答案:

答案 0 :(得分:0)

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