在使用 Jenkins 时遇到一些连线问题,
#!/bin/sh
set -x
#initialize environment
export PATH="$HOME/.gem/ruby/2.0.0/bin:$PATH"
export PATH="$HOME/.fastlane/bin:$PATH"
export LC_CTYPE=en_US.UTF-8
cd ~/autobuild/projects/MyAPP
git checkout dev
git reset head --hard
git pull
git shortlog
git log
当我从 Jenkins 作业运行上面的脚本时,它显示 git log 输出正常,但没有显示 git shortlog
。有什么问题吗? MyApp 有数百次提交。
最佳答案
最后我找到了原因,git shortlog
在您直接从终端使用时工作正常,因为,
git help shortlog
节目,
If no revisions are passed on the command line and either standard input is not a terminal or there is no current branch, git shortlog will output a summary of the log read from standard input, without reference to the current repository.
因此在使用 shell 脚本时必须明确提供引用,
git shortlog HEAD
在那种情况下会很好地工作。
关于Git shortlog 不在 Jenkins shell 中显示输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43041659/