File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Expand file tree Collapse file tree 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 {
5757 /// Return `true` if `buf` was written or `false` if nothing had to be done.
5858 /// Depending on the state in `buf`, `index_object` is called to write the version of `src` as stored in the index
5959 /// 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*).
6264 /// If `round_trip_check` is not `None`, round-tripping will be validated and handled accordingly.
6365 pub fn convert_to_git (
6466 src : & [ u8 ] ,
Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ impl Pipeline {
9191 self . options . eol_config ,
9292 ) ?;
9393
94- let mut in_buffer = false ;
94+ let mut in_src_buffer = false ;
9595 // this is just an approximation, but it's as good as it gets without reading the actual input.
9696 let would_convert_eol = eol:: convert_to_git (
9797 b"\r \n " ,
@@ -119,13 +119,13 @@ impl Pipeline {
119119 }
120120 self . bufs . clear ( ) ;
121121 read. read_to_end ( & mut self . bufs . src ) ?;
122- in_buffer = true ;
122+ in_src_buffer = true ;
123123 }
124124 }
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) {
126126 self . bufs . clear ( ) ;
127127 src. read_to_end ( & mut self . bufs . src ) ?;
128- in_buffer = true ;
128+ in_src_buffer = true ;
129129 }
130130
131131 if let Some ( encoding) = encoding {
@@ -158,7 +158,7 @@ impl Pipeline {
158158 if apply_ident_filter && ident:: undo ( & self . bufs . src , & mut self . bufs . dest ) ? {
159159 self . bufs . swap ( ) ;
160160 }
161- Ok ( if in_buffer {
161+ Ok ( if in_src_buffer {
162162 ToGitOutcome :: Buffer ( & self . bufs . src )
163163 } else {
164164 ToGitOutcome :: Unchanged ( src)
You can’t perform that action at this time.
0 commit comments