pkgname="git"
pkgver="2.50.1"
pkgdesc="A fast distributed version control system"
homepage="https://git-scm.com/"
license=("GPL2")
sources=("${pkgname}-${pkgver}.tar.xz")
urls=("https://www.kernel.org/pub/software/scm/git/${sources[0]}")
md5sums=("2cb96fae126d66f8ff23a68f8dd5d748")

src_prepare() {
  tar -xf ${distdir}/${sources[0]} --strip-components=1
}

src_check(){
  SHELL=/bin/sh \
  GIT_UNZIP=nonexist \
  make \
    NO_SVN_TESTS=y \
    GIT_TEST_OPTS="--root=/tmp/git-test" \
    -k test |& tee test.log
}

src_build() {
  ./configure --prefix=/usr \
            --with-gitconfig=/etc/gitconfig \
            --with-python=python3 &&
  make
}

src_install() {
  make perllibdir=/usr/lib/perl5/5.42/site_perl DESTDIR="$pkgdir" install
  install -d "$pkgdir"/usr/share/zsh/site-functions/
  install -v contrib/completion/git-completion.zsh "$pkgdir"/usr/share/zsh/site-functions/_git
}
