Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions core-web/.husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ check_sdk_client_affected() {
print_color "$BLUE" "ℹ️ ${file_to_remove} does not exist"
fi

if ! git add "${root_dir}/dotCMS/src/main/webapp/ext/uve/dot-uve.js"; then
if ! git -C "${root_dir}" add -- "dotCMS/src/main/webapp/ext/uve/dot-uve.js"; then
print_color "$RED" "❌ Failed to stage computed dot-uve.js"
exit 1
fi
Expand Down Expand Up @@ -124,7 +124,7 @@ perform_frontend_fixes() {
return 1
else
print_color "$GREEN" "✅ Completed yarn install adding yarn.lock if it was modified"
git add "${root_dir}/core-web/yarn.lock"
git -C "${root_dir}" add -- "core-web/yarn.lock"
fi

if ! yarn nx affected -t lint --exclude='tag:skip:lint' --fix=true; then
Expand All @@ -143,7 +143,7 @@ perform_frontend_fixes() {

for file in $files; do
if echo "$modified_files" | grep -Fxq "$file"; then
if ! git add -- "${root_dir}/${file}"; then
if ! git -C "${root_dir}" add -- "${file}"; then
has_errors=true
fi
else
Expand All @@ -157,7 +157,7 @@ perform_frontend_fixes() {
printf "\n"
for file in "${unmatched_files[@]}"; do
printf " %s\n" "${file}"
git restore "${file}"
git -C "${root_dir}" restore -- "${file}"
done
printf "\n"
print_color "$YELLOW" "💡 You can fix these files by running the following commands:"
Expand Down Expand Up @@ -303,7 +303,7 @@ if needs_maven; then
print_color "$GREEN" "✅ Completed Maven compile with OpenAPI generation"
# Stage the updated OpenAPI file if it was regenerated
if [ -f "${root_dir}/dotCMS/src/main/webapp/WEB-INF/openapi/openapi.yaml" ]; then
git add "${root_dir}/dotCMS/src/main/webapp/WEB-INF/openapi/openapi.yaml"
git -C "${root_dir}" add -- "dotCMS/src/main/webapp/WEB-INF/openapi/openapi.yaml"
print_color "$GREEN" "📋 Updated OpenAPI specification staged for commit"
fi
fi
Expand Down Expand Up @@ -384,7 +384,7 @@ if [ "$backup_untracked" = true ] && [ -n "${untracked_files}" ]; then
cp "${root_dir}/${file}" "${temp_dir}/${file}" # Copy the file to the temp directory, preserving the directory structure
print_color "$BLUE" "💾 Backing up ${file}"
# Restore the original file state in the repo, removing unstaged changes
git restore "${root_dir}/${file}" # Using relative path relative to current directory
git -C "${root_dir}" restore -- "${file}" # use -C to keep git rooted at repo root in worktrees
fi
done

Expand All @@ -393,7 +393,7 @@ if [ "$backup_untracked" = true ] && [ -n "${untracked_files}" ]; then

for file in $untracked_files; do
if echo "${staged_files}" | grep -q "^${file}$"; then
git restore "${root_dir}/${file}" # Using relative path relative to current directory
git -C "${root_dir}" restore -- "${file}" # use -C to keep git rooted at repo root in worktrees
fi
done

Expand Down
Loading