[glib: 1/2] Check if the remote already exists before adding it.




commit 81e2fff49cc5e01500557b73c40767ce413c82a1
Author: Frederic Martinsons <frederic martinsons sigfox com>
Date:   Wed Jan 27 08:50:39 2021 +0100

    Check if the remote already exists before adding it.
    
    Signed-off-by: Frederic Martinsons <frederic martinsons sigfox com>

 .gitlab-ci/search-common-ancestor.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/.gitlab-ci/search-common-ancestor.sh b/.gitlab-ci/search-common-ancestor.sh
index 76521f402..a7a3ac44c 100755
--- a/.gitlab-ci/search-common-ancestor.sh
+++ b/.gitlab-ci/search-common-ancestor.sh
@@ -11,7 +11,9 @@ ancestor_horizon=28  # days (4 weeks)
 # Limit the fetch to a certain date horizon to limit the amount of data we get.
 # If the branch was forked from origin/master before this horizon, it should
 # probably be rebased.
-git remote add upstream https://gitlab.gnome.org/GNOME/glib.git
+if ! git ls-remote --exit-code upstream >/dev/null 2>&1 ; then
+    git remote add upstream https://gitlab.gnome.org/GNOME/glib.git
+fi
 git fetch --shallow-since="$(date --date="${ancestor_horizon} days ago" +%Y-%m-%d)" upstream
 
 # Work out the newest common ancestor between the detached HEAD that this CI job


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]