From 4f0ebacea6bbdfac625235890965eb4c246a7d04 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 30 Jun 2023 06:33:11 -0700 Subject: [PATCH] .github/workflows/{build,doc-build}.yml: Fix handling of added files --- .github/workflows/build.yml | 4 +++- .github/workflows/doc-build.yml | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ea2cb1aa79d..8d936616077 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -60,11 +60,13 @@ jobs: # (This keeps mtimes of unchanged files unchanged and mtimes of changed files newer than unchanged files.) # Finally we reset the index to "old". (This keeps all mtimes unchanged.) # The changed files now show up as uncommitted changes. + # The final "git add -N" makes sure that files that were added in "new" do not show + # as untracked files, which would be removed by "git clean -fx". git worktree add --detach worktree-image rm -rf /sage/.git && mv worktree-image/.git /sage/ rm -rf worktree-image && ln -s /sage worktree-image if [ ! -f worktree-image/.gitignore ]; then cp .gitignore worktree-image/; fi - (cd worktree-image && git add -A && git commit --allow-empty -m "old" -a && git tag -f old && git reset --hard new && git reset old) + (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) - name: Incremental build, test changed files (sage -t --new) id: incremental diff --git a/.github/workflows/doc-build.yml b/.github/workflows/doc-build.yml index 01748c3c823..140a6ba0ced 100644 --- a/.github/workflows/doc-build.yml +++ b/.github/workflows/doc-build.yml @@ -44,11 +44,13 @@ jobs: # (This keeps mtimes of unchanged files unchanged and mtimes of changed files newer than unchanged files.) # Finally we reset the index to "old". (This keeps all mtimes unchanged.) # The changed files now show up as uncommitted changes. + # The final "git add -N" makes sure that files that were added in "new" do not show + # as untracked files, which would be removed by "git clean -fx". git worktree add --detach worktree-image rm -rf /sage/.git && mv worktree-image/.git /sage/ rm -rf worktree-image && ln -s /sage worktree-image if [ ! -f worktree-image/.gitignore ]; then cp .gitignore worktree-image/; fi - (cd worktree-image && git add -A && git commit --allow-empty -m "old" -a && git tag -f old && git reset --hard new && git reset old) + (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) # Keep track of changes to built HTML (cd /sage/local/share/doc/sage/html/en && find . -name "*.html" | xargs sed -i '/class="sidebar-brand-text"/s/Sage [0-9a-z.]* /Sage dev /'; git init && (echo ".buildinfo"; echo ".inv") > .gitignore; git add -A && git commit --quiet -m "old")