@@ -17,14 +17,17 @@ impl Git {
17 // custom open options
17 // custom open options
18 let mut git_open_opts_map = git::sec::trust::Mapping::<git::open::Options>::default();
18 let mut git_open_opts_map = git::sec::trust::Mapping::<git::open::Options>::default();
20− // don't use the global git configs (not needed)
20+ // On windows various configuration options are bundled as part of the installations
21+ // This path depends on the install location of git and therefore requires some overhead to lookup
22+ // This is basically only used on windows and has some overhead hence it's disabled on other platforms.
23+ // `gitoxide` doesn't use this as default
21 let config = git::permissions::Config {
24 let config = git::permissions::Config {
22− system: false,
25+ system: true,
23− git: false,
26+ git: true,
24− user: false,
27+ user: true,
25 env: true,
28 env: true,
26 includes: true,
29 includes: true,
27− git_binary: false,
30+ git_binary: cfg!(windows),
29 // change options for config permissions without touching anything else
32 // change options for config permissions without touching anything else
30 git_open_opts_map.reduced = git_open_opts_map.reduced.permissions(git::Permissions {
33 git_open_opts_map.reduced = git_open_opts_map.reduced.permissions(git::Permissions {
@@ -61,7 +64,29 @@ impl DiffProvider for Git {
61 let file_oid = find_file_in_commit(&repo, &head, file)?;
64 let file_oid = find_file_in_commit(&repo, &head, file)?;
63 let file_object = repo.find_object(file_oid).ok()?;
66 let file_object = repo.find_object(file_oid).ok()?;
64− Some(file_object.detach().data)
67+ let mut data = file_object.detach().data;
68+ // convert LF to CRLF if configured to avoid showing every line as changed
71+ .boolean("core.autocrlf")
74+ let mut normalized_file = Vec::with_capacity(data.len());
75+ let mut at_cr = false;
78+ // if this is a LF instead of a CRLF (last byte was not a CR)
79+ // insert a new CR to generate a CRLF
81+ normalized_file.push(b'\r');
84+ at_cr = byte == b'\r';
85+ normalized_file.push(byte)
87+ data = normalized_file