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

Unified Diff: bin/cros_workon_make

Issue 5265009: [crosutils] Add confirmation warning to cros_workon_make --scrub (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: quiet grep instead of redirecting Created 10 years, 1 month 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bin/cros_workon_make
diff --git a/bin/cros_workon_make b/bin/cros_workon_make
index 95cc709a5dd41ec4246c8913d50a535ae0b85592..da2a3ebca517dfe21ac8c9a0fc54f802154f131c 100755
--- a/bin/cros_workon_make
+++ b/bin/cros_workon_make
@@ -58,12 +58,18 @@ if ! pkgfile=$("${EQUERYCMD}" which "${workon_name}" 2> /dev/null); then
fi
if [ "${FLAGS_scrub}" = "${FLAGS_TRUE}" ]; then
- eval $(${EBUILDCMD} $(${EQUERYCMD} which ${workon_name}) info)
- srcdir=$(readlink -m ${CROS_WORKON_SRCDIR})
- trunkdir=$(readlink -m ${CHROOT_TRUNK_DIR})
- project_path=${srcdir#${trunkdir}/}
- if ! (cd "${GCLIENT_ROOT}/${project_path}" && git clean -xf); then
- die "Could not scrub source directory"
+ warn "--scrub will destroy ALL FILES unknown to git!"
+ read -p "Are you sure you want to do this? [y|N]" resp
+ if egrep -qi "^y(es)?$" <(echo -n "${resp}"); then
+ eval $(${EBUILDCMD} $(${EQUERYCMD} which ${workon_name}) info)
+ srcdir=$(readlink -m ${CROS_WORKON_SRCDIR})
+ trunkdir=$(readlink -m ${CHROOT_TRUNK_DIR})
+ project_path=${srcdir#${trunkdir}/}
+ if ! (cd "${GCLIENT_ROOT}/${project_path}" && git clean -xf); then
+ die "Could not scrub source directory"
+ fi
+ else
+ info "Not scrubbing; exiting gracefully"
fi
exit 0
fi
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698