diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e53c14f2..d8fbfe4c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ## 0.46 (unreleased) +### Command Line Interface + +Removed the option `--missing-as-empty`. This is no longer needed as +difftastic handles `/dev/null` gracefully on all platforms. + ### Parsing Added support for Ada. diff --git a/src/files.rs b/src/files.rs index 9b92f0396..1aab69d71 100644 --- a/src/files.rs +++ b/src/files.rs @@ -3,7 +3,6 @@ use std::io::Read; use std::{ fs, - io::ErrorKind::*, path::{Path, PathBuf}, }; @@ -13,11 +12,7 @@ use walkdir::WalkDir; use crate::exit_codes::EXIT_BAD_ARGUMENTS; use crate::options::FileArgument; -pub fn read_files_or_die( - lhs_path: &FileArgument, - rhs_path: &FileArgument, - missing_as_empty: bool, -) -> (Vec, Vec) { +pub fn read_files_or_die(lhs_path: &FileArgument, rhs_path: &FileArgument) -> (Vec, Vec) { let lhs_res = read_file_arg(lhs_path); let rhs_res = read_file_arg(rhs_path); @@ -25,12 +20,6 @@ pub fn read_files_or_die( // Both files exist, the happy case. (Ok(lhs_src), Ok(rhs_src)) => (lhs_src, rhs_src), - // Proceed if we've been given two paths and only one - // exists. This is important for mercurial diffs when a file - // has been removed. - (Ok(lhs_src), Err(e)) if missing_as_empty && e.kind() == NotFound => (lhs_src, vec![]), - (Err(e), Ok(rhs_src)) if missing_as_empty && e.kind() == NotFound => (vec![], rhs_src), - (lhs_res, rhs_res) => { // Something else went wrong. Print both errors // encountered. diff --git a/src/main.rs b/src/main.rs index 1c8190532..518ea0a19 100644 --- a/src/main.rs +++ b/src/main.rs @@ -171,7 +171,6 @@ fn main() { Mode::Diff { diff_options, display_options, - missing_as_empty, set_exit_code, language_override, lhs_path, @@ -238,7 +237,6 @@ fn main() { &rhs_path, &display_options, &diff_options, - missing_as_empty, language_override, ); print_diff_result(&display_options, &diff_result); @@ -282,10 +280,9 @@ fn diff_file( rhs_path: &FileArgument, display_options: &DisplayOptions, diff_options: &DiffOptions, - missing_as_empty: bool, language_override: Option, ) -> DiffResult { - let (lhs_bytes, rhs_bytes) = read_files_or_die(lhs_path, rhs_path, missing_as_empty); + let (lhs_bytes, rhs_bytes) = read_files_or_die(lhs_path, rhs_path); diff_file_content( lhs_display_path, rhs_display_path, @@ -621,7 +618,6 @@ fn diff_directories<'a>( &FileArgument::NamedPath(rhs_path), &display_options, &diff_options, - true, language_override, ) }) diff --git a/src/options.rs b/src/options.rs index b9d50e9f9..cf9d3b864 100644 --- a/src/options.rs +++ b/src/options.rs @@ -326,7 +326,6 @@ pub enum Mode { Diff { diff_options: DiffOptions, display_options: DisplayOptions, - missing_as_empty: bool, set_exit_code: bool, language_override: Option, /// The path where we can read the LHS file. This is often a @@ -518,10 +517,6 @@ pub fn parse_args() -> Mode { let print_unchanged = !matches.is_present("skip-unchanged"); - // TODO: is this necessary now we handle /dev/null as an empty - // file on all platforms? - let missing_as_empty = matches.is_present("missing-as-empty"); - let set_exit_code = matches.is_present("exit-code"); let check_only = matches.is_present("check-only"); @@ -549,7 +544,6 @@ pub fn parse_args() -> Mode { Mode::Diff { diff_options, display_options, - missing_as_empty, set_exit_code, language_override, lhs_path,