File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,32 @@ configure_git_global "${git_config_payload}"
36
36
37
37
destination=$TMPDIR /git-resource-repo-cache
38
38
39
+ # Optimization when last commit only is checked and skip ci is disabled
40
+ # Get the commit id with git ls-remote instead of downloading the whole repo
41
+ if [ " $skip_ci_disabled " = " true" ] && \
42
+ [ " $version_depth " = " 1" ] && \
43
+ [ " $paths " = " ." ] && \
44
+ [ -z " $ignore_paths " ] && \
45
+ [ -z " $tag_filter " ] && \
46
+ [ -z " $tag_regex " ] && \
47
+ jq -e ' length == 0' <<< " $filter_include" && \
48
+ jq -e ' length == 0' <<< " $filter_exclude"
49
+ then
50
+ branchflag=" HEAD"
51
+ if [ -n " $branch " ]; then
52
+ branchflag=" $branch "
53
+ fi
54
+ commit=$( git ls-remote $uri $branchflag | awk ' NR<=1{print $1}' )
55
+ if [ -z " $commit " ]; then
56
+ echo " No commit returned. Invalid branch?"
57
+ exit 1
58
+ fi
59
+ if [ -z " $ref " ] || [ " $ref " = " $commit " ]; then
60
+ echo $commit | jq -R ' .' | jq -s " map({ref: .})" >&3
61
+ exit 0
62
+ fi
63
+ fi
64
+
39
65
tagflag=" "
40
66
if [ -n " $tag_filter " ] || [ -n " $tag_regex " ] ; then
41
67
tagflag=" --tags"
You can’t perform that action at this time.
0 commit comments