mirror of
https://github.com/denoland/deno.git
synced 2024-11-28 16:20:57 -05:00
fix(compile): do not error embedding same symlink via multiple methods (#27015)
Closes https://github.com/denoland/deno/issues/27012
This commit is contained in:
parent
7456255cd1
commit
02b480b171
3 changed files with 32 additions and 2 deletions
|
@ -329,7 +329,7 @@ impl VfsBuilder {
|
|||
let dir = self.add_dir(path.parent().unwrap())?;
|
||||
let name = path.file_name().unwrap().to_string_lossy();
|
||||
match dir.entries.binary_search_by(|e| e.name().cmp(&name)) {
|
||||
Ok(_) => unreachable!(),
|
||||
Ok(_) => Ok(()), // previously inserted
|
||||
Err(insert_index) => {
|
||||
dir.entries.insert(
|
||||
insert_index,
|
||||
|
@ -341,9 +341,9 @@ impl VfsBuilder {
|
|||
.collect::<Vec<_>>(),
|
||||
}),
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn into_dir_and_files(self) -> (VirtualDirectory, Vec<Vec<u8>>) {
|
||||
|
|
27
tests/specs/compile/include/symlink_twice/__test__.jsonc
Normal file
27
tests/specs/compile/include/symlink_twice/__test__.jsonc
Normal file
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"tempDir": true,
|
||||
"steps": [{
|
||||
"args": "run -A setup.js",
|
||||
"output": "[WILDCARD]"
|
||||
}, {
|
||||
"if": "unix",
|
||||
"args": "compile --allow-read=data --include . --output main link.js",
|
||||
"output": "[WILDCARD]"
|
||||
}, {
|
||||
"if": "unix",
|
||||
"commandName": "./main",
|
||||
"args": [],
|
||||
"output": "1\n",
|
||||
"exitCode": 0
|
||||
}, {
|
||||
"if": "windows",
|
||||
"args": "compile --allow-read=data --include . --output main.exe link.js",
|
||||
"output": "[WILDCARD]"
|
||||
}, {
|
||||
"if": "windows",
|
||||
"commandName": "./main.exe",
|
||||
"args": [],
|
||||
"output": "1\n",
|
||||
"exitCode": 0
|
||||
}]
|
||||
}
|
3
tests/specs/compile/include/symlink_twice/setup.js
Normal file
3
tests/specs/compile/include/symlink_twice/setup.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
Deno.mkdirSync("data");
|
||||
Deno.writeTextFileSync("index.js", "console.log(1);");
|
||||
Deno.symlinkSync("index.js", "link.js");
|
Loading…
Reference in a new issue