sysutils/git-backup: fix force push (#4988)

This commit is contained in:
Hleb Shauchenka 2025-10-22 15:35:52 +02:00 committed by GitHub
parent a828890850
commit 416712dbed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -168,7 +168,7 @@ class Git extends Base implements IBackupProvider
}
exec("cd {$targetdir} && {$git} remote remove origin");
exec("cd {$targetdir} && {$git} remote add origin " . escapeshellarg($url));
$force_flag = (string)$mdl->force_push === "1" ? "--force-with-lease " : "";
$force_flag = (string)$mdl->force_push === "1" ? "--force " : "";
$pushtxt = shell_exec(
"(cd {$targetdir} && {$git} push {$force_flag}origin " . escapeshellarg("master:{$mdl->branch}") .
" && echo '__exit_ok__') 2>&1"