File tree 2 files changed +9
-7
lines changed
2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -57,8 +57,10 @@ pub(crate) mod function {
57
57
/// Return `true` if `buf` was written or `false` if nothing had to be done.
58
58
/// Depending on the state in `buf`, `index_object` is called to write the version of `src` as stored in the index
59
59
/// into the buffer and if it is a blob, or return `Ok(None)` if no such object exists.
60
- /// If renormalization is desired, let it return `Ok(None)` at all times to not let it have any influence over the
61
- /// outcome of this function.
60
+ ///
61
+ /// *If renormalization is desired*, let it return `Ok(None)` at all times to not let it have any influence over the
62
+ /// outcome of this function. Otherwise, it will check if the in-index buffer already has newlines that it would now
63
+ /// want to change, and avoid doing so as what's in Git should be what's desired (except for when *renormalizing*).
62
64
/// If `round_trip_check` is not `None`, round-tripping will be validated and handled accordingly.
63
65
pub fn convert_to_git (
64
66
src : & [ u8 ] ,
Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ impl Pipeline {
91
91
self . options . eol_config ,
92
92
) ?;
93
93
94
- let mut in_buffer = false ;
94
+ let mut in_src_buffer = false ;
95
95
// this is just an approximation, but it's as good as it gets without reading the actual input.
96
96
let would_convert_eol = eol:: convert_to_git (
97
97
b"\r \n " ,
@@ -119,13 +119,13 @@ impl Pipeline {
119
119
}
120
120
self . bufs . clear ( ) ;
121
121
read. read_to_end ( & mut self . bufs . src ) ?;
122
- in_buffer = true ;
122
+ in_src_buffer = true ;
123
123
}
124
124
}
125
- if !in_buffer && ( apply_ident_filter || encoding. is_some ( ) || would_convert_eol) {
125
+ if !in_src_buffer && ( apply_ident_filter || encoding. is_some ( ) || would_convert_eol) {
126
126
self . bufs . clear ( ) ;
127
127
src. read_to_end ( & mut self . bufs . src ) ?;
128
- in_buffer = true ;
128
+ in_src_buffer = true ;
129
129
}
130
130
131
131
if let Some ( encoding) = encoding {
@@ -158,7 +158,7 @@ impl Pipeline {
158
158
if apply_ident_filter && ident:: undo ( & self . bufs . src , & mut self . bufs . dest ) ? {
159
159
self . bufs . swap ( ) ;
160
160
}
161
- Ok ( if in_buffer {
161
+ Ok ( if in_src_buffer {
162
162
ToGitOutcome :: Buffer ( & self . bufs . src )
163
163
} else {
164
164
ToGitOutcome :: Unchanged ( src)
You can’t perform that action at this time.
0 commit comments