chore: establish Sovereign AI reference
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
$expectedRemote = 'https://git.intaleqapp.com/Hamza/sovereign_ai.git'
|
||||
$repoRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
Set-Location -LiteralPath $repoRoot
|
||||
|
||||
$actualRemote = git remote get-url origin
|
||||
if ($LASTEXITCODE -ne 0 -or $actualRemote.Trim() -ne $expectedRemote) {
|
||||
throw "Refusing to push: origin must be $expectedRemote"
|
||||
}
|
||||
|
||||
$branch = git branch --show-current
|
||||
if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrWhiteSpace($branch)) {
|
||||
throw 'Refusing to push from a detached HEAD.'
|
||||
}
|
||||
|
||||
$commitMessage = if ($args.Count -gt 0) { $args -join ' ' } else { 'chore: update Sovereign AI reference' }
|
||||
git config --local credential.https://git.intaleqapp.com.provider generic
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Could not configure the Git host provider.' }
|
||||
git add --all
|
||||
if ($LASTEXITCODE -ne 0) { throw 'git add failed.' }
|
||||
|
||||
git diff --cached --quiet
|
||||
$diffExitCode = $LASTEXITCODE
|
||||
if ($diffExitCode -eq 1) {
|
||||
git commit -m $commitMessage
|
||||
if ($LASTEXITCODE -ne 0) { throw 'git commit failed.' }
|
||||
} elseif ($diffExitCode -ne 0) {
|
||||
throw 'Could not inspect staged changes.'
|
||||
}
|
||||
|
||||
git -c http.proxy= -c https.proxy= push --set-upstream origin $branch
|
||||
if ($LASTEXITCODE -ne 0) { throw 'git push failed. Check network access and Git credentials.' }
|
||||
Reference in New Issue
Block a user