# Contributor: Lennart Jablonka <humm@ljabl.com>
# Contributor: knuxify <knuxify@gmail.com>
# Maintainer: knuxify <knuxify@gmail.com>
pkgname=git-filter-repo
pkgver=2.45.0
pkgrel=0
pkgdesc="quickly rewrite git repository history"
url="https://github.com/newren/git-filter-repo"
arch="noarch"
license="MIT"
source="
 	10-no-version-test.patch
	20-git-filter-repo.patch
	https://github.com/newren/git-filter-repo/releases/download/v$pkgver/git-filter-repo-$pkgver.tar.xz
"
depends="python3 git"
checkdepends="bash perl rsync"
subpackages="$pkgname-doc"

check() {
	./t/run_tests
}

package() {
	install -Dm755 git-filter-repo "$pkgdir"/usr/bin/git-filter-repo
	local site=$(python3 -c 'import site; print(site.getsitepackages()[0])')
	mkdir -p "$pkgdir$site"
	ln -s -f /usr/bin/git-filter-repo "$pkgdir$site"/git_filter_repo.py
	install -Dm644 Documentation/man1/git-filter-repo.1 "$pkgdir"/usr/share/man/man1/git-filter-repo.1
}

sha512sums="
4dafe4458d2f7416d80269c38318f43eda1c389d9abbbdf9f7d4e8762917d774de119cd8792c192ee8e033e5381857450330ecd3320d87e5fc94423859642863  10-no-version-test.patch
6591ce9c93efbb1f534784daf2867cf03da43aeda70e25861f26cf31bd638cc3ecccacae14462917749ad0eabcfec386d800ad08558c980d1c6263b84ebd015f  20-git-filter-repo.patch
2fa48a1c6fe285570d02c63d71c92e1a79a4f4dfc0527141b6bed19f4ec27c92f6b98def2c6541bf1fef149e7dd191b023942c99b370b1a5b1555c2cac3e0c42  git-filter-repo-2.45.0.tar.xz
"
