我正在尝试获取有关特定提交的信息。如何在命令行中添加管道?
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>...]
答案 0 :(得分:0)
可以尝试更改如下,即使用列表
从:
commandLine 'git', 'log', '--decorate', '|', 'grep', commit
为:
commandLine ['git', 'log', '--decorate', '|', 'grep', 'commit']