summaryrefslogtreecommitdiff
path: root/classes/Pref_Prefs.php
diff options
context:
space:
mode:
Diffstat (limited to 'classes/Pref_Prefs.php')
-rw-r--r--classes/Pref_Prefs.php33
1 files changed, 28 insertions, 5 deletions
diff --git a/classes/Pref_Prefs.php b/classes/Pref_Prefs.php
index 97a6940b5..2697ed6e9 100644
--- a/classes/Pref_Prefs.php
+++ b/classes/Pref_Prefs.php
@@ -1087,7 +1087,8 @@ class Pref_Prefs extends Handler_Protected {
2 => ["pipe", "w"], // STDERR
];
- $proc = proc_open("git fetch -q origin -a && git log HEAD..origin/master --oneline", $descriptorspec, $pipes, $plugin_dir);
+ // TODO: clean up handling main+master
+ $proc = proc_open("git fetch -q origin -a && git log HEAD..origin/main --oneline", $descriptorspec, $pipes, $plugin_dir);
if (is_resource($proc)) {
$rv = [
@@ -1096,6 +1097,15 @@ class Pref_Prefs extends Handler_Protected {
"git_status" => proc_close($proc),
];
$rv["need_update"] = !empty($rv["stdout"]);
+ } else {
+ $proc = proc_open("git fetch -q origin -a && git log HEAD..origin/master --oneline", $descriptorspec, $pipes, $plugin_dir);
+
+ $rv = [
+ "stdout" => stream_get_contents($pipes[1]),
+ "stderr" => stream_get_contents($pipes[2]),
+ "git_status" => proc_close($proc),
+ ];
+ $rv["need_update"] = !empty($rv["stdout"]);
}
}
@@ -1119,12 +1129,25 @@ class Pref_Prefs extends Handler_Protected {
2 => ["pipe", "w"], // STDERR
];
- $proc = proc_open("git fetch origin -a && git log HEAD..origin/master --oneline && git pull --ff-only origin master", $descriptorspec, $pipes, $plugin_dir);
+ // TODO: clean up handling main+master
+ $proc = proc_open("git fetch origin -a && git log HEAD..origin/main --oneline && git pull --ff-only origin main", $descriptorspec, $pipes, $plugin_dir);
if (is_resource($proc)) {
- $rv["stdout"] = stream_get_contents($pipes[1]);
- $rv["stderr"] = stream_get_contents($pipes[2]);
- $rv["git_status"] = proc_close($proc);
+ $rv = [
+ 'stdout' => stream_get_contents($pipes[1]),
+ 'stderr' => stream_get_contents($pipes[2]),
+ 'git_status' => proc_close($proc),
+ ];
+ } else {
+ $proc = proc_open("git fetch origin -a && git log HEAD..origin/master --oneline && git pull --ff-only origin master", $descriptorspec, $pipes, $plugin_dir);
+
+ if (is_resource($proc)) {
+ $rv = [
+ 'stdout' => stream_get_contents($pipes[1]),
+ 'stderr' => stream_get_contents($pipes[2]),
+ 'git_status' => proc_close($proc),
+ ];
+ }
}
}