INFRA: Add new gerrit remote after repo is clone 92/1392/2
authorrobert.tomczyk <robert.tomczyk@est.tech>
Tue, 11 Jun 2019 15:02:26 +0000 (16:02 +0100)
committerrobert.tomczyk <robert.tomczyk@est.tech>
Tue, 18 Jun 2019 09:18:29 +0000 (10:18 +0100)
The gerrit remote have to be added after repo is cloned
to make sure git review have a correct project path
for ONAP repositories on Nordix.

Change-Id: Ie5d1f1d0bf0d2b1902f87c95135084c63e7c748b

onap-reviews/heis-clone.sh

index b1dfca1a4c76c05dbfc1ae522091a92e7118e33e..7c633ad59b00ff62cee49f568ce12683ece1059e 100755 (executable)
@@ -34,8 +34,12 @@ then
 fi
 
 git clone ssh://$1@gerrit.nordix.org:29418/$2 $3
-
 scp -p -P 29418 $1@gerrit.nordix.org:hooks/commit-msg $3/.git/hooks
-
 cd $3
+
+# Adding gerrit remote base on the origin URL to make sure the git review have
+# a correct project path for repositories on Nordix
+gerrit_remote=$(git remote -v | awk ' /^origin.*\(push\)/ { print $2 }')
+git remote add gerrit ${gerrit_remote}
+
 git checkout master