[TikiWiki-commits] [Git][tikiwiki/tiki][master] [ENH] Devtools: Add option to skip automatic rebase in local checks
"ushindi bienvenu \(@usbbush\) via TikiWiki-cvs" <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <6a1ec64d5d0b2_38193f5c7338d@gitlab-sidekiq-low-urgency-cpu-bound-v2-86886f7f9-h92lb.mail> |
ushindi bienvenu pushed to branch master at Tiki Wiki CMS Groupware / Tiki
Commits:
c760c4d8 by ushindi bienvenu at 2026-06-02T11:43:48+00:00
[ENH] Devtools: Add option to skip automatic rebase in local checks
---
* [ENH] Devtools: Add option to skip automatic rebase in local checks
See merge request tikiwiki/tiki!10426
- - - - -
2 changed files:
- doc/devtools/get_base_commit.php
- doc/devtools/run_local_checks.php
Changes:
=====================================
doc/devtools/get_base_commit.php
=====================================
@@ -6,7 +6,7 @@
*
* @return string The base commit to diff against (e.g., 'origin/master')
*/
-function getBaseCommitOrAbort(): string
+function getBaseCommitOrAbort(bool $skipRebase = false): string
{
exec('git remote -v', $remoteLines);
@@ -24,23 +24,33 @@ function getBaseCommitOrAbort(): string
}
}
}
-
- echo "🔄 Target tracking remote identified as: '$targetRemote'" . PHP_EOL;
- echo "🔄 Attempting to fetch and rebase master..." . PHP_EOL;
-
- exec("git pull --rebase $targetRemote master 2>&1", $rebaseOutput, $rebaseCode);
-
- if ($rebaseCode !== 0) {
- echo PHP_EOL . "❌ REBASE CONFLICT DETECTED!" . PHP_EOL;
- echo "Your local branch has conflicts with the '$targetRemote' repository." . PHP_EOL;
- echo "Please resolve the conflicts manually before pushing." . PHP_EOL;
-
- // Abort the git push immediately
- exit(1);
+ if (! $skipRebase) {
+ echo "🔄 Target tracking remote identified as: '$targetRemote'" . PHP_EOL;
+ echo "🔄 Attempting to fetch and rebase master..." . PHP_EOL;
+ exec("git pull --rebase $targetRemote master 2>&1", $rebaseOutput, $rebaseCode);
+ if ($rebaseCode !== 0) {
+ echo PHP_EOL . "❌ Automatic rebase failed." . PHP_EOL;
+ echo "The branch could not be rebased onto '$targetRemote/master'." . PHP_EOL;
+ echo PHP_EOL;
+ echo "Common causes include:" . PHP_EOL;
+ echo " - Merge conflicts" . PHP_EOL;
+ echo " - Uncommitted local changes" . PHP_EOL;
+ echo " - Authentication or network issues" . PHP_EOL;
+ echo " - Remote repository access problems" . PHP_EOL;
+ echo PHP_EOL;
+ echo "If you do not want to rebase at this time, you can rerun the checks with:" . PHP_EOL;
+ echo 'TIKI_LOCAL_CHECKS_ARGS="--skip-rebase" git push' . PHP_EOL;
+ echo PHP_EOL;
+ echo "Otherwise, resolve the issue above and try again." . PHP_EOL;
+
+ exit(1);
+ }
+ echo "✅ Successfully rebased with $targetRemote/master. Proceeding with checks..." . PHP_EOL . PHP_EOL;
+ } else {
+ echo "⏭️ Skipping automatic rebase." . PHP_EOL;
+ exec("git fetch $targetRemote master");
}
- echo "✅ Successfully rebased with $targetRemote/master. Proceeding with checks..." . PHP_EOL . PHP_EOL;
-
// Robust Merge-Base Resolution to get the clean fork point
exec("git merge-base $targetRemote/master HEAD 2>&1", $mergeBaseOut, $mergeBaseCode);
=====================================
doc/devtools/run_local_checks.php
=====================================
@@ -1,6 +1,6 @@
<?php
-$options = getopt('h', ['help', 'skip:']);
+$options = getopt('h', ['help', 'skip:', 'skip-rebase']);
if (isset($options['h']) || isset($options['help'])) {
echo <<<HELP
@@ -9,11 +9,18 @@ Usage:
Options:
--skip=1,3,8 Skip checks by step number
+ --skip-rebase Skip the automatic rebase against the upstream/master branch
+ and use the current branch state to determine affected files
-h, --help Show this help message
Examples:
php doc/devtools/run_local_checks.php
php doc/devtools/run_local_checks.php --skip=2,5,9
+ php doc/devtools/run_local_checks.php --skip-rebase
+
+Notes:
+ By default, the script attempts to rebase the current branch on top of the
+ detected upstream master branch before running checks.
HELP;
exit(0);
@@ -25,8 +32,9 @@ if (! empty($options['skip'])) {
$skipSteps = array_map('intval', explode(',', $options['skip']));
echo "Skipping steps: " . implode(', ', $skipSteps) . PHP_EOL . PHP_EOL;
}
+$skipRebase = isset($options['skip-rebase']);
require_once __DIR__ . '/get_base_commit.php';
-$baseCommit = getBaseCommitOrAbort();
+$baseCommit = getBaseCommitOrAbort($skipRebase);
exec("git diff --name-only --diff-filter=d {$baseCommit} HEAD", $affectedFiles);
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/c760c4d8c882dbca8546523d02e2c6bd08f62295
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/c760c4d8c882dbca8546523d02e2c6bd08f62295
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help
_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs