On Tue, 20 Sep 2011 22:46:10 +0200
Tomáš Chvátal <scarab...@gentoo.org> wrote:

> 0001 - i had reason to put local definitions on the top, it is way
> more readable to see right away what local vars function has, so
> please stick to it.
> 0007 - I placed it into the conditionals to be clear what is
> happening, what if there will be added another if without the push...

Ok, these two fixed/replaced.

-- 
Best regards,
Michał Górny
From ec201cb4379f9aaef3d398fc0d415cb6bc011770 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgo...@gentoo.org>
Date: Tue, 20 Sep 2011 19:43:36 +0200
Subject: [PATCH 01/11] Replace variable 'eval's with ${!foo}.

---
 eclass/git-2.eclass |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/eclass/git-2.eclass b/eclass/git-2.eclass
index 0caa3d4..2408178 100644
--- a/eclass/git-2.eclass
+++ b/eclass/git-2.eclass
@@ -127,7 +127,8 @@ DEPEND="dev-vcs/git"
 git-2_init_variables() {
 	debug-print-function ${FUNCNAME} "$@"
 
-	local x
+	local esc_pn liverepo livebranch livecommit
+	esc_pn=${PN//[-+]/_}
 
 	: ${EGIT_SOURCEDIR="${S}"}
 
@@ -139,19 +140,19 @@ git-2_init_variables() {
 
 	: ${EGIT_MASTER:=master}
 
-	eval x="\$${PN//[-+]/_}_LIVE_REPO"
-	EGIT_REPO_URI=${x:-${EGIT_REPO_URI}}
+	liverepo=${esc_pn}_LIVE_REPO
+	EGIT_REPO_URI=${!liverepo:-${EGIT_REPO_URI}}
 	[[ -z ${EGIT_REPO_URI} ]] && die "EGIT_REPO_URI must have some value"
 
 	: ${EVCS_OFFLINE:=}
 
-	eval x="\$${PN//[-+]/_}_LIVE_BRANCH"
-	[[ -n ${x} ]] && ewarn "QA: using \"${PN//[-+]/_}_LIVE_BRANCH\" variable, you won't get any support"
-	EGIT_BRANCH=${x:-${EGIT_BRANCH:-${EGIT_MASTER}}}
+	livebranch=${esc_pn}_LIVE_BRANCH
+	[[ -n ${!livebranch} ]] && ewarn "QA: using \"${esc_pn}_LIVE_BRANCH\" variable, you won't get any support"
+	EGIT_BRANCH=${!livebranch:-${EGIT_BRANCH:-${EGIT_MASTER}}}
 
-	eval x="\$${PN//[-+]/_}_LIVE_COMMIT"
-	[[ -n ${x} ]] && ewarn "QA: using \"${PN//[-+]/_}_LIVE_COMMIT\" variable, you won't get any support"
-	EGIT_COMMIT=${x:-${EGIT_COMMIT:-${EGIT_BRANCH}}}
+	livecommit=${esc_pn}_LIVE_COMMIT
+	[[ -n ${!livecommit} ]] && ewarn "QA: using \"${esc_pn}_LIVE_COMMIT\" variable, you won't get any support"
+	EGIT_COMMIT=${!livecommit:-${EGIT_COMMIT:-${EGIT_BRANCH}}}
 
 	: ${EGIT_REPACK:=}
 
-- 
1.7.6.1

From 88a37d65fcb2a4f7e4c40fecb3ab14c7a62c3bc5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgo...@gentoo.org>
Date: Tue, 20 Sep 2011 20:53:26 +0200
Subject: [PATCH 07/11] Move pushd/popds within conditional to avoid needless
 exec.

---
 eclass/git-2.eclass |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/eclass/git-2.eclass b/eclass/git-2.eclass
index cc2cc95..a94dc7c 100644
--- a/eclass/git-2.eclass
+++ b/eclass/git-2.eclass
@@ -217,15 +217,15 @@ git-2_gc() {
 
 	local args
 
-	pushd "${EGIT_DIR}" > /dev/null
 	if [[ ${EGIT_REPACK} || ${EGIT_PRUNE} ]]; then
+		pushd "${EGIT_DIR}" > /dev/null
 		ebegin "Garbage collecting the repository"
 		[[ ${EGIT_PRUNE} ]] && args='--prune'
 		debug-print "${FUNCNAME}: git gc ${args}"
 		git gc ${args}
 		eend $?
+		popd > /dev/null
 	fi
-	popd > /dev/null
 }
 
 # @FUNCTION: git-2_prepare_storedir
-- 
1.7.6.1

Attachment: signature.asc
Description: PGP signature

Reply via email to