Skip to content

Commit 22693a7

Browse files
author
Release Manager
committed
gh-35865: CI build.yml, doc-build.yml: Fix handling of added files <!-- Please provide a concise, informative and self-explanatory title. --> <!-- Don't put issue numbers in the title. Put it in the Description below. --> <!-- For example, instead of "Fixes #12345", use "Add a new method to multiply two integers" --> ### 📚 Description <!-- Describe your changes here in detail. --> The CI change in #35652 did not handle the case of a PR that adds files correctly: the fallback to the non-incremental build would delete these files. We fix it here. <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes #12345". --> Fixes <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. It should be `[x]` not `[x ]`. --> - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - #12345: short description why this is a dependency - #34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: #35865 Reported by: Matthias Köppe Reviewer(s): Dima Pasechnik
2 parents 55b5385 + 4f0ebac commit 22693a7

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,13 @@ jobs:
6060
# (This keeps mtimes of unchanged files unchanged and mtimes of changed files newer than unchanged files.)
6161
# Finally we reset the index to "old". (This keeps all mtimes unchanged.)
6262
# The changed files now show up as uncommitted changes.
63+
# The final "git add -N" makes sure that files that were added in "new" do not show
64+
# as untracked files, which would be removed by "git clean -fx".
6365
git worktree add --detach worktree-image
6466
rm -rf /sage/.git && mv worktree-image/.git /sage/
6567
rm -rf worktree-image && ln -s /sage worktree-image
6668
if [ ! -f worktree-image/.gitignore ]; then cp .gitignore worktree-image/; fi
67-
(cd worktree-image && git add -A && git commit --allow-empty -m "old" -a && git tag -f old && git reset --hard new && git reset old)
69+
(cd worktree-image && git add -A && git commit --quiet --allow-empty -m "old" -a && git tag -f old && git reset --hard new && git reset --quiet old && git add -N . && git status)
6870
6971
- name: Incremental build, test changed files (sage -t --new)
7072
id: incremental

.github/workflows/doc-build.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,13 @@ jobs:
4444
# (This keeps mtimes of unchanged files unchanged and mtimes of changed files newer than unchanged files.)
4545
# Finally we reset the index to "old". (This keeps all mtimes unchanged.)
4646
# The changed files now show up as uncommitted changes.
47+
# The final "git add -N" makes sure that files that were added in "new" do not show
48+
# as untracked files, which would be removed by "git clean -fx".
4749
git worktree add --detach worktree-image
4850
rm -rf /sage/.git && mv worktree-image/.git /sage/
4951
rm -rf worktree-image && ln -s /sage worktree-image
5052
if [ ! -f worktree-image/.gitignore ]; then cp .gitignore worktree-image/; fi
51-
(cd worktree-image && git add -A && git commit --allow-empty -m "old" -a && git tag -f old && git reset --hard new && git reset old)
53+
(cd worktree-image && git add -A && git commit --quiet --allow-empty -m "old" -a && git tag -f old && git reset --hard new && git reset --quiet old && git add -N . && git status)
5254
# Keep track of changes to built HTML
5355
new_version=$(cat src/VERSION.txt); (cd /sage/local/share/doc/sage/html/en && find . -name "*.html" | xargs sed -i '/class="sidebar-brand-text"/s/Sage [0-9a-z.]* /Sage '$new_version' /'; git init && (echo "*.svg binary"; echo "*.pdf binary") >> .gitattributes && (echo ".buildinfo"; echo '*.inv'; echo '.git*'; echo '*.svg'; echo '*.pdf'; echo '*.png'; echo 'searchindex.js') > .gitignore; git add -A && git commit --quiet -m "old")
5456

0 commit comments

Comments
 (0)