fork of go-gitdiff with jj support

gitdiff: expose all raw headers from PatchHeader

Changed files
+13
gitdiff
+13
gitdiff/patch_header.go
··· 52 // line, that line will be removed and everything after it will be 53 // placed in BodyAppendix. 54 BodyAppendix string 55 } 56 57 // Message returns the commit message for the header. The message consists of ··· 237 break 238 } 239 240 switch { 241 case strings.HasPrefix(line, authorPrefix): 242 u, err := ParsePatchIdentity(line[len(authorPrefix):]) ··· 361 } 362 363 h := &PatchHeader{} 364 365 if strings.HasPrefix(mailLine, mailHeaderPrefix) { 366 mailLine = strings.TrimPrefix(mailLine, mailHeaderPrefix)
··· 52 // line, that line will be removed and everything after it will be 53 // placed in BodyAppendix. 54 BodyAppendix string 55 + 56 + // All headers completely unparsed 57 + RawHeaders map[string][]string 58 } 59 60 // Message returns the commit message for the header. The message consists of ··· 240 break 241 } 242 243 + items := strings.SplitN(line, ":", 2) 244 + 245 + // we have "key: value" 246 + if len(items) == 2 { 247 + key := items[0] 248 + val := items[1] 249 + h.RawHeaders[key] = append(h.RawHeaders[key], val) 250 + } 251 + 252 switch { 253 case strings.HasPrefix(line, authorPrefix): 254 u, err := ParsePatchIdentity(line[len(authorPrefix):]) ··· 373 } 374 375 h := &PatchHeader{} 376 + h.RawHeaders = msg.Header 377 378 if strings.HasPrefix(mailLine, mailHeaderPrefix) { 379 mailLine = strings.TrimPrefix(mailLine, mailHeaderPrefix)