【问题标题】:Git shortlog does not show output in Jenkins shellGit shortlog 不在 Jenkins shell 中显示输出
【发布时间】:2017-08-19 21:07:49
【问题描述】:

在与 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 jenkins terminal command-line-interface git-log


    【解决方案1】:

    我终于找到了原因,git shortlog 在您直接从终端使用时可以正常工作,因为,

    git help shortlog
    

    表演,

    如果没有通过命令行和任一标准传递修订 输入不是终端或没有 当前分支,git shortlog 会输出从标准输入读取的日志摘要,不参考 当前存储库。

    因此,在使用 shell 脚本时,您必须明确提供参考,

    git shortlog HEAD
    

    在这种情况下可以正常工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-04-07
      • 1970-01-01
      • 2015-12-12
      • 2011-11-09
      • 2020-10-27
      • 2017-04-13
      相关资源
      最近更新 更多