2016-07-29 77 views
2

有沒有人有想法,我該如何解決這個問題? git commit -a -m "message here適合其他項目,以前的提交這一天都沒問題。 現在,它引發錯誤:git commit拋出錯誤'[< - '

Error in [<- (*tmp* , 1, "Date", value = "2016-07-29") :
Indizierung außerhalb der Grenzen
Ausführung angehalten

的錯誤信息是這樣的:

index out of bounds

請讓我知道如果你需要任何進一步的信息。

下面是截圖: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 <[email protected]>, 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") 
} 
+0

缺失「最後有幫助嗎? –

+0

不,我從RStudio和終端嘗試......我也嘗試過'git init',重新啓動RStudio,重啓筆記本電腦,我甚至還原了前一個提交, ,做了一個小改動 - 但即使這樣一個簡單的提交'git commit -a -m「測試」'拋出了錯誤 – Christoph

+1

輸出看起來更像是一個「R」錯誤,而不是git錯誤 也許git鉤子失敗?查看'.git/hooks /'文件夾,你可能會發現一個'prepare-commit-msg'或'pre-commit'文件執行一些R腳本。 欲瞭解更多信息,請參閱https://git-scm.com/ docs/githooks – Carsten

回答

0

感謝@Carsten:使用print聲明,我可以在鉤子文件跟蹤誤差。最後,這是一個愚蠢的錯誤,Datedescription文件中被意外刪除(=缺失)。