##// END OF EJS Templates
rhg-cat: fallback when detecting `.` or `..` path segments...
Raphaël Gomès -
r48887:1e008344 default
parent child Browse files
Show More
@@ -46,8 +46,13 b' pub fn run(invocation: &crate::CliInvoca'
46
46
47 let mut files = vec![];
47 let mut files = vec![];
48 for file in file_args.iter() {
48 for file in file_args.iter() {
49 let normalized = cwd.join(&file);
49 // TODO: actually normalize `..` path segments etc?
50 // TODO: actually normalize `..` path segments etc?
50 let normalized = cwd.join(&file);
51 let dotted = normalized.components().any(|c| c.as_os_str() == "..");
52 if file == &"." || dotted {
53 let message = "`..` or `.` path segment";
54 return Err(CommandError::unsupported(message));
55 }
51 let stripped = normalized
56 let stripped = normalized
52 .strip_prefix(&working_directory)
57 .strip_prefix(&working_directory)
53 // TODO: error message for path arguments outside of the repo
58 // TODO: error message for path arguments outside of the repo
@@ -199,6 +199,17 b' Fallback to Python'
199
199
200 [252]
200 [252]
201
201
202 Fallback with shell path segments
203 $ $NO_FALLBACK rhg cat .
204 unsupported feature: `..` or `.` path segment
205 [252]
206 $ $NO_FALLBACK rhg cat ..
207 unsupported feature: `..` or `.` path segment
208 [252]
209 $ $NO_FALLBACK rhg cat ../..
210 unsupported feature: `..` or `.` path segment
211 [252]
212
202 Requirements
213 Requirements
203 $ $NO_FALLBACK rhg debugrequirements
214 $ $NO_FALLBACK rhg debugrequirements
204 dotencode
215 dotencode
General Comments 0
You need to be logged in to leave comments. Login now