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

@ -0,0 +1,12 @@
{
"db_name": "SQLite",
"query": "INSERT OR IGNORE INTO commit_links (parent, child) VALUES (?, ?)",
"describe": {
"columns": [],
"parameters": {
"Right": 2
},
"nullable": []
},
"hash": "2af3e5b2458b2674034853428f264190c2c1614d8df8dd831fd668c121786e88"
}

View file

@ -1,12 +0,0 @@
{
"db_name": "SQLite",
"query": "INSERT INTO commit_links (parent, child) VALUES (?, ?)",
"describe": {
"columns": [],
"parameters": {
"Right": 2
},
"nullable": []
},
"hash": "99a988f87d9e1d9ca6b818d815bc343b1e65e9aa00751f1a530dfc696a94c6dd"
}

View file

@ -97,8 +97,10 @@ async fn insert_new_commit_links(conn: &mut SqliteConnection, new: &[Info]) -> a
let child = commit.id.to_string(); let child = commit.id.to_string();
for parent in &commit.parent_ids { for parent in &commit.parent_ids {
let parent = parent.to_string(); 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!( sqlx::query!(
"INSERT INTO commit_links (parent, child) VALUES (?, ?)", "INSERT OR IGNORE INTO commit_links (parent, child) VALUES (?, ?)",
parent, parent,
child child
) )