Skip to main content

Crate sley_ref_filter

Crate sley_ref_filter 

Source
Expand description

Shared ref-filter formatting primitives.

Git reuses the same identity/date/refname formatting language across for-each-ref, branch, tag, log, show, stash, and status output. This crate owns those semantic primitives so the CLI can remain an entry point instead of a home for every command’s formatting state.

Structs§

ForEachRefDateSort
A date atom used as a for-each-ref --sort key.
ForEachRefFormat
ForEachRefMessageParts
The split of a commit/tag message into the regions git’s for-each-ref atoms expose, mirroring ref-filter.c find_subpos.
ForEachRefStrip
ForEachRefTrack

Enums§

ForEachRefAtom
ForEachRefAtomIdentityPart
ForEachRefAtomIdentityRole
ForEachRefEmailMode
ForEachRefFormatSegment
ForEachRefNameFormat
ForEachRefNameSource
ForEachRefQuoteMode
ForEachRefStripDirection

Functions§

commit_identity_date
commit_identity_date_or_sentinel
Render an ident’s date for the structured header lines (Date:/AuthorDate:/ CommitDate:), mirroring pretty.c’s pp_user_info, which calls show_ident_date directly: a missing or unparsable date still prints the epoch sentinel (Thu Jan 1 00:00:00 1970 +0000) rather than an empty string. Use this for the medium/full/fuller layouts; use commit_identity_date for the %ad/%cd placeholders, which suppress a missing date entirely.
for_each_ref_abbrev_oid
for_each_ref_copy_subject
copy_subject: render the subject with embedded newlines turned into single spaces (CRLF’s CR is dropped), matching ref-filter.c.
for_each_ref_identity_date
for_each_ref_identity_date_raw
for_each_ref_identity_email
for_each_ref_identity_name
for_each_ref_identity_timestamp
for_each_ref_lstrip_name
for_each_ref_message_parts
Split a commit/tag message into the for-each-ref content regions, mirroring ref-filter.c find_subpos. message is the header-stripped message (sley already strips object headers before this point).
for_each_ref_rstrip_name
for_each_ref_sanitize_subject
format_sanitized_subject: replace non-title-character runs with a single -, collapse consecutive ., and trim trailing ./- (pretty.c).
for_each_ref_short_name
for_each_ref_track_short
is_for_each_ref_root_ref
Whether name is one of Git’s enumerable root refs.
parse_for_each_ref_abbrev_width
parse_for_each_ref_contents_lines_count
parse_for_each_ref_date_sort
Parse a date sort atom, returning None when value names another atom.
parse_for_each_ref_hex_color
Parse Git’s #rrggbb color spelling used by %(color:<value>) atoms.
parse_for_each_ref_strip_count
select_for_each_ref_is_base_candidate
Select the ref that Git’s %(is-base:<tip>) heuristic marks.
shorten_unambiguous_ref
git’s shorten_unambiguous_ref: find the shortest abbreviation of refname that, under the rev-parse rules, resolves back to exactly this ref. strict (git’s core.warnambiguousrefs, default true) requires all other rules to fail; otherwise only rules that sort before the matched one matter. ref_exists reports whether a fully-qualified refname is present.
write_for_each_ref_format
write_for_each_ref_identity
write_for_each_ref_identity_date
write_for_each_ref_identity_date_mode
write_for_each_ref_identity_date_raw
write_for_each_ref_identity_email
write_for_each_ref_identity_email_mode
write_for_each_ref_identity_name
write_for_each_ref_quoted_atom
write_for_each_ref_track