leoafarias / fvm

Flutter Version Management: A simple CLI to manage Flutter SDK versions.
https://fvm.app
MIT License
4.7k stars 229 forks source link

Ambiguous argument - tag not resolved in custom repository #750

Closed oravecz closed 4 months ago

oravecz commented 4 months ago

Describe the bug I am using a custom github repository (FLUTTER_GIT_URL) for approved versions of Flutter within our organization. I have deployed the 3.22.2 version of Flutter to this repository, and I am attempting to install this version using FVM.

Expected behavior I am expecting the cache to contain the specified version of the repository, but it does not.

I would like to know what git command is actually running, so I can run it manually and identify the issue.

The tag seems to be setup correctly on the repository

export FLUTTER_GIT_URL=https://github.com/MyCustomOrg/flutter.git
% git ls-remote --tags $FLUTTER_GIT_URL
    bdcab0680a2f4ad29e2992186d08536fee0f23a3    refs/tags/3.22.2

I am able to manually checkout the repository using what I would assume fvm might be using.

% git clone --branch 3.22.2 $FLUTTER_GIT_URL
Cloning into 'flutter'...
remote: Enumerating objects: 19330, done.
remote: Counting objects: 100% (2550/2550), done.
remote: Compressing objects: 100% (2134/2134), done.
remote: Total 19330 (delta 466), reused 1411 (delta 314), pack-reused 16780
Receiving objects: 100% (19330/19330), 51.52 MiB | 2.49 MiB/s, done.
Resolving deltas: 100% (9843/9843), done.
Note: switching to 'bdcab0680a2f4ad29e2992186d08536fee0f23a3'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

Updating files: 100% (8225/8225), done.

Logs

% fvm --verbose install 3.22.2

Argument information:
  Top level options:
  - verbose: true

Command: install

Syncing local mirror...
Installing Flutter SDK: SDK Version : 3.22.2
Cloning into '/Users/Me/.fvm/cache/versions/3.22.2'...
Updating files: 100% (7921/7921), done.
✗ Failed to install 3.22.2 (0ms)
✗ Failed to ensure FlutterVersion(name: 3.22.2, releaseFromChannel: null, type: VersionType.release) is cached.

ProcessException: fatal: ambiguous argument '3.22.2': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
  Command: git reset --hard 3.22.2

Desktop (please complete the following information):

% flutter doctor -v
[✓] Flutter (Channel stable, 3.16.5, on macOS 14.5 23F79 darwin-arm64, locale en-US)
    • Flutter version 3.16.5 on channel stable at /usr/local/myco/flutter
    • Framework revision 1899e8144e (6 months ago), 2024-01-04 10:06:53 -0500
    • Engine revision 3f3e560236
    • Dart version 3.2.3
    • DevTools version 2.28.4
    • Pub download mirror https://unpub.dev.aws.myco.net

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/Me/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)
    • All Android licenses accepted.

[!] Xcode - develop for iOS and macOS (Xcode 15.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15A507
    ✗ CocoaPods not installed.
        CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/platform-plugins
      To install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)

[✓] IntelliJ IDEA Ultimate Edition (version 2023.3.2)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin version 78.4.2
    • Dart plugin version 233.15271

[✓] VS Code (version 1.85.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.86.0

[✓] Proxy Configuration
    • HTTP_PROXY is set
    • NO_PROXY contains localhost
    • NO_PROXY contains 127.0.0.1
    • NO_PROXY contains ::1

[✓] Connected device (3 available)
    • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64  • Android 14 (API 34) (emulator)
    • macOS (desktop)             • macos         • darwin-arm64   • macOS 14.5 23F79 darwin-arm64
    • Chrome (web)                • chrome        • web-javascript • Google Chrome 126.0.6478.127

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.
oravecz commented 4 months ago

I have also deleted the git.cache and attempted to install again. Same results.

% fvm install 3.22.2 --verbose  

Argument information:
  Top level options:
  - verbose: true

Command: install

Creating local mirror...
 Compressing objects: [██████████████████████████████████████████████████] 100%
 Receiving objects:   [██████████████████████████████████████████████████] 100%
 Resolving deltas:    [██████████████████████████████████████████████████] 100%
✓ Clone complete
Syncing local mirror...
Installing Flutter SDK: SDK Version : 3.22.2
Cloning into '/Users/Me/.fvm/cache/versions/3.22.2'...
Updating files: 100% (7921/7921), done.
✗ Failed to install 3.22.2 (1ms)
✗ Failed to ensure FlutterVersion(name: 3.22.2, releaseFromChannel: null, type: VersionType.release) is cached.

ProcessException: fatal: ambiguous argument '3.22.2': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
  Command: git reset --hard 3.22.2
oravecz commented 4 months ago

Unsure what the problem was, but I deleted all of my FVM folders, retagged my repository, and it seemed to resolve itself.