|
1 | 1 | //! Tidy check to ensure that `FORMAT_VERSION` was correctly updated if `rustdoc-json-types` was
|
2 | 2 | //! updated as well.
|
3 | 3 |
|
| 4 | +use std::ffi::OsStr; |
| 5 | +use std::path::Path; |
4 | 6 | use std::process::Command;
|
5 | 7 |
|
6 | 8 | use build_helper::ci::CiEnv;
|
7 | 9 | use build_helper::git::{GitConfig, get_closest_upstream_commit};
|
8 | 10 | use build_helper::stage0_parser::parse_stage0_file;
|
9 | 11 |
|
10 |
| -fn git_diff(base_commit: &str, extra_arg: &str) -> Option<String> { |
| 12 | +fn git_diff<S: AsRef<OsStr>>(base_commit: &str, extra_arg: S) -> Option<String> { |
11 | 13 | let output = Command::new("git").arg("diff").arg(base_commit).arg(extra_arg).output().ok()?;
|
12 | 14 | let s = String::from_utf8_lossy(&output.stdout).into();
|
13 | 15 | println!("+++++++++++> {s}");
|
14 | 16 | Some(s)
|
15 | 17 | }
|
16 | 18 |
|
17 |
| -pub fn check(bad: &mut bool) { |
| 19 | +pub fn check(src_path: &Path, bad: &mut bool) { |
18 | 20 | println!("Checking tidy rustdoc_json...");
|
19 | 21 | let stage0 = parse_stage0_file();
|
20 | 22 | let base_commit = match get_closest_upstream_commit(
|
@@ -58,7 +60,7 @@ pub fn check(bad: &mut bool) {
|
58 | 60 | }
|
59 | 61 | }
|
60 | 62 | // Then we check that if `FORMAT_VERSION` was updated, the `Latest feature:` was also updated.
|
61 |
| - match git_diff(&base_commit, "src/rustdoc-json-types") { |
| 63 | + match git_diff(&base_commit, src_path.join("rustdoc-json-types")) { |
62 | 64 | Some(output) => {
|
63 | 65 | let mut format_version_updated = false;
|
64 | 66 | let mut latest_feature_comment_updated = false;
|
|
0 commit comments