-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve refresh code excerpts when checking codes #9194
Conversation
Visit the preview URL for this PR (updated for commit a157999): https://flutter-docs-prod--pr9194-feat-improve-refresh-tupn2fio.web.app (expires Thu, 02 Nov 2023 09:44:01 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: d5ba327eec813901cac8396c4f458b02288624ab |
@parlough WDYT about this one? We can also update the code_excerpt_updater tool to output changes. But |
Sorry that I haven't taken a look at this yet. I'm working through a long list of reviews and other work. Without taking a look, adding the support into the tool itself sounds more flexible, but using |
ping @parlough |
Sorry again about the delay... I don't want to land this until #9416 or a similar fix for |
Sounds fair. I'll see if I can manage to make a request this week for the tool. |
Rethink about the diff, there is no proper way (for Dart officials) to diff changes between string content in Dart. The updater only updates files regardless of changes. So it might be better to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry about the delay @AlexV525!
You're right that using git diff
will be much easier and provide better details.
One suggestion and a question, otherwise looks good to me.
) || ( | ||
git --no-pager diff |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this only show the diff if there is an error? I believe if all excerpts were successfully refreshed, it won't result an error, so the diff won't be shown.
Maybe this could be moved directly below the git reset
? It's probably fine if it always runs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this only show the diff if there is an error? I believe if all excerpts were successfully refreshed, it won't result an error, so the diff won't be shown.
IIRC, from actual tests, refreshes will throw exceptions if there are codes been refreshed and return 0
if no codes have been refreshed.
If "successfully refreshed" means there are some changes during the refresh and the process ends properly, that is a misunderstanding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried it out and the diff doesn't seem to run when excerpts were refreshed. I guess that's because executing the refresh script isn't the last executed command in the subshell.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took another look of your suggestion, if all excerpts were refreshed, why the diff is required? The diff flow is only meant to help users to identify not refreshed files.
@@ -42,9 +42,14 @@ flutter --version | |||
if [[ $REFRESH ]]; then | |||
echo "=> Refreshing code excerpts..." | |||
( | |||
commitHash=$(git reflog -n1 --format='%h') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you put this new behavior under a new flag, like --refresh-diff
and then specify that in test.sh
? So that those running this locally can opt in to the behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we opt-in? IMO it should at least opt-out. This is helpful whether we test locally or remotely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's fine too. It would just be nice to have some way to disable it.
Guys, I don't really like merging from the main branch too often. 😄 It'll somehow affect my acknowledgment of my branchs' status. It can be outdated, but without conflicts. |
Keeping PRs up to date enables easier reviewing as the delta is more accurate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think let's try this out then and see in what situations it helps. We can always expand when/where the diff functionality runs in the future.
Thanks for this Alex and again sorry about the wait.
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 cfug/flutter.cn#1341. --------- Co-authored-by: Anthony Sansone <[email protected]> Co-authored-by: Parker Lougheed <[email protected]> Co-authored-by: Brett Morgan <[email protected]>
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 cfug/flutter.cn#1341.
Presubmit checklist