git 提交抛出错误'[<-'
git commit throws error '[<-'
有没有人知道我该如何解决这个问题? git commit -a -m "message here
对其他项目工作正常,并且今天之前的提交都没有问题。
现在,它抛出错误:
Error in [<-
(*tmp*
, 1, "Date", value = "2016-07-29") :
Indizierung außerhalb der Grenzen
Ausführung angehalten
错误信息类似于:
index out of bounds
如果您需要任何进一步的信息,请告诉我。
这是截图:
编辑:@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")
}
感谢@Carsten:使用 print
语句我可以跟踪挂钩文件中的错误。最后这是一个愚蠢的错误,description
文件中的 Date
被意外删除(=丢失)。
有没有人知道我该如何解决这个问题? git commit -a -m "message here
对其他项目工作正常,并且今天之前的提交都没有问题。
现在,它抛出错误:
Error in
[<-
(*tmp*
, 1, "Date", value = "2016-07-29") :
Indizierung außerhalb der Grenzen
Ausführung angehalten
错误信息类似于:
index out of bounds
如果您需要任何进一步的信息,请告诉我。
这是截图:
编辑:@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")
}
感谢@Carsten:使用 print
语句我可以跟踪挂钩文件中的错误。最后这是一个愚蠢的错误,description
文件中的 Date
被意外删除(=丢失)。