From 30faacea6bf7da5f0a1603607278598d1ec0b3a3 Mon Sep 17 00:00:00 2001 From: Eduardo Almeida Date: Wed, 3 May 2023 00:11:48 +0100 Subject: [PATCH] ci: Optimize fetching upstream/master branch --- utils/tests/gitlab-ci-code-linting.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/utils/tests/gitlab-ci-code-linting.yml b/utils/tests/gitlab-ci-code-linting.yml index 0786acc80..4e8cf44d5 100644 --- a/utils/tests/gitlab-ci-code-linting.yml +++ b/utils/tests/gitlab-ci-code-linting.yml @@ -39,11 +39,9 @@ clang-tidy: --enable-mpi --enable-python-bindings script: - if (git remote | grep -qw upstream) ; then - git remote set-url upstream https://gitlab.com/nsnam/ns-3-dev.git ; - else - git remote add upstream https://gitlab.com/nsnam/ns-3-dev.git ; + git remote remove upstream ; fi - - git fetch upstream $CI_DEFAULT_BRANCH + - git remote add -t $CI_DEFAULT_BRANCH --no-tags -f upstream https://gitlab.com/nsnam/ns-3-dev.git - git diff --name-only upstream/$CI_DEFAULT_BRANCH > $FILES_CHANGED # Run clang-tidy-diff in the opposite cases of the if-else below. @@ -94,11 +92,10 @@ spell-check: script: # Get commit messages - if (git remote | grep -qw upstream) ; then - git remote set-url upstream https://gitlab.com/nsnam/ns-3-dev.git ; - else - git remote add upstream https://gitlab.com/nsnam/ns-3-dev.git ; + git remote remove upstream ; fi - - git fetch upstream master + - git remote add -t $CI_DEFAULT_BRANCH --no-tags -f upstream https://gitlab.com/nsnam/ns-3-dev.git + - git log --pretty=%B HEAD...upstream/master ^upstream/master > git_messages.txt # Check source code and commit messages - codespell -f -C0 ./