From e11bcec690cc189feab8e01149c4de78db7e912b Mon Sep 17 00:00:00 2001 From: Alex Li Date: Thu, 26 Oct 2023 22:26:16 +0800 Subject: [PATCH] Improve refresh code excerpts when checking codes (#9194) Detecting code excerpts during checking codes would not tell what codes are refreshed during the check. This PR adds `git diff` result to tell the difference. This was inspired during our sync work and implemented in https://github.com/cfug/flutter.cn/pull/1341. --------- Co-authored-by: Anthony Sansone Co-authored-by: Parker Lougheed Co-authored-by: Brett Morgan --- tool/check-code.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tool/check-code.sh b/tool/check-code.sh index 5b4b8c91a8..4c9d7e76fd 100755 --- a/tool/check-code.sh +++ b/tool/check-code.sh @@ -42,9 +42,14 @@ flutter --version if [[ $REFRESH ]]; then echo "=> Refreshing code excerpts..." ( + commitHash=$(git reflog -n1 --format='%h') + git add . + git commit -m "Temporarily commit code excerpt changes" set -x tool/refresh-code-excerpts.sh --keep-dart-tool + git reset --soft $commitHash ) || ( + git --no-pager diff echo "=> ERROR: some code excerpts were not refreshed!" exit 1 )