remove unused patch label

This commit is contained in:
InkerBot
2026-03-05 13:50:31 +08:00
parent 648aa93360
commit 8d9f52a180
13 changed files with 30 additions and 28 deletions
+4 -3
View File
@@ -33,6 +33,7 @@ is_ignored() {
;;
*)
case "$_name" in $_pattern) return 0 ;; esac
case "$_rel" in $_pattern/*) return 0 ;; esac
;;
esac
done < "$IGNORE_FILE"
@@ -53,12 +54,12 @@ find "$CORE" -not -path "$CORE/.git/*" -type f | sort | while read -r dst_file;
if [ -f "$src_file" ]; then
if ! diff -q "$src_file" "$dst_file" > /dev/null 2>&1; then
mkdir -p "$(dirname "$patch_file")"
diff -u "$src_file" "$dst_file" > "$patch_file" || true
diff -u --label "a/$rel" --label "b/$rel" "$src_file" "$dst_file" > "$patch_file" || true
echo " Modified: $rel"
fi
else
mkdir -p "$(dirname "$patch_file")"
diff -u /dev/null "$dst_file" > "$patch_file" || true
diff -u --label /dev/null --label "b/$rel" /dev/null "$dst_file" > "$patch_file" || true
echo " New: $rel"
fi
done
@@ -72,7 +73,7 @@ find "$SING_BOX" -not -path "$SING_BOX/.git/*" -type f | sort | while read -r sr
if [ ! -f "$dst_file" ]; then
mkdir -p "$(dirname "$patch_file")"
diff -u "$src_file" /dev/null > "$patch_file" || true
diff -u --label "a/$rel" --label /dev/null "$src_file" /dev/null > "$patch_file" || true
echo " Deleted: $rel"
fi
done
+4 -3
View File
@@ -29,6 +29,7 @@ function Test-Ignored {
if ($RelPath -like $pattern) { return $true }
} else {
if ((Split-Path -Leaf $RelPath) -like $pattern) { return $true }
if ($RelPath -like "$pattern/*") { return $true }
}
}
return $false
@@ -53,11 +54,11 @@ Get-ChildItem -Path $Core -Recurse -File | Where-Object {
$srcHash = (Get-FileHash $srcFile -Algorithm MD5).Hash
$dstHash = (Get-FileHash $_.FullName -Algorithm MD5).Hash
if ($srcHash -ne $dstHash) {
diff -u $srcFile $_.FullName | Out-File -FilePath $patchFile -Encoding utf8
diff -u --label "a/$rel" --label "b/$rel" $srcFile $_.FullName | Out-File -FilePath $patchFile -Encoding utf8
Write-Host " Modified: $rel"
}
} else {
diff -u /dev/null $_.FullName | Out-File -FilePath $patchFile -Encoding utf8
diff -u --label /dev/null --label "b/$rel" /dev/null $_.FullName | Out-File -FilePath $patchFile -Encoding utf8
Write-Host " New: $rel"
}
}
@@ -74,7 +75,7 @@ Get-ChildItem -Path $SingBox -Recurse -File | Where-Object {
if (-not (Test-Path $dstFile)) {
$patchFileDir = Split-Path -Parent $patchFile
if (-not (Test-Path $patchFileDir)) { New-Item -ItemType Directory -Path $patchFileDir -Force | Out-Null }
diff -u $_.FullName /dev/null | Out-File -FilePath $patchFile -Encoding utf8
diff -u --label "a/$rel" --label /dev/null $_.FullName /dev/null | Out-File -FilePath $patchFile -Encoding utf8
Write-Host " Deleted: $rel"
}
}