no message

This commit is contained in:
hajimi
2026-06-13 10:47:34 +08:00
parent 186521392d
commit 50f0b6aff5
4 changed files with 183 additions and 18 deletions
+69 -11
View File
@@ -257,7 +257,11 @@ function Get-ArchiveExcludePatterns {
"." {
$patterns += @("uniapp/node_modules", "uniapp/dist", "admin/node_modules", "admin/dist")
if (-not $IncludeEnv) {
$patterns += "server/.env"
$patterns += @(
"server/.env",
"docker/.env",
"docker/.env.docker"
)
}
if (-not $IncludeVendor) {
$patterns += "server/vendor"
@@ -276,7 +280,13 @@ function Get-ArchiveExcludePatterns {
"server/public/dongqiudi-crawler/data",
"server/public/dongqiudi-crawler/logs",
"server/public/dongqiudi-crawler/venv",
"server/public/dongqiudi-crawler/__pycache__"
"server/public/dongqiudi-crawler/__pycache__",
"docker/crawler/data",
"docker/crawler/logs",
"docker/crawler/venv",
"docker/crawler/__pycache__",
"docker/crawler/test_output.txt",
"docker/crawler/tmp_*"
)
}
}
@@ -315,6 +325,45 @@ function Get-ArchiveExcludePatterns {
return @($patterns)
}
function Test-ArchiveExcludedPath {
param([string]$RelativePath)
$path = ($RelativePath -replace "\\", "/").TrimStart("./")
foreach ($rawPattern in (Get-ArchiveExcludePatterns)) {
if ([string]::IsNullOrWhiteSpace($rawPattern)) {
continue
}
$pattern = ($rawPattern -replace "\\", "/").TrimStart("./").TrimEnd("/")
if ([string]::IsNullOrWhiteSpace($pattern)) {
continue
}
if ($pattern.Contains("/")) {
if ($pattern -match "[*?\[]") {
if ($path -like $pattern -or $path -like "$pattern/*") {
return $true
}
} elseif ($path -eq $pattern -or $path.StartsWith("$pattern/")) {
return $true
}
continue
}
foreach ($segment in @($path -split "/")) {
if ($pattern -match "[*?\[]") {
if ($segment -like $pattern) {
return $true
}
} elseif ($segment -eq $pattern) {
return $true
}
}
}
return $false
}
function Commit-SourceChangesIfNeeded {
param(
[string]$Repository,
@@ -559,8 +608,9 @@ function Build-IncrementalPayload {
$status = $parts[0]
if ($status -eq "D") {
$path1 = $parts[1]
if (Test-UnderSourceDir $path1) {
$script:DeletedDisplayPaths += (Strip-SourcePrefix $path1)
$displayPath = Strip-SourcePrefix $path1
if ((Test-UnderSourceDir $path1) -and -not (Test-ArchiveExcludedPath $displayPath)) {
$script:DeletedDisplayPaths += $displayPath
}
} elseif ($status -like "R*" -or $status -like "C*") {
if ($parts.Count -lt 3) {
@@ -568,18 +618,21 @@ function Build-IncrementalPayload {
}
$path1 = $parts[1]
$path2 = $parts[2]
if (Test-UnderSourceDir $path2) {
$displayPath2 = Strip-SourcePrefix $path2
if ((Test-UnderSourceDir $path2) -and -not (Test-ArchiveExcludedPath $displayPath2)) {
[void]$changedGitPaths.Add($path2)
$script:ChangedDisplayPaths += (Strip-SourcePrefix $path2)
if ($status -like "R*" -and (Test-UnderSourceDir $path1)) {
$script:DeletedDisplayPaths += (Strip-SourcePrefix $path1)
$script:ChangedDisplayPaths += $displayPath2
$displayPath1 = Strip-SourcePrefix $path1
if ($status -like "R*" -and (Test-UnderSourceDir $path1) -and -not (Test-ArchiveExcludedPath $displayPath1)) {
$script:DeletedDisplayPaths += $displayPath1
}
}
} else {
$path1 = $parts[1]
if (Test-UnderSourceDir $path1) {
$displayPath = Strip-SourcePrefix $path1
if ((Test-UnderSourceDir $path1) -and -not (Test-ArchiveExcludedPath $displayPath)) {
[void]$changedGitPaths.Add($path1)
$script:ChangedDisplayPaths += (Strip-SourcePrefix $path1)
$script:ChangedDisplayPaths += $displayPath
}
}
}
@@ -694,7 +747,12 @@ $RootGitLinkIncludePaths = @(Get-RootGitLinkIncludePaths)
if ($RootGitLinkIncludePaths.Count -gt 0) {
Write-DeployLog "root gitlink include paths will be copied from working tree: $($RootGitLinkIncludePaths -join ' ')"
}
Commit-SourceChangesIfNeeded -Repository $GitCwd -Pathspec $DeployPathspec
$CommitPathspec = @($DeployPathspec | Where-Object { $RootGitLinkIncludePaths -notcontains $_ })
if ($CommitPathspec.Count -gt 0) {
Commit-SourceChangesIfNeeded -Repository $GitCwd -Pathspec $CommitPathspec
} else {
Write-DeployLog "all deploy paths are root gitlinks; skip auto commit and use working tree payload"
}
if ($Mode -eq "incremental") {
& git -C $GitCwd rev-parse --verify "$FromCommit^{commit}" *> $null