Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected resolving behavior for non-exist branch dependency #8226

Open
1 task done
Kyle-Ye opened this issue Jan 16, 2025 · 0 comments
Open
1 task done

Unexpected resolving behavior for non-exist branch dependency #8226

Kyle-Ye opened this issue Jan 16, 2025 · 0 comments
Labels

Comments

@Kyle-Ye
Copy link
Contributor

Kyle-Ye commented Jan 16, 2025

Is it reproducible with SwiftPM command-line tools: swift build, swift test, swift package etc?

  • Confirmed reproduction steps with SwiftPM CLI. The description text must include reproduction steps with either of command-line SwiftPM commands, swift build, swift test, swift package etc.

Description

We using package(url:branch:) API and specify a non-exist branch (existing as a tag) the package resolution is expected to fail.

eg.

  dependencies: [
      .package(url: "https://github.com/swiftlang/swift-markdown.git", branch: "0.5.0"),
  ],

Expected behavior

Fail with error message - No branch named "0.5.0" can be found on swift-markdown repo.

Actual behavior

Resolve and update Package.resolved file successfully.

  {
    "identity" : "swift-markdown",
    "kind" : "remoteSourceControl",
    "location" : "https://github.com/swiftlang/swift-markdown.git",
    "state" : {
      "branch" : "0.5.0",
      "revision" : "8f79cb175981458a0a27e76cb42fee8e17b1a993"
    }
  },

Steps to reproduce

mkdir DemoKit
cd DemoKit
swift package init
# Update the Package.swift file
vim Package.swift

Add the following code after products

    dependencies: [
        .package(url: "https://github.com/swiftlang/swift-markdown.git", branch: "0.5.0"),
    ],

Swift Package Manager version/commit hash

No response

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

swift-driver version: 1.115.1 Apple Swift version 6.0.3 (swiftlang-6.0.3.1.10 clang-1600.0.30.1)
Target: arm64-apple-macosx15.0
Darwin <redacted>.local 24.2.0 Darwin Kernel Version 24.2.0: Fri Dec  6 18:56:34 PST 2024; root:xnu-11215.61.5~2/RELEASE_ARM64_T6020 arm64
@Kyle-Ye Kyle-Ye added the bug label Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant