Skip to content

Fix git diff bug that prevented restart push to mpas-ci-data - #12

Merged
cenamiller merged 1 commit into
masterfrom
fix-restart-push
Mar 25, 2026
Merged

Fix git diff bug that prevented restart push to mpas-ci-data#12
cenamiller merged 1 commit into
masterfrom
fix-restart-push

Conversation

@cenamiller

Copy link
Copy Markdown
Collaborator

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 --quiet to check if the restart file changed. But git diff only compares tracked files. When the restart file is new (untracked), git diff always reports "no changes" and the push is skipped. This is why mpas_ect_summary_120km_restart.nc has never appeared in mpas-ci-data.

Fix: Stage the file first (git add), then use git diff --cached --quiet to 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

  • Merge, then re-run ect-ensemble-gen.yml on master
  • Verify mpas_ect_summary_120km_restart.nc appears in NCAR/mpas-ci-data

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
Copilot AI review requested due to automatic review settings March 25, 2026 18:01
@cenamiller
cenamiller merged commit 9777b18 into master Mar 25, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 --quiet so 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.

@cenamiller
cenamiller deleted the fix-restart-push branch March 27, 2026 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants