Index: cros_workon |
diff --git a/cros_workon b/cros_workon |
index 128933a84a540d971db8302fe5a5d4d17043592a..e9400da47dc31b26289c40f44d3a58100aaeada3 100755 |
--- a/cros_workon |
+++ b/cros_workon |
@@ -148,6 +148,25 @@ regen_manifest_and_sync() { |
find_repo_dir |
local_manifest="${REPODIR}/local_manifest.xml" |
+ # ensure we don't clobber existing manifest entries |
+ if [ -f "${local_manifest}" ]; then |
+ grep -q -i "<remote" "${local_manifest}" |
+ if [ $? -ne 1 ]; then |
+ die "Your local manifest will be clobbered running cros_workon. You can not have any <remote> tags at all." |
+ fi |
+ sed -ne '/^[[:space:]]\+[^[:space:]]/q1' "${local_manifest}" |
+ if [ $? -ne 0 ]; then |
+ die "Your local manifest will be clobbered running cros_workon. You can not have any tags that span multiple lines or are indented." |
+ fi |
+ egrep -q "^[^<]" "${local_manifest}" |
+ if [ $? -ne 1 ]; then |
+ die "Your local manifest will be clobbered running cros_workon. You can not have any tags that span multiple lines" |
+ fi |
+ grep -v "<project" "${local_manifest}" | grep -q -i "<project" |
+ if [ $? -eq 0 ]; then |
+ die "Your local manifest has mixed case tags for project. You can not have mixed case tags" |
+ fi |
+ fi |
# preserve old manifest entries |
[ -f "${local_manifest}" ] && \ |
MANIFEST_ENTRIES_OLD=$(cat "${local_manifest}" | grep "^<project") |