Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Unified Diff: tools/common-includes.sh

Issue 9844015: Allow a commit message to be specified to merge-to-branch.sh (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Handle persisting empty variables correctly Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/merge-to-branch.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/common-includes.sh
diff --git a/tools/common-includes.sh b/tools/common-includes.sh
index c7d5bc2d3dc379cf9942f9ffa0e4a89367d97f51..d1b8b01473bd85e536130b7191904a15e2192a20 100644
--- a/tools/common-includes.sh
+++ b/tools/common-includes.sh
@@ -77,20 +77,27 @@ delete_branch() {
persist() {
local VARNAME=$1
local FILE="$PERSISTFILE_BASENAME-$VARNAME"
- echo "${!VARNAME}" > $FILE
+ local VALUE="${!VARNAME}"
+ if [ -z "$VALUE" ] ; then
+ VALUE="__EMPTY__"
+ fi
+ echo "$VALUE" > $FILE
}
restore() {
local VARNAME=$1
local FILE="$PERSISTFILE_BASENAME-$VARNAME"
local VALUE="$(cat $FILE)"
Sven Panne 2012/03/28 11:40:39 I'm just curious: Why is this detour via __EMPTY__
+ [[ -z "$VALUE" ]] && die "Variable '$VARNAME' could not be restored."
+ if [ "$VALUE" == "__EMPTY__" ] ; then
+ VALUE=""
+ fi
eval "$VARNAME=\"$VALUE\""
}
restore_if_unset() {
local VARNAME=$1
[[ -z "${!VARNAME}" ]] && restore "$VARNAME"
- [[ -z "${!VARNAME}" ]] && die "Variable '$VARNAME' could not be restored."
}
initial_environment_checks() {
« no previous file with comments | « no previous file | tools/merge-to-branch.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698