Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DiffFormat::PatchHeader fails to print #1064

Open
altsem opened this issue Jul 4, 2024 · 0 comments
Open

DiffFormat::PatchHeader fails to print #1064

altsem opened this issue Jul 4, 2024 · 0 comments

Comments

@altsem
Copy link

altsem commented Jul 4, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant