Ver código fonte

fix(build): gracefully skip git checkout in Docker build context where files may not be tracked

kinglee 1 semana atrás
pai
commit
8e30f0b02e
1 arquivos alterados com 6 adições e 1 exclusões
  1. 6 1
      hack/build.sh

+ 6 - 1
hack/build.sh

@@ -35,7 +35,12 @@ function set_version() {
 function restore_version_file() {
   local version_file="${ROOT_DIR}/gpustack/__init__.py"
   local pyproject_file="${ROOT_DIR}/pyproject.toml"
-  git checkout -- "${version_file}" "${pyproject_file}"
+  # In Docker build contexts (bind mounts), files may not be tracked by git.
+  # Since the wheel is already built, restoration is only needed for local dev.
+  if git ls-files --error-unmatch "${version_file}" &>/dev/null && \
+     git ls-files --error-unmatch "${pyproject_file}" &>/dev/null; then
+    git checkout -- "${version_file}" "${pyproject_file}"
+  fi
 }
 
 #