Skip to content

Commit

Permalink
Make exclude and paths relative to root of checkout
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-Simulacrum committed Feb 11, 2018
1 parent 8c506f9 commit 11580b7
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/bootstrap/flags.rs
Expand Up @@ -275,7 +275,12 @@ Arguments:
};
// Get any optional paths which occur after the subcommand
let cwd = t!(env::current_dir());
let paths = matches.free[1..].iter().map(|p| cwd.join(p)).collect::<Vec<_>>();
let src = matches.opt_str("src").map(PathBuf::from)
.or_else(|| env::var_os("SRC").map(PathBuf::from))
.unwrap_or(cwd.clone());
let paths = matches.free[1..].iter().map(|p| {
cwd.join(p).strip_prefix(&src).expect("paths passed to be inside checkout").into()
}).collect::<Vec<PathBuf>>();

let cfg_file = matches.opt_str("config").map(PathBuf::from).or_else(|| {
if fs::metadata("config.toml").is_ok() {
Expand Down Expand Up @@ -360,10 +365,6 @@ Arguments:
stage = Some(1);
}

let src = matches.opt_str("src").map(PathBuf::from)
.or_else(|| env::var_os("SRC").map(PathBuf::from))
.unwrap_or(cwd.clone());

Flags {
verbose: matches.opt_count("verbose"),
stage,
Expand All @@ -375,12 +376,14 @@ Arguments:
target: split(matches.opt_strs("target"))
.into_iter().map(|x| INTERNER.intern_string(x)).collect::<Vec<_>>(),
config: cfg_file,
src,
jobs: matches.opt_str("jobs").map(|j| j.parse().unwrap()),
cmd,
incremental: matches.opt_present("incremental"),
exclude: split(matches.opt_strs("exclude"))
.into_iter().map(|p| cwd.join(p)).collect::<Vec<_>>(),
.into_iter().map(|p| {
cwd.join(p).strip_prefix(&src).expect("paths to be inside checkout").into()
}).collect::<Vec<_>>(),
src,
}
}
}
Expand Down

0 comments on commit 11580b7

Please sign in to comment.