If you need to debug the migration process step-by-step, follow this manual procedure to migrate a non-bare git cache (pre-4.0.2) to a bare mirror.
1. Set Environment Variables
To avoid touching your global ~/.fvm directory, use an isolated cache path:
export FVM_CACHE_PATH="$(pwd)/.context/tmp/fvm-migration-cache"
export FVM_USE_GIT_CACHE=true
2. Prepare the Legacy Cache
- Clean slate: Ensure
$FVM_CACHE_PATH is empty. - Seed legacy cache: Activate an FVM version prior to 4.0.2 (e.g.,
4.0.1) to create a non-bare git cache.dart pub global activate fvm 4.0.1
fvm install stable
fvm install <version>
fvm install beta
- Verify legacy state: Ensure
git -C "$FVM_CACHE_PATH/cache.git" config --bool core.bare returns false.
3. Trigger Migration
Run the migration logic from the repository root:
dart pub get
FVM_CACHE_PATH="$FVM_CACHE_PATH" FVM_USE_GIT_CACHE=true \
dart run bin/main.dart install stable
4. Verify Migration Results
- Bare Repository:
git -C "$FVM_CACHE_PATH/cache.git" config --bool core.bare should return true. - Alternates Files: Check that
.git/objects/info/alternates files in the version directories now point to .../cache.git/objects (without the /.git/ segment in the path). - Integrity: Run
git -C "$FVM_CACHE_PATH/cache.git" fsck --connectivity-only to ensure no errors. - SDK Execution: Verify that Flutter binaries in the migrated versions still execute correctly:
"$FVM_CACHE_PATH/versions/stable/bin/flutter" --version