Skip to content
Snippets Groups Projects
Commit 16b45ef1 authored by Diego Wilson's avatar Diego Wilson
Browse files

Add a 'force' option

Abort patching a project if there's uncommited changes. Give the user an
option to 'force' overwritten their uncommited changes

Change-Id: Ie6952e8cdb432b94fcc96f64962544f7fb7e977e
parent 347f4b4b
No related branches found
No related tags found
No related merge requests found
......@@ -148,6 +148,14 @@ __patch_tree()
(
set -e
if branch ${PRJ} ; then
if [[ -n $(git status --porcelain) ]]; then
if [[ $1 != "force" ]]; then
echo "ERROR: You have uncommited changes in ${PRJ}"
echo "You may force overwriting these changes"
echo "with |source build/envsetup.sh force|"
exit 1
fi
fi
# Ensure the project is clean before applying patches to it
git reset --hard HEAD > /dev/null
git clean -dfx
......@@ -222,6 +230,7 @@ if [[ -z $1 ]]; then
else
case $1 in
clean) __abandon_tree ;;
force) __patch_tree force ;;
np) echo "Skipping patch tree step...";;
*) [[ -z "$PS1" ]] && __patch_tree || echo Error: Unknown command: $1
esac
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment