Skip to content

Commit 893f8ea

Browse files
CR-18248 -- gerrit (#53)
* add ability to fetch gerrit Change branch * bump version
1 parent aca2641 commit 893f8ea

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

service.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version: 10.1.17
1+
version: 10.1.18

start.sh

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,18 @@ delete_process_lock_files () {
6464
fi
6565
}
6666

67+
git_checkout () {
68+
revision="$REVISION"
69+
# when revision is Gerrit branch we need to fetch it explicitly
70+
if [[ "$REVISION" =~ ^refs/changes/[0-9]+/[0-9]+/[0-9]+$ ]]; then
71+
echo "Fetching Gerrit Change ref: $REVISION"
72+
git_retry git fetch origin $REVISION
73+
revision="FETCH_HEAD"
74+
fi
75+
76+
git checkout $revision
77+
}
78+
6779
trap exit_trap EXIT
6880
set -e
6981

@@ -165,7 +177,7 @@ if [ -d "$CLONE_DIR" ]; then
165177
if [ -n "$REVISION" ]; then
166178

167179
echo "Updating repository to revision $REVISION"
168-
git checkout $REVISION
180+
git_checkout
169181

170182
CURRENT_BRANCH="`git branch 2>/dev/null | grep '^*' | cut -d' ' -f2-`"
171183

@@ -184,7 +196,7 @@ if [ -d "$CLONE_DIR" ]; then
184196
cd $CLONE_DIR
185197

186198
if [ -n "$REVISION" ]; then
187-
git checkout $REVISION
199+
git_checkout
188200
fi
189201
fi
190202
else
@@ -193,7 +205,7 @@ else
193205
eval $GIT_COMMAND
194206
cd $CLONE_DIR
195207
if [ -n "$REVISION" ]; then
196-
git checkout $REVISION
208+
git_checkout
197209
fi
198210

199211
fi

0 commit comments

Comments
 (0)