Skip to content

DiffFormat::PatchHeader fails to printΒ #1064

Open
@altsem

Description

It seems that version 0.19.0 broke printing PatchHeader formatted diffs.

To reproduce (produces no lines):

fn main() {
    let repo = git2::Repository::open("..").unwrap();
    let diff = repo.diff_index_to_workdir(None, None).unwrap();

    diff.print(
        git2::DiffFormat::PatchHeader,
        |diffdelta, _maybe_hunk, line| {
            let line_content = std::str::from_utf8(line.content()).unwrap();
            print!("{}", line_content);
            true
        },
    );
}

Switching to version 0.18.3, or the format to git2::DiffFormat::PatchHeader seem to work as expected.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions