From 3f0dacf095df6f73a2c54a8a9fb35c1c441a2fe1 Mon Sep 17 00:00:00 2001 From: "hinoka@chromium.org" Date: Mon, 25 Apr 2016 22:06:53 +0000 Subject: [PATCH] Gclient: Don't check if repository is clean if --force is passed in Instead just do a git checkout --force, since there are some states that reset cannot fix. BUG=606420 Review URL: https://codereview.chromium.org/1916973002 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@300176 0039d316-1c4b-4281-b951-d872f2087c98 --- gclient_scm.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gclient_scm.py b/gclient_scm.py index 9a6f51234..79fb6ea58 100644 --- a/gclient_scm.py +++ b/gclient_scm.py @@ -553,7 +553,9 @@ class GitWrapper(SCMWrapper): if current_type == 'detached': # case 0 - self._CheckClean(rev_str) + if not options.force: + # Don't do this check if nuclear option is on. + self._CheckClean(rev_str) self._CheckDetachedHead(rev_str, options) if self._Capture(['rev-list', '-n', '1', 'HEAD']) == revision: self.Print('Up-to-date; skipping checkout.') @@ -563,7 +565,7 @@ class GitWrapper(SCMWrapper): self._Checkout( options, revision, - force=(options.force and options.delete_unversioned_trees), + force=(options.force or options.delete_unversioned_trees), quiet=True, ) if not printed_path: