From 14dd1d2ea89bf0eeeba7662d015d68ff8afd36b4 Mon Sep 17 00:00:00 2001 From: Patrick Uiterwijk Date: Sep 27 2018 09:34:30 +0000 Subject: Make sure that ticket changes don't get duplicated This checks whether a push is done by someone changing things in the tickets on the web UI, and does not trigger the ticket hook for that. This resulted in a ticket constantly opening and closing itself: - Ticket is open, person closes. Database is updated - Pre-receive hooks trigger, at which point the ticket is still Open in the ticket repo - Database is updated with the repo contents, opening the ticket repo - The closing commit goes through - The database update for opening the ticket goes through, reverting the close - and so forth Signed-off-by: Patrick Uiterwijk --- diff --git a/pagure/hooks/pagure_ticket_hook.py b/pagure/hooks/pagure_ticket_hook.py index dddf7fb..1009e43 100644 --- a/pagure/hooks/pagure_ticket_hook.py +++ b/pagure/hooks/pagure_ticket_hook.py @@ -74,6 +74,11 @@ class PagureTicketRunner(BaseRunner): print("The ticket hook only runs on the ticket git repository.") return + if username == "pagure": + # This was an update from inside the UI. Do not trigger further + # database updates, as this has already been done + return + for refname in changes: (oldrev, newrev) = changes[refname]