From eff0142a226ce6006b26cd4af9daacc4daba70da Mon Sep 17 00:00:00 2001 From: grabowski Date: Mon, 11 Aug 2025 11:36:49 +0700 Subject: [PATCH] Fix git tracking issue in file movement - Replace mv with git mv to preserve git file tracking - Remove unnecessary git add step since git mv automatically stages changes - Fix issue where moved files appeared as deleted in git status - Ensure proper git history preservation when files are reorganized - Files will now show as moved/renamed instead of deleted/added in git log --- .gitea/workflows/auto-sort-files.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/auto-sort-files.yml b/.gitea/workflows/auto-sort-files.yml index 9195f40..bd11fc7 100644 --- a/.gitea/workflows/auto-sort-files.yml +++ b/.gitea/workflows/auto-sort-files.yml @@ -40,7 +40,8 @@ jobs: # Move file if it's not already in the correct location if [ "$src" != "$dest" ] && [ -f "$src" ]; then echo "Moving: $src -> $dest" - mv "$src" "$dest" + # Use git mv to preserve git tracking + git mv "$src" "$dest" return 0 # Success - file was moved fi return 1 # No file moved @@ -85,7 +86,7 @@ jobs: run: | git config --local user.email "${{ vars.WORKER_EMAIL }}" git config --local user.name "${{ vars.WORKER_USERNAME }}" - git add docs/datasheets/ docs/images/ + # git mv already stages the changes, so no need for git add git commit -m "Auto-sort: Move DS_ and IMG_ prefixed files to correct directories - Moved datasheet files (DS_*) to docs/datasheets/