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 8b9ea38  YETUS-1064. buf does not generate annotations (#185)
8b9ea38 is described below

commit 8b9ea38cd5c7b56166cf295c344b5931eb71a9f8
Author: Allen Wittenauer <[email protected]>
AuthorDate: Mon Nov 2 06:17:33 2020 -0800

    YETUS-1064. buf does not generate annotations (#185)
---
 precommit/src/main/shell/test-patch.d/buf.sh | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/precommit/src/main/shell/test-patch.d/buf.sh 
b/precommit/src/main/shell/test-patch.d/buf.sh
index b3b2aa9..23682fb 100755
--- a/precommit/src/main/shell/test-patch.d/buf.sh
+++ b/precommit/src/main/shell/test-patch.d/buf.sh
@@ -52,6 +52,12 @@ function buf_parse_args
       ;;
     esac
   done
+
+  if [[ -n "${BUF_BASEDIR}" ]]; then
+    # make sure this is relative and strip any ending /
+    BUF_BASEDIR=$(yetus_abs "${BUF_BASEDIR}")
+    BUF_BASEDIR=$(yetus_relative_dir "${BASEDIR}" "${BUF_BASEDIR}")
+  fi
 }
 
 function buf_filefilter
@@ -131,19 +137,17 @@ function bufcompat_executor
     bufargs+=(--timeout "${BUF_TIMEOUT}")
   fi
 
-  if [[ -n "${BUF_BASEDIR}" ]]; then
-    pushd "${BASEDIR}/${BUF_BASEDIR}" >/dev/null || return 1
-  else
-    pushd "${BASEDIR}" >/dev/null || return 1
-  fi
+  pushd "${BASEDIR}/${BUF_BASEDIR}" >/dev/null || return 1
 
   if [[ "${repostatus}" == "branch" ]]; then
     "${BUF}" image build "${bufargs[@]}" -o "${PATCH_DIR}/buf-image.bin" 2>> 
"${PATCH_DIR}/${bufStderr}"
   elif [[ -f  "${PATCH_DIR}/buf-image.bin" ]]; then
     "${BUF}" check breaking "${bufargs[@]}" \
       --against-input "${PATCH_DIR}/buf-image.bin" \
+      2>> "${PATCH_DIR}/${bufStderr}" \
+    | "${AWK}" "{print \"${BUF_BASEDIR}/\"\$0}" \
       > "${PATCH_DIR}/${repostatus}-bufcompat-result.txt" \
-      2>> "${PATCH_DIR}/${bufStderr}"
+
   fi
 
   popd >/dev/null || return 1
@@ -259,14 +263,11 @@ function buflint_executor
     bufargs+=(--timeout "${BUF_TIMEOUT}")
   fi
 
-  if [[ -n "${BUF_BASEDIR}" ]]; then
-    pushd "${BASEDIR}/${BUF_BASEDIR}" >/dev/null || return 1
-  else
-    pushd "${BASEDIR}" >/dev/null || return 1
-  fi
+  pushd "${BASEDIR}/${BUF_BASEDIR}" >/dev/null || return 1
 
-  "${BUF}" check lint  "${bufargs[@]}" 2>> "${PATCH_DIR}/${bufStderr}" | \
-    "${args[@]}" > "${PATCH_DIR}/${repostatus}-buflint-result.txt"
+  "${BUF}" check lint  "${bufargs[@]}" 2>> "${PATCH_DIR}/${bufStderr}" \
+    | "${AWK}" "{print \"${BUF_BASEDIR}/\"\$0}" \
+    | "${args[@]}" > "${PATCH_DIR}/${repostatus}-buflint-result.txt"
 
   popd >/dev/null || return 1
 

Reply via email to