Skip to main content

log

Function log 

Source
pub fn log(rev: &str, max: Option<usize>) -> Result<Vec<Logged>>
Expand description

Every commit on rev’s first-parent history, newest first, with its records.

One git log, with each note inlined through %N, rather than a notes show per commit: a series view wants hundreds of commits, and a subprocess each put a noticeable pause in front of what should be an instant read of local objects.

Every field ends in NUL (%x00 between fields, -z after the last), the one byte none of them can hold: git will not store it in a commit message, and JSON escapes it. A printable-looking separator such as \x1e was tried first and can appear in a subject, which cut that commit in two and dropped its measurements.

First-parent for the same reason as rev_list. --no-notes first clears whatever refs core.notesRef and notes.displayRef configure, so only this ref’s notes reach %N and are parsed as records — explicitly, rather than relying on an explicit --notes=<ref> happening to replace the defaults.

max bounds the walk to the newest max commits, for a caller that has to stop somewhere on a trunk of hundreds of thousands of commits and needs to know whether it did.