-
Notifications
You must be signed in to change notification settings - Fork 535
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(fluid-build): Fix failures when deleting files (#22226)
We use the `git ls-files` command to enumerate files to work on in various places within the build-tools code. Upon investigation, I determined that _unstaged, deleted files_ are returned by our `git ls-files` usage. This causes failures since most code is expecting all the paths returned to exist, and they throw exceptions when they hit those deleted paths. If the deleted file is _staged_, then git correctly excludes it - this inconsistency has led to a lot of confusing behavior for devs, where things behave differently based on the state of the stage and working directory. Unfortunately I cannot find a single git command that returns all the files we want it to, and none of the ones we don't. So in this change, I updated the places where we call `ls-files` to also use `git status` to enumerate deleted files, staged or not, and remove those from the results of ls-files. I have confirmed this fixes the Biome task caching, which was what I set out to fix. It may also fix some related issues with staged files and policy-check, since policy does use ls-files to enumerate the files to check. However, I didn't have a good repro of that issue, so I can't say for certain it's fixed. I also noticed that some of the uses were checking if the path was a file - that's guaranteed already. git ls-files will not return paths to directories - it tracks files only. I removed that code. There is still code duplication - build-tools and build-cli both have their own git wrappers. The build-cli one is best, because it's built on top of simple-git, so much of the infra that is custom code in build-tools becomes unnecessary in build-cli. Long term we should converge but that's part of the overall "split build-tools into better packages" work. Fixes [AB#10257](https://dev.azure.com/fluidframework/235294da-091d-4c29-84fc-cdfc3d90890b/_workitems/edit/10257), and might also address [AB#6588](https://dev.azure.com/fluidframework/235294da-091d-4c29-84fc-cdfc3d90890b/_workitems/edit/6588), but I don't have a good repro so it's not certain.
- Loading branch information
1 parent
74b4277
commit 610658c
Showing
5 changed files
with
102 additions
and
48 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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