Skip to main content

diff_labels

Function diff_labels 

Source
pub fn diff_labels(declared: &[LabelSpec], remote: &[RemoteLabel]) -> LabelDiff
Expand description

Compute the diff between the user’s declared label set and the labels currently on the upstream remote. Pure function — no I/O, no observable side effects (allocates a transient HashMap and HashSet to index by name, plus the returned LabelDiff).

Comparison rules:

  • Name is the unique key. Matching is byte-exact (including whitespace), since GitHub treats bug and Bug as different.
  • Color is lowercased on both sides before comparing — defence in depth on top of crate::github::parse_labels_json, which already lowercases remote colours, so a manually-constructed RemoteLabel (e.g. from a test fixture) with uppercase hex doesn’t slip through as a spurious “update”.
  • Description: None and Some("") are equivalent (GitHub stores them interchangeably).