Handle # of commits behind by, in case the main branch is amended/rebased

This commit is contained in:
ehpersonal38
2023-03-07 18:18:56 -05:00
parent 534004acf6
commit 7e825d6009
2 changed files with 12 additions and 0 deletions
+6
View File
@@ -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) {?>
<style>
.updatenumber {
+6
View File
@@ -10,6 +10,12 @@ if (preg_match("/behind '.*?' by (\d+) commit(s?)\b/", $str, $matches)) {
$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;
}
?><html>
<meta name="viewport" content="width=device-width, initial-scale=1">
<br>