foundry-rs / foundry

Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
https://getfoundry.sh
Apache License 2.0
8.29k stars 1.75k forks source link

`forge install smartcontractkit/ccip@contracts-ccip/v1.2.1` fails with "remote: Not Found" due to tag name containing "/" #5996

Closed DJViau closed 1 week ago

DJViau commented 1 year ago

Component

Forge

Have you ensured that all of these are up to date?

What version of Foundry are you on?

forge 0.2.0 (2fc85cb 2023-10-05T00:18:04.223871000Z)

What command(s) is the bug in?

forge

Operating System

macOS (Apple Silicon)

Describe the bug

forge install transmissions11/solmate@branch/name/with-slashes fails but forge install transmissions11/solmate@branch-name-with-dashes works.

The first outputs the erroneous message:

Installing with-slashes in /Users/user/path/project/lib/with-slashes (url: Some("https://github.com/transmissions11/solmate@branch/name/with-slashes"), tag: None)
...

The second outputs the expected message:

Installing solmate in /Users/user/path/project/lib/solmate (url: Some("https://github.com/transmissions11/solmate"), tag: Some("branch-name-with-dashes"))
...

I'm inferring that forge is splitting on / naively, which is messing up accessing the repo name and the tag.

Edit:

This was clarified here: https://github.com/foundry-rs/foundry/issues/5996#issuecomment-2010030371

mattsse commented 1 year ago

but https://github.com/transmissions11/solmate@branch/name/with-slashes does not exist

what am I missing?

jaketimothy commented 10 months ago

Would love this. Example: https://github.com/smartcontractkit/ccip/releases/tag/contracts-ccip%2Fv1.2.1

Evalir commented 10 months ago

Closing, cannot reproduce

bayological commented 10 months ago

@Evalir

Closing, cannot reproduce

This is still an issue, and I'm currently experiencing it, can this be reopened. I have two branches, develop & feat/tokenWork, on this repo that can be used to reproduce.

Running the following works fine: forge install mento-protocol/mento-core@develop

But running the install command using the branch that includes a slash I get this: forge install mento-protocol/mento-core@feat/tokenWork

image

In the error logs you can see it cannot find the repository https://github.com/mento-protocol/mento-core@feat/tokenWork/ which is correct as that is not the correct URL for the branch. The correct URL is https://github.com/mento-protocol/mento-core/tree/feat/tokenWork

Forge version is: forge 0.2.0 (0f20cc6 2024-01-03T00:16:29.596863086Z) Operating System : Ubuntu 22.04.3 LTS

Evalir commented 10 months ago

interesting, thanks for reporting @bayological — will reopen

matYang commented 7 months ago

+1 here, we've found that if the tag name contains the character "/", forge install is unable to parse it, e.g. for a valid tag name of contracts-ccip/v1.2.1

forge install smartcontractkit/ccip@contracts-ccip/v1.2.1

foundry fails to parse the tag

Installing v1.2.1 in /Users/mattyang/Desktop/code/experiments/foundry-learn/foundry-starter-kit/lib/v1.2.1 (url: Some("https://github.com/smartcontractkit/ccip@contracts-ccip/v1.2.1"), tag: None)

then git cmd exits with code 128. This is not a problem if tag name does not contain "/"

grandizzy commented 1 week ago

I considered adding a @tag= / @branch= arg but I think the UX friendly way (and already supported) is to specify the full path, for example

forge install smartcontractkit/ccip@contracts-ccip/v1.2.1

is actually

forge install smartcontractkit/ccip/releases/tag/contracts-ccip/v1.2.1

and a specific branch can be installed as

forge install smartcontractkit/ccip/tree/ng/memory-fix

We could though add options for forge install smartcontractkit/ccip@tag=contracts-ccip/v1.2.1 or forge install smartcontractkit/ccip@branch=ng/memory-fix if better UX

@mattsse @zerosnacks @yash-atreya pls chime in

mattsse commented 1 week ago

introducing @tag etc makes sense to me