Upgrade Tool 4.x under Windows not working

Dear cake eaters,

I have a problem migrating/upgrading from cakePHP 3.10.5 to 4.0, because the file_rename action causes an error, which I don’t understand. The operation must be run in a work tree… What is a work tree or how to run the operation there, what is my error with the command?

administrator@a-dc01 MINGW64 /c/xampp/htdocs/cakephp/upgrade (4.x)
$ bin/cake upgrade file_rename locales …/ --verbose
Renaming C:\xampp\htdocs\cakephp\src/Locale
Move C:\xampp\htdocs\cakephp\src/Locale to C:\xampp\htdocs\cakephp\resources/locales
fatal: this operation must be run in a work tree
PHP Fatal error: Uncaught Error: Class “Cake\Upgrade\Command\FatalErrorException” not found in C:\xampp\htdocs\cakephp\upgrade\src\Command\FileRenameCommand.php:330
Stack trace:
#0 C:\xampp\htdocs\cakephp\upgrade\src\Command\FileRenameCommand.php(161): Cake\Upgrade\Command\FileRenameCommand->rename(‘C:\xampp\htdocs…’, ‘C:\xampp\htdocs…’)
#1 C:\xampp\htdocs\cakephp\upgrade\src\Command\FileRenameCommand.php(107): Cake\Upgrade\Command\FileRenameCommand->processLocales()
#2 C:\xampp\htdocs\cakephp\upgrade\vendor\cakephp\cakephp\src\Console\BaseCommand.php(189): Cake\Upgrade\Command\FileRenameCommand->execute(Object(Cake\Console\Arguments), Object(Cake\Console\ConsoleIo))
#3 C:\xampp\htdocs\cakephp\upgrade\vendor\cakephp\cakephp\src\Console\CommandRunner.php(334): Cake\Console\BaseCommand->run(Array, Object(Cake\Console\ConsoleIo))
#4 C:\xampp\htdocs\cakephp\upgrade\vendor\cakephp\cakephp\src\Console\CommandRunner.php(172): Cake\Console\CommandRunner->runCommand(Object(Cake\Upgrade\Command\FileRenameCommand), Array, Object(Cake\Console\ConsoleIo))
#5 C:\xampp\htdocs\cakephp\upgrade\bin\cake.php(12): Cake\Console\CommandRunner->run(Array)
#6 {main}
thrown in C:\xampp\htdocs\cakephp\upgrade\src\Command\FileRenameCommand.php on line 330

Fatal error: Uncaught Error: Class “Cake\Upgrade\Command\FatalErrorException” not found in C:\xampp\htdocs\cakephp\upgrade\src\Command\FileRenameCommand.php:330
Stack trace:
#0 C:\xampp\htdocs\cakephp\upgrade\src\Command\FileRenameCommand.php(161): Cake\Upgrade\Command\FileRenameCommand->rename(‘C:\xampp\htdocs…’, ‘C:\xampp\htdocs…’)
#1 C:\xampp\htdocs\cakephp\upgrade\src\Command\FileRenameCommand.php(107): Cake\Upgrade\Command\FileRenameCommand->processLocales()
#2 C:\xampp\htdocs\cakephp\upgrade\vendor\cakephp\cakephp\src\Console\BaseCommand.php(189): Cake\Upgrade\Command\FileRenameCommand->execute(Object(Cake\Console\Arguments), Object(Cake\Console\ConsoleIo))
#3 C:\xampp\htdocs\cakephp\upgrade\vendor\cakephp\cakephp\src\Console\CommandRunner.php(334): Cake\Console\BaseCommand->run(Array, Object(Cake\Console\ConsoleIo))
#4 C:\xampp\htdocs\cakephp\upgrade\vendor\cakephp\cakephp\src\Console\CommandRunner.php(172): Cake\Console\CommandRunner->runCommand(Object(Cake\Upgrade\Command\FileRenameCommand), Array, Object(Cake\Console\ConsoleIo))
#5 C:\xampp\htdocs\cakephp\upgrade\bin\cake.php(12): Cake\Console\CommandRunner->run(Array)
#6 {main}
thrown in C:\xampp\htdocs\cakephp\upgrade\src\Command\FileRenameCommand.php on line 330

Okay, I found out that this has something to do with the “git mv” command in the FileRenameCommand.php. SInce I am no expert with git I don’t know what a working tree is and also don’t understand the things I quickly googled, so I uncommented the if($this->git) sections in the php and then run the command again.

I know it is not very good, because git showing much new file changes, but I want to migrated the thing and not struggle with git…

4.0 Upgrade Guide - 4.x Have you checked the warning in this part of the documentation?

Is your project folder a git repository? Apparently that’s the problem.

yes i have checked and took care of it