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

Fix corner case related to git+file:// URLs in lockfiles #1465

Merged
merged 1 commit into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,30 @@
],
"console": "integratedTerminal",
"justMyCode": false
},
{
"name": "(gdb) Launch alr at /tmp/a/xxx",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/bin/alr",
"args": ["-d", "-vv", "with", "libfoo"],
"stopAtEntry": true,
"cwd": "/tmp/a/xxx",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
}
]
}
6 changes: 4 additions & 2 deletions src/alire/alire-origins.adb
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,10 @@ package body Alire.Origins is
Scheme : constant URI.Schemes := URI.Scheme (URL);
Transformed : constant Alire.URL := VCSs.Git.Transform_To_Public (URL);
VCS_URL : constant String :=
(if Contains (URL, "file:") then
Tail (URL, ':') -- Remove file: that confuses git
(if Contains (URL, "+file://") then
Tail (URL, '+') -- strip the VCS proto only
elsif Contains (URL, "+file:") then
Tail (URL, ':') -- Remove file: w.o. // that confuses git
elsif Has_Prefix (URL, "git@") and then
Transformed /= URL -- known and transformable
then
Expand Down
5 changes: 4 additions & 1 deletion testsuite/tests/get/git-local/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from glob import glob

from drivers.alr import run_alr
from drivers.alr import init_local_crate, run_alr
from drivers.asserts import assert_match
from drivers.helpers import compare, contents

Expand Down Expand Up @@ -36,5 +36,8 @@
'libfoo_1.0.0_9ddda32b/config/libfoo_config.h'
])

# Check as dependency
init_local_crate()
run_alr("with", "libfoo") # should succeed

print('SUCCESS')
2 changes: 1 addition & 1 deletion testsuite/tests/publish/bad-arguments/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

# Bad combo, explicit file + commit
p = run_alr("publish", "file:/fake.zip", "deadbeef", complain_on_error=False)
assert_match(".*Expected a VCS origin but got.*", p.out)
assert_match(".*unknown VCS URL", p.out)

# Bad combo, implicit file + commit
p = run_alr("publish", "fake.zip", "deadbeef", complain_on_error=False)
Expand Down
Loading