Commit 2b7d3ed2 authored by vadimsh@chromium.org's avatar vadimsh@chromium.org

Allow gclient sync to overwrite untracked files when moving detached git HEAD.

Do it only when both --force and --delete_unversioned_trees are specified.

BUG=386878
R=iannucci@chromium.org

Review URL: https://codereview.chromium.org/334633004

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@278770 0039d316-1c4b-4281-b951-d872f2087c98
parent 8a13970e
...@@ -498,7 +498,12 @@ class GitWrapper(SCMWrapper): ...@@ -498,7 +498,12 @@ class GitWrapper(SCMWrapper):
if self._Capture(['rev-list', '-n', '1', 'HEAD']) == revision: if self._Capture(['rev-list', '-n', '1', 'HEAD']) == revision:
self.Print('Up-to-date; skipping checkout.') self.Print('Up-to-date; skipping checkout.')
else: else:
self._Capture(['checkout', '--quiet', '%s' % revision]) # 'git checkout' may need to overwrite existing untracked files. Allow
# it only when nuclear options are enabled.
if options.force and options.delete_unversioned_trees:
self._Capture(['checkout', '--force', '--quiet', '%s' % revision])
else:
self._Capture(['checkout', '--quiet', '%s' % revision])
if not printed_path: if not printed_path:
self.Print('_____ %s%s' % (self.relpath, rev_str), timestamp=False) self.Print('_____ %s%s' % (self.relpath, rev_str), timestamp=False)
elif current_type == 'hash': elif current_type == 'hash':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment