File tree Expand file tree Collapse file tree 1 file changed +19
-17
lines changed Expand file tree Collapse file tree 1 file changed +19
-17
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,24 @@ mod baseline {
1616 use super :: Baseline ;
1717 use gix_blame:: BlameEntry ;
1818
19+ // These fields are used by `git` in its porcelain output.
20+ const HEADER_FIELDS : [ & str ; 12 ] = [
21+ // https://github.com/git/git/blob/6258f68c3c1092c901337895c864073dcdea9213/builtin/blame.c#L256-L280
22+ "author" ,
23+ "author-mail" ,
24+ "author-time" ,
25+ "author-tz" ,
26+ "committer" ,
27+ "committer-mail" ,
28+ "committer-time" ,
29+ "committer-tz" ,
30+ "summary" ,
31+ "boundary" ,
32+ // https://github.com/git/git/blob/6258f68c3c1092c901337895c864073dcdea9213/builtin/blame.c#L239-L248
33+ "previous" ,
34+ "filename" ,
35+ ] ;
36+
1937 impl < ' a > Baseline < ' a > {
2038 pub fn collect ( baseline_path : impl AsRef < Path > ) -> std:: io:: Result < Vec < BlameEntry > > {
2139 let content = std:: fs:: read ( baseline_path) ?;
@@ -71,23 +89,7 @@ mod baseline {
7189 ( line_number_in_final_file - 1 ) ..( line_number_in_final_file + number_of_lines_in_group - 1 ) ;
7290 assert ! ( ranges. is_none( ) , "should not overwrite existing ranges" ) ;
7391 ranges = Some ( ( blame_range, original_range) ) ;
74- } else if ![
75- "author" ,
76- "author-mail" ,
77- "author-time" ,
78- "author-tz" ,
79- "committer" ,
80- "committer-mail" ,
81- "committer-time" ,
82- "committer-tz" ,
83- "summary" ,
84- "previous" ,
85- "filename" ,
86- "boundary" ,
87- ]
88- . contains ( & fields[ 0 ] )
89- && ObjectId :: from_hex ( fields[ 0 ] . as_bytes ( ) ) . is_err ( )
90- {
92+ } else if !HEADER_FIELDS . contains ( & fields[ 0 ] ) && ObjectId :: from_hex ( fields[ 0 ] . as_bytes ( ) ) . is_err ( ) {
9193 panic ! ( "unexpected line: '{:?}'" , line. as_bstr( ) ) ;
9294 }
9395 }
You can’t perform that action at this time.
0 commit comments