git: upgraded packages to upstream

Upgraded dev-vcs/git to version 2.18.1 on amd64, arm

BUG=chromium:840379, chromium:1106153
TEST=update_chroot; build test image for coral, verify that it boots;
    rebuild chromeos-sdk

Change-Id: I2669ce2c08055a87de1ae2c1b13f7cb5d17e01b7
Reviewed-on: https://chromium-review.googlesource.com/1311333
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: LaMont Jones <lamontjones@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
(cherry picked from commit 3ad2b7b7bf264b9cf654d6d7be850c6075207db0)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/overlays/portage-stable/+/2341990
Tested-by: Mike Frysinger <vapier@chromium.org>
(cherry picked from commit c11104fe12ae74ff15916a2fcf6050e099bff1e8)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/overlays/portage-stable/+/2340769
(cherry picked from commit 5a061c26ab3620adba62969cb002f24a4c9fb231)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/overlays/portage-stable/+/2342659
(cherry picked from commit 8a85a3f23358ede1a68b37f38c9d89a40c77ea0b)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/overlays/portage-stable/+/2348632
diff --git a/dev-vcs/git/Manifest b/dev-vcs/git/Manifest
index 1b11a78..47d2741 100644
--- a/dev-vcs/git/Manifest
+++ b/dev-vcs/git/Manifest
@@ -1,3 +1,3 @@
-DIST git-2.16.4.tar.xz 4968252 SHA256 6e69b0e9c487e5da52a14d4829f0b6a28b2c18a0bb6fb67c0dc8b5b5658bd532 SHA512 f54e431e78289349dcb927ec34873dfb801c49a41cbb3d0138346d603af26bd7d86f9ac95e7a61a4831017f3503f33374510ccf68b0e62b0691fc5a43283f1ac WHIRLPOOL b0bf6c7ad44526eaca80959c7d84ffc2ffa4693f5b36be51482bf02be9e6438aaf93c839a5c3d962752fca9dff9575f8fb608a86abfe26439d7fa4f63da7b195
-DIST git-htmldocs-2.16.4.tar.xz 1164256 SHA256 a3f4a3434f376600b77a753442e7d17bdd217b188cebd8cc269ae7ee07d27606 SHA512 8f4a8c51656559af81296fb064ecf0f88444952c7f8ee91b85e5a61b20d200267d7432f720ded12046bab986361cff48cf7a2f5d21e05c1ac7648cc3168a0049 WHIRLPOOL 32ad5b34c1fdcd977056a210484bacaf8a34c726454d8556bebdc550bbfcad7e7d52150f0cf2817329c547fc8bfa7f6f453f994e024ffc3cb67b9ad45c154b39
-DIST git-manpages-2.16.4.tar.xz 417136 SHA256 482bf4ca717c4b5fccfcf4ced156bb0536c15b3e9bfb505638275d799d2321cf SHA512 8029e9fac1eca542e809da1247f4eec3a2c81c0eb12d03aa816dcf120677011d3e409b06c28c8e7dbf41cbbcca873ec93846dc317bc73e57f4d4701ce7abf73d WHIRLPOOL 8dffd9e41503e156802effe294be48c6826f332bc3ef4967012215ccafabb6233108f0ca4b150259af5d6e7990674ee8f238a55fc8086b2e758837df36726ef7
+DIST git-2.18.1.tar.xz 5102812 SHA256 888504a45cb70a002258374b3add9b5cdc044c35edd5976ab8bbeec4800898b6 SHA512 06bdc54c4ff78b77667b917f2aa46a803bd6561236f4177f41b8730785b5f90f8ca705f028131f9365fb0aae2e51cd92c97380141e97c026c96a020e00b992e1 WHIRLPOOL f7f95f6f0ed8810a988499ca4d6560a0dd37b82042410816f6ad9bec1641d6af942017534cafdeb974c1db92abb079edf2441f67b0d1bc3a05198f68486dc55d
+DIST git-htmldocs-2.18.1.tar.xz 1201604 SHA256 8ed02388478fcdc7fa3abf28918553127fd93f1ae6a390c48cf8b5c2105f42fd SHA512 5310a846091bfa66609ce896bdce163bd84f40c14400a53eab662f0c28037b98fef4a8766a716694a5bf9549793a85b57cb665194dff5612277c6603452ea512 WHIRLPOOL 899b6ced37f2290cc631f18d8ecfe79bfd1cb22b8da2da5efc9d49d9fe6cbe703ed1549af0baa60a421a5f67c369e166ce7496cf76ca54d81fae145cfe442398
+DIST git-manpages-2.18.1.tar.xz 425568 SHA256 913379f76e2d7c9e6e0d9910a75b9a4f9382bb012d17c0c03f60e7a5f2c74273 SHA512 6e6e663d985ef267d556539a43c192138b31dbbc80ffaa4331b8494f6e3e74b5cd4d958c2ae963143946eaa99bfce485ee3726b510b10eaab3599b5284b5fbc1 WHIRLPOOL 28622f8faf499e0dfcfdbfde08fac6453439786aa56aec6e290f3613ee8fe71357e0ff02a3cc97bb01e2a51b77da0b943ec58fc0830b6aa47c520a56ef67db91
diff --git a/dev-vcs/git/files/git-2.17.0-mw_install_path_fix.patch b/dev-vcs/git/files/git-2.17.0-mw_install_path_fix.patch
deleted file mode 100644
index 5a66a4c..0000000
--- a/dev-vcs/git/files/git-2.17.0-mw_install_path_fix.patch
+++ /dev/null
@@ -1,48 +0,0 @@
-From cfb3a47cada99d1bdccd08426f122ded2a63834e Mon Sep 17 00:00:00 2001
-From: Christian Hesse <mail@eworm.de>
-Date: Tue, 10 Apr 2018 15:36:41 +0200
-Subject: [PATCH] perl: fix installing modules from contrib
-
-Commit 20d2a30f (Makefile: replace perl/Makefile.PL with simple make rules)
-removed a target that allowed Makefiles from contrib/ to get the correct
-install path. This introduces a new target for main Makefile and fixes
-installation for Mediawiki module.
-
-v2: Pass prefix as that can have influence as well, add single quotes
-    for _SQ variant.
-
-Signed-off-by: Christian Hesse <mail@eworm.de>
----
- Makefile                   | 2 ++
- contrib/mw-to-git/Makefile | 5 +++--
- 2 files changed, 5 insertions(+), 2 deletions(-)
-
-diff --git a/Makefile b/Makefile
-index 2091f5f892cc8..75b9ad3b480cb 100644
---- a/Makefile
-+++ b/Makefile
-@@ -1973,6 +1973,8 @@ GIT-PERL-DEFINES: FORCE
- 		echo "$$FLAGS" >$@; \
- 	    fi
- 
-+perllibdir:
-+	@echo '$(perllibdir_SQ)'
- 
- .PHONY: gitweb
- gitweb:
-diff --git a/contrib/mw-to-git/Makefile b/contrib/mw-to-git/Makefile
-index a4b6f7a2cd412..4e603512a39fe 100644
---- a/contrib/mw-to-git/Makefile
-+++ b/contrib/mw-to-git/Makefile
-@@ -21,8 +21,9 @@ HERE=contrib/mw-to-git/
- INSTALL = install
- 
- SCRIPT_PERL_FULL=$(patsubst %,$(HERE)/%,$(SCRIPT_PERL))
--INSTLIBDIR=$(shell $(MAKE) -C $(GIT_ROOT_DIR)/perl \
--                -s --no-print-directory instlibdir)
-+INSTLIBDIR=$(shell $(MAKE) -C $(GIT_ROOT_DIR)/ \
-+                -s --no-print-directory prefix=$(prefix) \
-+                perllibdir=$(perllibdir) perllibdir)
- DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
- INSTLIBDIR_SQ = $(subst ','\'',$(INSTLIBDIR))
- 
diff --git a/dev-vcs/git/git-2.16.4.ebuild b/dev-vcs/git/git-2.18.1.ebuild
similarity index 74%
rename from dev-vcs/git/git-2.16.4.ebuild
rename to dev-vcs/git/git-2.18.1.ebuild
index 32777af..d676472 100644
--- a/dev-vcs/git/git-2.16.4.ebuild
+++ b/dev-vcs/git/git-2.18.1.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=5
@@ -73,18 +73,30 @@
 
 RDEPEND="${CDEPEND}
 	gpg? ( app-crypt/gnupg )
-	mediawiki? (
-		dev-perl/DateTime-Format-ISO8601
-		dev-perl/HTML-Tree
-		dev-perl/MediaWiki-API
+	perl? (
+		dev-perl/Error
+		dev-perl/Net-SMTP-SSL
+		dev-perl/Authen-SASL
+		cgi? (
+			dev-perl/CGI
+			highlight? ( app-text/highlight )
+		)
+		cvs? (
+			>=dev-vcs/cvsps-2.1:0
+			dev-perl/DBI
+			dev-perl/DBD-SQLite
+		)
+		mediawiki? (
+			dev-perl/DateTime-Format-ISO8601
+			dev-perl/HTML-Tree
+			dev-perl/MediaWiki-API
+		)
+		subversion? (
+			dev-vcs/subversion[-dso,perl]
+			dev-perl/libwww-perl
+			dev-perl/TermReadKey
+		)
 	)
-	perl? ( dev-perl/Error
-			dev-perl/Net-SMTP-SSL
-			dev-perl/Authen-SASL
-			cgi? ( dev-perl/CGI highlight? ( app-text/highlight ) )
-			cvs? ( >=dev-vcs/cvsps-2.1:0 dev-perl/DBI dev-perl/DBD-SQLite )
-			subversion? ( dev-vcs/subversion[-dso,perl] dev-perl/libwww-perl dev-perl/TermReadKey )
-			)
 	python? ( ${PYTHON_DEPS} )
 "
 
@@ -108,7 +120,7 @@
 		app-text/asciidoc"
 fi
 
-SITEFILE=50${PN}-gentoo.el
+SITEFILE="50${PN}-gentoo.el"
 S="${WORKDIR}/${MY_P}"
 
 REQUIRED_USE="
@@ -124,11 +136,7 @@
 
 PATCHES=(
 	# bug #350330 - automagic CVS when we don't want it is bad.
-	"${FILESDIR}"/git-2.12.0-optional-cvs.patch
-
-	# install mediawiki perl modules also in vendor_dir
-	# hack, needs better upstream solution
-	"${FILESDIR}"/git-1.8.5-mw-vendor.patch
+	"${FILESDIR}"/git-2.18.0_rc1-optional-cvs.patch
 
 	"${FILESDIR}"/git-2.2.0-svn-fe-linking.patch
 
@@ -150,111 +158,111 @@
 # This is needed because for some obscure reasons future calls to make don't
 # pick up these exports if we export them in src_unpack()
 exportmakeopts() {
-	local myopts
+	local myopts=(
+		ASCIIDOC_NO_ROFF=YesPlease
+		$(usex cvs '' NO_CVS=YesPlease)
+		$(usex elibc_musl NO_REGEX=YesPlease '')
+		$(usex iconv '' NO_ICONV=YesPlease)
+		$(usex nls '' NO_GETTEXT=YesPlease)
+		$(usex perl 'INSTALLDIRS=vendor NO_PERL_CPAN_FALLBACKS=YesPlease' NO_PERL=YesPlease)
+		$(usex python '' NO_PYTHON=YesPlease)
+		$(usex subversion '' NO_SVN_TESTS=YesPlease)
+		$(usex threads THREADED_DELTA_SEARCH=YesPlease NO_PTHREAD=YesPlease)
+		$(usex tk '' NO_TCLTK=YesPlease)
+	)
 
 	if use blksha1 ; then
-		myopts+=" BLK_SHA1=YesPlease"
+		myopts+=( BLK_SHA1=YesPlease )
 	elif use ppcsha1 ; then
-		myopts+=" PPC_SHA1=YesPlease"
+		myopts+=( PPC_SHA1=YesPlease )
 	fi
 
 	if use curl ; then
-		use webdav || myopts+=" NO_EXPAT=YesPlease"
+		use webdav || myopts+=( NO_EXPAT=YesPlease )
 	else
-		myopts+=" NO_CURL=YesPlease"
+		myopts+=( NO_CURL=YesPlease )
 	fi
 
 	# broken assumptions, because of static build system ...
-	myopts+=" NO_FINK=YesPlease NO_DARWIN_PORTS=YesPlease"
-	myopts+=" INSTALL=install TAR=tar"
-	myopts+=" SHELL_PATH=${EPREFIX}/bin/sh"
-	myopts+=" SANE_TOOL_PATH="
-	myopts+=" OLD_ICONV="
-	myopts+=" NO_EXTERNAL_GREP="
+	myopts+=(
+		NO_FINK=YesPlease
+		NO_DARWIN_PORTS=YesPlease
+		INSTALL=install
+		TAR=tar
+		SHELL_PATH="${EPREFIX}/bin/sh"
+		SANE_TOOL_PATH=
+		OLD_ICONV=
+		NO_EXTERNAL_GREP=
+	)
 
 	# For svn-fe
 	extlibs="-lz -lssl ${S}/xdiff/lib.a $(usex threads -lpthread '')"
 
 	# can't define this to null, since the entire makefile depends on it
-	sed -i -e '/\/usr\/local/s/BASIC_/#BASIC_/' Makefile
+	sed -i -e '/\/usr\/local/s/BASIC_/#BASIC_/' Makefile || die
 
-	use iconv \
-		|| myopts+=" NO_ICONV=YesPlease"
-	use nls \
-		|| myopts+=" NO_GETTEXT=YesPlease"
-	use tk \
-		|| myopts+=" NO_TCLTK=YesPlease"
 	if use pcre; then
 		if use pcre-jit; then
-			myopts+=" USE_LIBPCRE2=YesPlease"
+			myopts+=( USE_LIBPCRE2=YesPlease )
 			extlibs+=" -lpcre2-8"
 		else
-			myopts+=" USE_LIBPCRE1=YesPlease"
-			myopts+=" NO_LIBPCRE1_JIT=YesPlease"
+			myopts+=(
+				USE_LIBPCRE1=YesPlease
+				NO_LIBPCRE1_JIT=YesPlease
+			)
 			extlibs+=" -lpcre"
 		fi
 	fi
-	use perl \
-		&& myopts+=" INSTALLDIRS=vendor" \
-		|| myopts+=" NO_PERL=YesPlease"
-	use python \
-		|| myopts+=" NO_PYTHON=YesPlease"
-	use subversion \
-		|| myopts+=" NO_SVN_TESTS=YesPlease"
-	use threads \
-		&& myopts+=" THREADED_DELTA_SEARCH=YesPlease" \
-		|| myopts+=" NO_PTHREADS=YesPlease"
-	use cvs \
-		|| myopts+=" NO_CVS=YesPlease"
-	use elibc_musl \
-		&& myopts+=" NO_REGEX=YesPlease"
 # Disabled until ~m68k-mint can be keyworded again
 #	if [[ ${CHOST} == *-mint* ]] ; then
-#		myopts+=" NO_MMAP=YesPlease"
-#		myopts+=" NO_IPV6=YesPlease"
-#		myopts+=" NO_STRLCPY=YesPlease"
-#		myopts+=" NO_MEMMEM=YesPlease"
-#		myopts+=" NO_MKDTEMP=YesPlease"
-#		myopts+=" NO_MKSTEMPS=YesPlease"
+#		myopts+=(
+#			NO_MMAP=YesPlease
+#			NO_IPV6=YesPlease
+#			NO_STRLCPY=YesPlease
+#			NO_MEMMEM=YesPlease
+#			NO_MKDTEMP=YesPlease
+#			NO_MKSTEMPS=YesPlease
+#		)
 #	fi
 	if [[ ${CHOST} == ia64-*-hpux* ]]; then
-		myopts+=" NO_NSEC=YesPlease"
+		myopts+=( NO_NSEC=YesPlease )
 	fi
 	if [[ ${CHOST} == *-*-aix* ]]; then
-		myopts+=" NO_FNMATCH_CASEFOLD=YesPlease"
+		myopts+=( NO_FNMATCH_CASEFOLD=YesPlease )
 	fi
 	if [[ ${CHOST} == *-solaris* ]]; then
-		myopts+=" NEEDS_LIBICONV=YesPlease"
-		myopts+=" HAVE_CLOCK_MONOTONIC=1"
+		myopts+=(
+			NEEDS_LIBICONV=YesPlease
+			HAVE_CLOCK_MONOTONIC=1
+		)
 		grep -q getdelim "${ROOT}"/usr/include/stdio.h && \
-			myopts+=" HAVE_GETDELIM=1"
+			myopts+=( HAVE_GETDELIM=1 )
 	fi
 
 	has_version '>=app-text/asciidoc-8.0' \
-		&& myopts+=" ASCIIDOC8=YesPlease"
-	myopts+=" ASCIIDOC_NO_ROFF=YesPlease"
+		&& myopts+=( ASCIIDOC8=YesPlease )
 
 	# Bug 290465:
 	# builtin-fetch-pack.c:816: error: 'struct stat' has no member named 'st_mtim'
 	[[ "${CHOST}" == *-uclibc* ]] && \
-		myopts+=" NO_NSEC=YesPlease"
+		myopts+=( NO_NSEC=YesPlease )
 
-	export MY_MAKEOPTS="${myopts}"
+	export MY_MAKEOPTS="${myopts[@]}"
 	export EXTLIBS="${extlibs}"
 }
 
 src_unpack() {
 	if [[ ${PV} != *9999 ]]; then
 		unpack ${MY_P}.tar.${SRC_URI_SUFFIX}
-		cd "${S}"
+		cd "${S}" || die
 		unpack ${PN}-manpages-${DOC_VER}.tar.${SRC_URI_SUFFIX}
-		use doc && \
-			cd "${S}"/Documentation && \
+		if use doc ; then
+			pushd "${S}"/Documentation &>/dev/null || die
 			unpack ${PN}-htmldocs-${DOC_VER}.tar.${SRC_URI_SUFFIX}
-		cd "${S}"
+			popd &>/dev/null || die
+		fi
 	else
 		git-r3_src_unpack
-		cd "${S}"
 		#cp "${FILESDIR}"/GIT-VERSION-GEN .
 	fi
 
@@ -271,7 +279,7 @@
 		)
 	fi
 
-	epatch "${PATCHES[@]}"
+	default
 
 	sed -i \
 		-e 's:^\(CFLAGS[[:space:]]*=\).*$:\1 $(OPTCFLAGS) -Wall:' \
@@ -280,41 +288,36 @@
 		-e 's:^\(AR[[:space:]]* =\).*$:\1$(OPTAR):' \
 		-e "s:\(PYTHON_PATH[[:space:]]\+=[[:space:]]\+\)\(.*\)$:\1${EPREFIX}\2:" \
 		-e "s:\(PERL_PATH[[:space:]]\+=[[:space:]]\+\)\(.*\)$:\1${EPREFIX}\2:" \
-		Makefile contrib/svn-fe/Makefile || die "sed failed"
-
-	# Never install the private copy of Error.pm (bug #296310)
-	sed -i \
-		-e '/private-Error.pm/s,^,#,' \
-		perl/Makefile.PL
+		Makefile contrib/svn-fe/Makefile || die
 
 	# Fix docbook2texi command
 	sed -r -i 's/DOCBOOK2X_TEXI[[:space:]]*=[[:space:]]*docbook2x-texi/DOCBOOK2X_TEXI = docbook2texi.pl/' \
-		Documentation/Makefile || die "sed failed"
+		Documentation/Makefile || die
 
 	# Fix git-subtree missing DESTDIR
 	sed -i \
 		-e '/$(INSTALL)/s/ $(libexecdir)/ $(DESTDIR)$(libexecdir)/g' \
 		-e '/$(INSTALL)/s/ $(man1dir)/ $(DESTDIR)$(man1dir)/g'  \
-		contrib/subtree/Makefile
+		contrib/subtree/Makefile || die
 }
 
 git_emake() {
 	# bug #320647: PYTHON_PATH
-	PYTHON_PATH=""
+	local PYTHON_PATH=""
 	use python && PYTHON_PATH="${PYTHON}"
 	emake ${MY_MAKEOPTS} \
-		DESTDIR="${D}" \
-		OPTCFLAGS="${CFLAGS}" \
-		OPTLDFLAGS="${LDFLAGS}" \
-		OPTCC="$(tc-getCC)" \
-		OPTAR="$(tc-getAR)" \
 		prefix="${EPREFIX}"/usr \
 		htmldir="${EPREFIX}"/usr/share/doc/${PF}/html \
 		sysconfdir="${EPREFIX}"/etc \
-		PYTHON_PATH="${PYTHON_PATH}" \
+		DESTDIR="${D}" \
+		GIT_TEST_OPTS="--no-color" \
+		OPTAR="$(tc-getAR)" \
+		OPTCC="$(tc-getCC)" \
+		OPTCFLAGS="${CFLAGS}" \
+		OPTLDFLAGS="${LDFLAGS}" \
 		PERL_PATH="${EPREFIX}/usr/bin/perl" \
 		PERL_MM_OPT="" \
-		GIT_TEST_OPTS="--no-color" \
+		PYTHON_PATH="${PYTHON_PATH}" \
 		V=1 \
 		"$@"
 }
@@ -324,10 +327,6 @@
 }
 
 src_compile() {
-	if use perl ; then
-	git_emake perl/PM.stamp || die "emake perl/PM.stamp failed"
-	git_emake perl/perl.mak || die "emake perl/perl.mak failed"
-	fi
 	git_emake || die "emake failed"
 
 	if use emacs ; then
@@ -341,12 +340,13 @@
 	fi
 
 	if [[ ${CHOST} == *-darwin* ]]; then
-		cd "${S}"/contrib/credential/osxkeychain || die
+		pushd contrib/credential/osxkeychain &>/dev/null || die
 		git_emake CC=$(tc-getCC) CFLAGS="${CFLAGS}" \
 			|| die "emake credential-osxkeychain"
+		popd &>/dev/null || die
 	fi
 
-	cd "${S}"/Documentation
+	pushd Documentation &>/dev/null || die
 	if [[ ${PV} == *9999 ]] ; then
 		git_emake man \
 			|| die "emake man failed"
@@ -360,9 +360,10 @@
 				|| die "emake info html failed"
 		fi
 	fi
+	popd &>/dev/null || die
 
 	if use subversion ; then
-		cd "${S}"/contrib/svn-fe
+		pushd contrib/svn-fe &>/dev/null || die
 		# by defining EXTLIBS we override the detection for libintl and
 		# libiconv, bug #516168
 		local nlsiconv=
@@ -372,24 +373,29 @@
 		if use doc ; then
 			git_emake svn-fe.{1,html} || die "emake svn-fe.1 svn-fe.html failed"
 		fi
-		cd "${S}"
+		popd &>/dev/null || die
 	fi
 
 	if use gnome-keyring ; then
-		cd "${S}"/contrib/credential/libsecret
+		pushd contrib/credential/libsecret &>/dev/null || die
 		git_emake || die "emake git-credential-libsecret failed"
+		popd &>/dev/null || die
 	fi
 
-	cd "${S}"/contrib/subtree || die
+	pushd contrib/subtree &>/dev/null || die
 	git_emake
 	use doc && git_emake doc
+	popd &>/dev/null || die
 
-	cd "${S}"/contrib/diff-highlight || die
+	pushd contrib/diff-highlight &>/dev/null || die
 	git_emake
+	popd &>/dev/null || die
 
 	if use mediawiki ; then
-		cd "${S}"/contrib/mw-to-git
+		pushd contrib/mw-to-git &>/dev/null || die
 		git_emake
+		popd &>/dev/null || die
+
 	fi
 }
 
@@ -444,19 +450,19 @@
 	newexe contrib/git-resurrect.sh git-resurrect
 
 	# git-subtree
-	cd "${S}"/contrib/subtree
+	pushd contrib/subtree &>/dev/null || die
 	git_emake install || die "Failed to emake install git-subtree"
 	if use doc ; then
 		git_emake install-man install-doc || die "Failed to emake install-doc install-mangit-subtree"
 	fi
 	newdoc README README.git-subtree
 	dodoc git-subtree.txt
-	cd "${S}"
+	popd &>/dev/null || die
 
 	if use mediawiki ; then
-		cd "${S}"/contrib/mw-to-git
+		pushd contrib/mw-to-git &>/dev/null || die
 		git_emake install
-		cd "${S}"
+		popd &>/dev/null || die
 	fi
 
 	# diff-highlight
@@ -474,12 +480,13 @@
 	dodoc contrib/contacts/git-contacts.txt
 
 	if use gnome-keyring ; then
-		cd "${S}"/contrib/credential/libsecret
+		pushd contrib/credential/libsecret &>/dev/null || die
 		dobin git-credential-libsecret
+		popd &>/dev/null || die
 	fi
 
 	if use subversion ; then
-		cd "${S}"/contrib/svn-fe
+		pushd contrib/svn-fe &>/dev/null || die
 		dobin svn-fe
 		dodoc svn-fe.txt
 		if use doc ; then
@@ -487,7 +494,7 @@
 			docinto html
 			dodoc svn-fe.html
 		fi
-		cd "${S}"
+		popd &>/dev/null || die
 	fi
 
 	dodir /usr/share/${PN}/contrib
@@ -518,7 +525,7 @@
 	for i in "${contrib_objects[@]}" ; do
 		cp -rf \
 			"${S}"/contrib/${i} \
-			"${ED}"/usr/share/${PN}/contrib \
+			"${ED%/}"/usr/share/${PN}/contrib \
 			|| die "Failed contrib ${i}"
 	done
 
@@ -534,19 +541,19 @@
 		newdoc  "${S}"/gitweb/INSTALL INSTALL.gitweb
 		newdoc  "${S}"/gitweb/README README.gitweb
 
-		for d in "${ED}"/usr/lib{64,}/perl5/ ; do
+		for d in "${ED%/}"/usr/lib{,64}/perl5/ ; do
 			if test -d "$d" ; then find "$d" \
 				-name .packlist \
 				-delete || die
 			fi
 		done
 	else
-		rm -rf "${ED}"/usr/share/gitweb
+		rm -rf "${ED%/}"/usr/share/gitweb
 	fi
 
 	if ! use subversion ; then
-		rm -f "${ED}"/usr/libexec/git-core/git-svn \
-			"${ED}"/usr/share/man/man1/git-svn.1*
+		rm -f "${ED%/}"/usr/libexec/git-core/git-svn \
+			"${ED%/}"/usr/share/man/man1/git-svn.1*
 	fi
 
 	if use xinetd ; then
@@ -567,111 +574,118 @@
 	# we could remove sources in src_prepare, but install does not
 	# handle missing locale dir well
 	rm_loc() {
-		if [[ -e "${ED}/usr/share/locale/${1}" ]]; then
-			rm -r "${ED}/usr/share/locale/${1}" || die
+		if [[ -e "${ED%/}/usr/share/locale/${1}" ]]; then
+			rm -r "${ED%/}/usr/share/locale/${1}" || die
 		fi
 	}
 	l10n_for_each_disabled_locale_do rm_loc
 }
 
 src_test() {
-	local disabled=""
-	local tests_cvs="t9200-git-cvsexportcommit.sh \
-					t9400-git-cvsserver-server.sh \
-					t9401-git-cvsserver-crlf.sh \
-					t9402-git-cvsserver-refs.sh \
-					t9600-cvsimport.sh \
-					t9601-cvsimport-vendor-branch.sh \
-					t9602-cvsimport-branches-tags.sh \
-					t9603-cvsimport-patchsets.sh \
-					t9604-cvsimport-timestamps.sh"
-	local tests_perl="t3701-add-interactive.sh \
-					t5502-quickfetch.sh \
-					t5512-ls-remote.sh \
-					t5520-pull.sh \
-					t7106-reset-unborn-branch.sh \
-					t7501-commit.sh"
+	local disabled=()
+	local tests_cvs=(
+		t9200-git-cvsexportcommit.sh
+		t9400-git-cvsserver-server.sh
+		t9401-git-cvsserver-crlf.sh
+		t9402-git-cvsserver-refs.sh
+		t9600-cvsimport.sh
+		t9601-cvsimport-vendor-branch.sh
+		t9602-cvsimport-branches-tags.sh
+		t9603-cvsimport-patchsets.sh
+		t9604-cvsimport-timestamps.sh
+	)
+	local tests_perl=(
+		t3701-add-interactive.sh
+		t5502-quickfetch.sh
+		t5512-ls-remote.sh
+		t5520-pull.sh
+		t7106-reset-unborn-branch.sh
+		t7501-commit.sh
+	)
 	# Bug #225601 - t0004 is not suitable for root perm
 	# Bug #219839 - t1004 is not suitable for root perm
 	# t0001-init.sh - check for init notices EPERM*  fails
-	local tests_nonroot="t0001-init.sh \
-		t0004-unwritable.sh \
-		t0070-fundamental.sh \
-		t1004-read-tree-m-u-wf.sh \
-		t3700-add.sh \
-		t7300-clean.sh"
+	local tests_nonroot=(
+		t0001-init.sh
+		t0004-unwritable.sh
+		t0070-fundamental.sh
+		t1004-read-tree-m-u-wf.sh
+		t3700-add.sh
+		t7300-clean.sh
+	)
 	# t9100 still fails with symlinks in SVN 1.7
-	local test_svn="t9100-git-svn-basic.sh"
+	local test_svn=( t9100-git-svn-basic.sh )
 
 	# Unzip is used only for the testcase code, not by any normal parts of Git.
 	if ! has_version app-arch/unzip ; then
 		einfo "Disabling tar-tree tests"
-		disabled+=" t5000-tar-tree.sh"
+		disabled+=( t5000-tar-tree.sh )
 	fi
 
-	cvs=0
-	use cvs && let cvs=$cvs+1
+	local cvs=0
+	use cvs && let cvs=${cvs}+1
 	if [[ ${EUID} -eq 0 ]]; then
-		if [[ $cvs -eq 1 ]]; then
+		if [[ ${cvs} -eq 1 ]]; then
 			ewarn "Skipping CVS tests because CVS does not work as root!"
 			ewarn "You should retest with FEATURES=userpriv!"
-			disabled+=" ${tests_cvs}"
+			disabled+=( ${tests_cvs[@]} )
 		fi
 		einfo "Skipping other tests that require being non-root"
-		disabled+=" ${tests_nonroot}"
+		disabled+=( ${tests_nonroot[@]} )
 	else
-		[[ $cvs -gt 0 ]] && \
+		[[ ${cvs} -gt 0 ]] && \
 			has_version dev-vcs/cvs && \
-			let cvs=$cvs+1
-		[[ $cvs -gt 1 ]] && \
+			let cvs=${cvs}+1
+		[[ ${cvs} -gt 1 ]] && \
 			has_version "dev-vcs/cvs[server]" && \
-			let cvs=$cvs+1
-		if [[ $cvs -lt 3 ]]; then
+			let cvs=${cvs}+1
+		if [[ ${cvs} -lt 3 ]]; then
 			einfo "Disabling CVS tests (needs dev-vcs/cvs[USE=server])"
-			disabled+=" ${tests_cvs}"
+			disabled+=( ${tests_cvs[@]} )
 		fi
 	fi
 
 	if ! use perl ; then
 		einfo "Disabling tests that need Perl"
-		disabled+=" ${tests_perl}"
+		disabled+=( ${tests_perl[@]} )
 	fi
 
 	einfo "Disabling tests that fail with SVN 1.7"
-	disabled+=" ${test_svn}"
+	disabled+=( ${test_svn[@]} )
 
 	# Reset all previously disabled tests
-	cd "${S}/t"
+	pushd t &>/dev/null || die
+	local i
 	for i in *.sh.DISABLED ; do
 		[[ -f "${i}" ]] && mv -f "${i}" "${i%.DISABLED}"
 	done
 	einfo "Disabled tests:"
-	for i in ${disabled} ; do
-		[[ -f "${i}" ]] && mv -f "${i}" "${i}.DISABLED" && einfo "Disabled $i"
+	for i in ${disabled[@]} ; do
+		[[ -f "${i}" ]] && mv -f "${i}" "${i}.DISABLED" && einfo "Disabled ${i}"
 	done
 
 	# Avoid the test system removing the results because we want them ourselves
 	sed -e '/^[[:space:]]*$(MAKE) clean/s,^,#,g' \
-		-i "${S}"/t/Makefile
+		-i Makefile || die
 
 	# Clean old results first, must always run
-	cd "${S}/t"
 	nonfatal git_emake clean
+	popd &>/dev/null || die
 
 	# Now run the tests, keep going if we hit an error, and don't terminate on
 	# failure
-	cd "${S}"
+	local rc
 	einfo "Start test run"
 	#MAKEOPTS=-j1
 	nonfatal git_emake --keep-going test
 	rc=$?
 
 	# Display nice results, now print the results
-	cd "${S}/t"
+	pushd t &>/dev/null || die
 	nonfatal git_emake aggregate-results
 
 	# And bail if there was a problem
-	[ $rc -eq 0 ] || die "tests failed. Please file a bug."
+	[ ${rc} -eq 0 ] || die "tests failed. Please file a bug."
 }
 
 showpkgdeps() {
@@ -682,9 +696,9 @@
 
 pkg_postinst() {
 	use emacs && elisp-site-regen
-	einfo "Please read /usr/share/bash-completion/git for Git bash command completion"
-	einfo "Please read /usr/share/git/git-prompt.sh for Git bash prompt"
-	einfo "Note that the prompt bash code is now in that separate script"
+	elog "Please read /usr/share/bash-completion/git for Git bash command completion"
+	elog "Please read /usr/share/git/git-prompt.sh for Git bash prompt"
+	elog "Note that the prompt bash code is now in that separate script"
 	elog "These additional scripts need some dependencies:"
 	echo
 	showpkgdeps git-quiltimport "dev-util/quilt"