我想獲取有關特定提交的信息。如何將管道添加到命令行?如何將管道添加到groovy exec命令行?
def getCommitLog(commit){
def stdout = new ByteArrayOutputStream()
exec {
ignoreExitValue true
workingDir 'my_dir'
commandLine 'git', 'log', '--decorate', '|', 'grep', commit
standardOutput = stdout
}
def retval = stdout.toString().trim()
return retval
它拋出這個錯誤:
fatal: ambiguous argument '|': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]
你可以顯示'exec'方法的樣子嗎? –