Skip to content

Check whether this filter does result in a smaller git repository #1

@rayrobdod

Description

@rayrobdod

I mean, that is the only practical use of this I've thought of so far.

Remember to disable the computer's sleep mode before trying this again.

Maybe also compare against a tree-filter that recompresses with pngout, or one that uses both pngout and this.

https://github.com/eliatlarge/FEMultiPlayer-V2 and https://github.com/thatswhatyouget/tpp-progress are probably two repositories with a lot of images (even if the images are dwarfed by the music files and generated js files respectively), but their images are all poorly compressed anyway. Maybe one of the pret ones.

#! powershell -File
$CACHE=$env:TMP + '\.hash_inflate\'
$FILTER='C:\Users\Raymond\AppData\Local\Temp\rust\release\png_inflate.exe'

ForEach ($file in $args) {
	$hash = $(Get-FileHash -LiteralPath $file).Hash
	$hashpath = $($CACHE + $hash)
	if ($(Test-Path -LiteralPath $hashpath)) {
		Copy-Item -LiteralPath $hashpath -Destination $file -Force
	} else {
		&"$PNG_FILTER" $file $hashpath
		Copy-Item -LiteralPath $hashpath -Destination $file -Force
	}
}
Set-ExecutionPolicy Unrestricted -Scope Process
cd $env:TMP
git clone https://github.com/thatswhatyouget/tpp-progress.git tpp-progress6
cd tpp-progress6
&git filter-branch --tree-filter "find -name '*.png' -exec C:/Users/Raymond/AppData/Local/Temp/filter.ps1 {} +"
cd ..
git clone file://C:/Users/Raymond/AppData/Local/Temp/tpp-progress6 tpp-progress7
# Then check the sizes of the `.git` drectories of a fresh clone of the original repository with the newly produced one

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions