From 7e825d600944e404efcd69bd65cdcad1bafa20af Mon Sep 17 00:00:00 2001 From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com> Date: Tue, 7 Mar 2023 18:18:56 -0500 Subject: [PATCH] Handle # of commits behind by, in case the main branch is amended/rebased --- homepage/views.php | 6 ++++++ scripts/system_controls.php | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/homepage/views.php b/homepage/views.php index d03c80d..b383200 100644 --- a/homepage/views.php +++ b/homepage/views.php @@ -11,6 +11,12 @@ if(!isset($_SESSION['behind'])) { $num_commits_behind = $matches[1]; $_SESSION['behind'] = $num_commits_behind; } + if (preg_match('/\b(\d+)\b and \b(\d+)\b different commits each/', $str, $matches)) { + $num1 = (int) $matches[1]; + $num2 = (int) $matches[2]; + $sum = $num1 + $num2; + $_SESSION['behind'] = $sum; + } if(isset($_SESSION['behind'])&&intval($_SESSION['behind']) >= 99) {?>