This is an automated email from the ASF dual-hosted git repository.

aw pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/yetus.git


The following commit(s) were added to refs/heads/main by this push:
     new 3b71df9  YETUS-966. don't reset on FETCH_HEAD for git tags (#138)
3b71df9 is described below

commit 3b71df9c9c3a0a544792342f1257a80e835a88c2
Author: Allen Wittenauer <a...@apache.org>
AuthorDate: Mon Sep 28 13:23:46 2020 -0700

    YETUS-966. don't reset on FETCH_HEAD for git tags (#138)
    
    Signed-off-by: Nick Dimiduk <ndimi...@apache.org>
---
 precommit/src/main/shell/robots.d/githubactions.sh |  8 --------
 precommit/src/main/shell/test-patch.sh             | 21 +++++++++++++--------
 2 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/precommit/src/main/shell/robots.d/githubactions.sh 
b/precommit/src/main/shell/robots.d/githubactions.sh
index f8ef479..eab4875 100755
--- a/precommit/src/main/shell/robots.d/githubactions.sh
+++ b/precommit/src/main/shell/robots.d/githubactions.sh
@@ -70,14 +70,6 @@ if [[ "${GITHUB_ACTIONS}" == true ]] &&
     GITHUB_TOKEN \
     GITHUB_WORKSPACE
 
-  if [[ -d ${BASEDIR}/.git ]]; then
-    echo "Updating the local git repo to include all branches/tags:"
-    pushd "${BASEDIR}" >/dev/null || exit 1
-    "${GIT}" config --replace-all remote.origin.fetch 
+refs/heads/*:refs/remotes/origin/*
-    "${GIT}" fetch --tags
-    popd >/dev/null || exit 1
-  fi
-
   yetus_add_array_element EXEC_MODES GitHubActions
 fi
 
diff --git a/precommit/src/main/shell/test-patch.sh 
b/precommit/src/main/shell/test-patch.sh
index 038f7fc..2b40249 100755
--- a/precommit/src/main/shell/test-patch.sh
+++ b/precommit/src/main/shell/test-patch.sh
@@ -1266,7 +1266,7 @@ function git_checkout
     # we need to explicitly fetch in case the
     # git ref hasn't been brought in tree yet
     if [[ ${GIT_OFFLINE} == false ]]; then
-      if ! "${GIT}" pull --rebase; then
+      if ! "${GIT}" pull --rebase --tags --force; then
           yetus_error "ERROR: git pull is failing"
           cleanup_and_exit 1
       fi
@@ -1288,14 +1288,19 @@ function git_checkout
       # protected by OFFLINE == false
 
       if [[ "${GIT_OFFLINE}" == false ]]; then
-        if ! "${GIT}" fetch; then
-          yetus_error "ERROR: git fetch is failing"
-          cleanup_and_exit 1
-        fi
 
-        if ! "${GIT}" reset --hard FETCH_HEAD; then
-          yetus_error "ERROR: git reset is failing"
-          cleanup_and_exit 1
+        # if it is a tag, then the pull rebase should have done
+        # the trick already
+        if [[ ! -f ".git/refs/tags/${PATCH_BRANCH}" ]]; then
+          if ! "${GIT}" fetch; then
+            yetus_error "ERROR: git fetch is failing"
+            cleanup_and_exit 1
+          fi
+
+          if ! "${GIT}" reset --hard FETCH_HEAD; then
+            yetus_error "ERROR: git reset is failing"
+            cleanup_and_exit 1
+          fi
         fi
       fi
 

Reply via email to