summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorsupahgreg <supahgreg@users.noreply.github.com>2025-10-03 22:03:43 +0000
committersupahgreg <supahgreg@users.noreply.github.com>2025-10-03 22:03:52 +0000
commitd7a91de1406450b4a0abddd21aac811102548730 (patch)
tree156aeb82cb77c9706c8fd6db1156bffbda8b9be1 /classes
parent5e99eb41ecdf55e5482b4823b009f3cfdac6ec22 (diff)
Initial attempt to support both 'main' and 'master' branches.
Diffstat (limited to 'classes')
-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),
+ ];
+ }
}
}