File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -36,15 +36,19 @@ protected function addChange(string $filename, ChangeType $type): void
3636 $ this ->changes [] = ['name ' => $ filename , 'type ' => $ type , 'data ' => filemtime ($ filename )];
3737 }
3838
39- protected function checkFile (string $ file ): void
39+ protected function checkFile (string $ file, bool $ checkForDelete = false ): void
4040 {
41- if (! array_key_exists ($ file , $ this ->files ) && file_exists ($ file )) {
42- $ this ->addChange ($ file , ChangeType::NEW );
41+ if (array_key_exists ($ file , $ this ->files ) && ! file_exists ($ file )) {
42+ $ this ->addChange ($ file , ChangeType::DELETED );
4343 return ;
4444 }
4545
46- if (array_key_exists ($ file , $ this ->files ) && !file_exists ($ file )) {
47- $ this ->addChange ($ file , ChangeType::DELETED );
46+ if ($ checkForDelete ) {
47+ return ;
48+ }
49+
50+ if (!array_key_exists ($ file , $ this ->files ) && file_exists ($ file )) {
51+ $ this ->addChange ($ file , ChangeType::NEW );
4852 return ;
4953 }
5054
@@ -118,7 +122,7 @@ public function checkChanges(): void
118122
119123 // Checks the deleted files
120124 foreach ($ this ->files as $ key => $ file ) {
121- $ this ->checkFile ($ key );
125+ $ this ->checkFile ($ key, true );
122126 }
123127
124128 $ this ->commit ();
You can’t perform that action at this time.
0 commit comments