Fix repo update choking on duplicated parents

This commit is contained in:
Joscha 2023-08-05 01:55:40 +02:00
parent b26ab8feff
commit 5871b19f8e
3 changed files with 15 additions and 13 deletions

View file

@ -97,8 +97,10 @@ async fn insert_new_commit_links(conn: &mut SqliteConnection, new: &[Info]) -> a
let child = commit.id.to_string();
for parent in &commit.parent_ids {
let parent = parent.to_string();
// Commits *cough*linuxkernel*cough* may list the same parent
// multiple times, so we just ignore duplicates during insert.
sqlx::query!(
"INSERT INTO commit_links (parent, child) VALUES (?, ?)",
"INSERT OR IGNORE INTO commit_links (parent, child) VALUES (?, ?)",
parent,
child
)