11#! /bin/sh
22
33# ===========================================================================
4- # (c) Copyright IBM Corp. 2017, 2019 All Rights Reserved
4+ # (c) Copyright IBM Corp. 2017, 2020 All Rights Reserved
55# ===========================================================================
66#
77# This code is free software; you can redistribute it and/or modify it
@@ -30,10 +30,12 @@ usage() {
3030 echo " or [email protected] :<namespace>/openj9.git" 3131 echo " -openj9-branch the OpenJ9 git branch: master"
3232 echo " -openj9-sha a commit SHA for the OpenJ9 repository"
33+ echo " -openj9-reference a local repo to use as a clone reference"
3334 echo " -omr-repo the OpenJ9/omr repository url: https://github.com/eclipse/openj9-omr.git"
3435 echo " or [email protected] :<namespace>/openj9-omr.git" 3536 echo " -omr-branch the OpenJ9/omr git branch: openj9"
3637 echo " -omr-sha a commit SHA for the omr repository"
38+ echo " -omr-reference a local repo to use as a clone reference"
3739 echo " -parallel (boolean) if 'true' then the clone j9 repository commands run in parallel, default is false"
3840 echo " "
3941 exit 1
@@ -51,6 +53,7 @@ declare -A default_j9repos=( [openj9]=eclipse/openj9 [omr]=eclipse/openj9-omr )
5153declare -A default_branches=( [openj9]=master [omr]=openj9 )
5254declare -A commands
5355declare -A shas
56+ declare -A references
5457
5558pflag=" false"
5659base_git_url=https://github.com
7881 shas[openj9]=" ${i#* =} "
7982 ;;
8083
84+ -openj9-reference=* )
85+ references[openj9]=" ${i#* =} "
86+ ;;
87+
8188 -omr-repo=* )
8289 j9repos[omr]=" ${i#* =} "
8390 ;;
9097 shas[omr]=" ${i#* =} "
9198 ;;
9299
100+ -omr-reference=* )
101+ references[omr]=" ${i#* =} "
102+ ;;
103+
93104 -parallel=* )
94105 pflag=" ${i#* =} "
95106 ;;
@@ -119,6 +130,9 @@ for i in "${!default_j9repos[@]}" ; do
119130 if [ ${branches[$i]+_} ] ; then
120131 branch=${branches[$i]}
121132 fi
133+ if [ ${references[$i]+_} ] ; then
134+ reference=" --reference ${references[$i]} "
135+ fi
122136
123137 if [ -d ${i} ] ; then
124138 echo
@@ -140,7 +154,7 @@ for i in "${!default_j9repos[@]}" ; do
140154 git_url=" ${j9repos[$i]} "
141155 fi
142156
143- git_clone_command=" ${git} clone --recursive -b ${branch} ${git_url} ${i} "
157+ git_clone_command=" ${git} clone ${reference} --recursive -b ${branch} ${git_url} ${i} "
144158 commands[$i ]=${git_clone_command}
145159
146160 echo
0 commit comments