swiftlang / swift-package-manager

The Package Manager for the Swift Programming Language
Apache License 2.0
9.74k stars 1.34k forks source link

Refine error message: "Couldn't checkout revision" on Windows systems #6031

Open Joannis opened 1 year ago

Joannis commented 1 year ago

Description

On Windows (10) systems, it's possible that someone has installed git but has not yet enabled Developer Mode. This causes issues with git creating symlinks during checkout. This is specifically occurring in this checkout command.

Expected behavior

I expect the git command to fail, but it would be nice for junior/hobby developers if the reason could be explained more clearly - on Windows platforms.

Actual behavior

The git command fails, failing the SPM build. But there's no real suggestion on how to fix this.

Steps to reproduce

From Windows (VSCode + Swift Server Workgroup Plugin + Swift 5.7.2)

  1. swift package init --type=executable
  2. Add a dependency on Vapor 4.
  3. Build the empty project and its dependencies

Swift Package Manager version/commit hash

Swift Package Manager - Swift 5.7.1

Swift & OS version (output of swift --version && uname -a)

compnerd.org Swift version 5.7.2 (swift-5.7.2-RELEASE) Target: x86_64-unknown-windows-msvc

Joannis commented 1 year ago

I advice adding an extra log output #if os(Windows) , with a suggestion to enable the developer mode on Windows. Since this is the most likely issue.

tomerd commented 1 year ago

cc @compnerd

compnerd commented 1 year ago

Hmm, I never considered that. I do like the suggestion though. Thanks!