diff --git a/src/git.rs b/src/git.rs index ce8e4351..8e77a596 100644 --- a/src/git.rs +++ b/src/git.rs @@ -306,6 +306,10 @@ impl GitIndexCache { self.entries.len() } + pub fn is_empty(&self) -> bool { + self.entries.is_empty() + } + /// Returns `true` if the new content's blob SHA1 matches the git index /// entry for this path, meaning the file on disk almost certainly /// already has this content. diff --git a/src/hungarian.rs b/src/hungarian.rs index fc0b29f5..30eb1020 100644 --- a/src/hungarian.rs +++ b/src/hungarian.rs @@ -94,9 +94,9 @@ pub fn min_cost_assignment( } let mut result = Vec::with_capacity(rows.min(cols)); - for j in 1..=n { - if p[j] != 0 && p[j] <= rows && j <= cols { - result.push((p[j] - 1, j - 1)); + for (j, &assigned_row) in p.iter().enumerate().skip(1) { + if assigned_row != 0 && assigned_row <= rows && j <= cols { + result.push((assigned_row - 1, j - 1)); } } result