If email address is not in log, get it from pijul change
Dependencies
- [2]
5ETDKF5FStart on data structures to represent fast-export stream - [3]
EGKSUIOBBetter handling of missing email address - [*]
Y7VFVY6EInitial dummy version - [*]
RTQQLOCOUse real metadata, but no content yet - [*]
KZ4XMKSPMake a temporary clone of the repository - [*]
RFMRCLJXRemove empty parentheses after author name
Change contents
- edit in main.go at line 4
"bufio""bytes" - edit in main.go at line 12[7.17][8.0]
"strconv" - edit in main.go at line 50
// unquote tries to unquote various types of quoted strings, and returns the// result. If none of the formats works, it returns s unchanged except for// trimming off whitespace.func unquote(s string) string {s = strings.TrimSpace(s)switch {case strings.HasPrefix(s, "'''") && strings.HasSuffix(s, "'''"):return strings.TrimPrefix(strings.TrimSuffix(s, "'''"), "'''")case strings.HasPrefix(s, "'") && strings.HasSuffix(s, "'"):return strings.TrimPrefix(strings.TrimSuffix(s, "'"), "'")case strings.HasPrefix(s, "\"") && strings.HasSuffix(s, "\""):unquoted, err := strconv.Unquote(s)if err == nil {return unquoted}}return s}var authorsHeader = []byte("\n[[authors]]\n") - edit in main.go at line 127
// Since the email address is missing from the log,// we'll try to find it in the output of pijul change.changeInfo, err := exec.Command("pijul", "change", c.Hash).Output()if err != nil {printErrorAndExit("Error from pijul change:", err)}if i := bytes.Index(changeInfo, authorsHeader); i != -1 {var name, email strings := bufio.NewScanner(bytes.NewReader(changeInfo[i+len(authorsHeader):]))for s.Scan() {line := s.Text()if line == "" {break}if strings.HasPrefix(line, "email =") {email = unquote(strings.TrimPrefix(line, "email ="))} else if strings.HasPrefix(line, "name =") {name = unquote(strings.TrimPrefix(line, "name ="))}}if name != "" && email != "" {author = name + " <" + email + ">"}} - edit in main.go at line 154