5// Signal describes which unified-diff markers were found while scanning text.
12// Inspect scans content for unified-diff markers.
13func Inspect(content string) Signal {
15 for line := range strings.SplitSeq(content, "\n") {
16 if strings.HasPrefix(line, "@@") {
19 if strings.HasPrefix(line, "--- ") || strings.HasPrefix(line, "+++ ") {
20 signal.HasFileHeader = true
22 if strings.HasPrefix(line, "diff --git ") {
23 signal.HasGitHeader = true
29// IsUnifiedDiff reports whether content appears to be a unified diff.
30func IsUnifiedDiff(content string) bool {
31 signal := Inspect(content)
32 if signal.HasGitHeader && signal.HasFileHeader {
35 return signal.HasHunk && signal.HasFileHeader
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list