Skip to content

Commit

Permalink
Handle submodule line
Browse files Browse the repository at this point in the history
Fixes #60
  • Loading branch information
dandavison committed Nov 26, 2019
1 parent 1f84d48 commit 982a2a0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/delta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,19 @@ where
handle_hunk_meta_line(&mut painter, &line, config)?;
continue;
}
} else if source == Source::DiffUnified && line.starts_with("Only in ") {
} else if source == Source::DiffUnified && line.starts_with("Only in ")
|| line.starts_with("Submodule ")
{
// Additional FileMeta cases:
//
// 1. When comparing directories with diff -u, if filenames match between the
// directories, the files themselves will be compared. However, if an equivalent
// filename is not present, diff outputs a single line (Only in...) starting
// indicating that the file is present in only one of the directories.
//
// 2. Git diff emits lines describing submodule state such as "Submodule x/y/z contains
// untracked content"

state = State::FileMeta;
painter.paint_buffered_lines();
if config.opt.file_style != cli::SectionStyle::Plain {
Expand Down

0 comments on commit 982a2a0

Please sign in to comment.