From a48fe12661e9d5638b6bb9c6ff2837dcde90fcad Mon Sep 17 00:00:00 2001 From: Lucas Peter Date: Wed, 12 Mar 2025 14:20:47 +0100 Subject: [PATCH] Add files to commit/stage if modified --- format_code.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/format_code.sh b/format_code.sh index bbc7ebd..a91de93 100644 --- a/format_code.sh +++ b/format_code.sh @@ -120,6 +120,11 @@ for file in "${files[@]}"; do ((errors++)) ${DRY_RUN} && echo "❌ Problème détecté : ${file}" fi + + if [[ "${DRY_RUN}" == false ]] && ! git diff --quiet "${file}"; then + git add "${file}" + ${VERBOSE} && echo "📥 Ajout de ${file} au staging" + fi done if [[ ${errors} -gt 0 ]]; then