Skip to content

Commit

Permalink
Fix corner case related to git+file:// URLs (#1465)
Browse files Browse the repository at this point in the history
  • Loading branch information
mosteo authored Sep 25, 2023
1 parent d6d9a06 commit b3e9966
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 4 deletions.
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

0 comments on commit b3e9966

Please sign in to comment.