Fix git diff bug that prevented restart push to mpas-ci-data - #12
Merged
Conversation
git diff --quiet only checks tracked files. The restart file is new (untracked) in the cloned mpas-ci-data repo, so git diff always reported "no changes" and the push was silently skipped. Fix by staging the file first (git add), then using git diff --cached to detect changes in the index. Made-with: Cursor
There was a problem hiding this comment.
Pull request overview
Fixes a workflow logic bug where the ECT spin-up restart file upload to NCAR/mpas-ci-data could be silently skipped when the restart file is newly created (untracked), due to relying on git diff against tracked files only.
Changes:
- Stage the restart file before change detection.
- Switch change detection to
git diff --cached --quietso both new and modified restart files are correctly detected and committed.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix a bug in the ECT ensemble generation spinup job that silently skips pushing the restart file to
mpas-ci-data.The "Push restart to mpas-ci-data" step uses
git diff --quietto check if the restart file changed. Butgit diffonly compares tracked files. When the restart file is new (untracked),git diffalways reports "no changes" and the push is skipped. This is whympas_ect_summary_120km_restart.nchas never appeared inmpas-ci-data.Fix: Stage the file first (
git add), then usegit diff --cached --quietto detect changes in the index. This correctly handles both new and modified files.This fix was intended for PR #11 but was pushed after the merge. Cherry-picked here as a standalone fix.
Test plan
ect-ensemble-gen.ymlon mastermpas_ect_summary_120km_restart.ncappears inNCAR/mpas-ci-data