File tree Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Original file line number Diff line number Diff line change 22
33set -eo pipefail
44
5- if [[ $# -ne 2 ]]; then
6- echo " usage: $0 [version-file|version] [sha ]"
5+ if [[ $# -ne 1 ]] && [[ $# -ne 2 ]]; then
6+ echo " usage: $0 [version-file|version] [sticky-rev ]"
77 exit 1
88fi
99
2323
2424SCRIPT_DIR=" $( cd -- " $( dirname -- " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd ) "
2525SCRIPT_ROOT=$( realpath " $0 " )
26- ROOT_SHA =" ${2 :- master} "
26+ ROOT_REV =" $2 "
2727ROOT_TS=" "
2828
2929tmp_dir=$( mktemp -d -t ci-XXXXXXXXXX)
3030trap ' cd ; rm -rf $tmp_dir' EXIT
3131
3232perform () {
3333 git clone " git://git.proxmox.com/git/$1 .git" 2> /dev/null
34- if [[ -z " $ROOT_TS " ]]; then
35- if [[ " $ROOT_SHA " == " last" ]]; then
36- ROOT_SHA=" $2 "
37- fi
38- REPO_REV=$( git -C " $1 " rev-parse " $ROOT_SHA " )
39- ROOT_TS=$( git -C " $1 " log -1 --format=%ct " $ROOT_SHA " )
34+
35+ if [[ -z " $ROOT_REV " ]] || [[ -z " $ROOT_TS " ]]; then
36+ REPO_REV=$( git -C " $1 " rev-parse " ${ROOT_REV:- HEAD} " )
37+ ROOT_TS=$( git -C " $1 " log -1 --format=%ct " $REPO_REV " )
4038 else
4139 while read REPO_TS REPO_REV; do
42- if [[ $REPO_TS -le $ROOT_TS ]]; then
43- break
44- fi
40+ [[ $REPO_TS -le $ROOT_TS ]] && break
4541 done < <( git -C " $1 " log --format=" %ct %H" )
4642 fi
4743
You can’t perform that action at this time.
0 commit comments