diff --git a/gclient_scm.py b/gclient_scm.py index 18811c4538..574da8c3de 100644 --- a/gclient_scm.py +++ b/gclient_scm.py @@ -1422,28 +1422,15 @@ class GitWrapper(SCMWrapper): '\tIf no git executable is running, then clean up %r and try again.\n' % (self.relpath, revision, lockfile)) - # Make sure the tree is clean; see git-rebase.sh for reference - try: - scm.GIT.Capture( - ['update-index', '--ignore-submodules', '--refresh'], - cwd=self.checkout_path) - except subprocess2.CalledProcessError: - raise gclient_utils.Error( - '\n____ %s at %s\n' - '\tYou have unstaged changes.\n' - '\tcd into %s, run git status to see changes,\n' - '\tand commit, stash, or reset.\n' % - (self.relpath, revision, self.relpath)) - try: - scm.GIT.Capture([ - 'diff-index', '--cached', '--name-status', '-r', - '--ignore-submodules', 'HEAD', '--' - ], - cwd=self.checkout_path) - except subprocess2.CalledProcessError: + # Ensure that the tree is clean. + if scm.GIT.Capture([ + 'status', '--porcelain', '--untracked-files=no', + '--ignore-submodules' + ], + cwd=self.checkout_path): raise gclient_utils.Error( '\n____ %s at %s\n' - '\tYour index contains uncommitted changes\n' + '\tYou have uncommitted changes.\n' '\tcd into %s, run git status to see changes,\n' '\tand commit, stash, or reset.\n' % (self.relpath, revision, self.relpath)) diff --git a/tests/gclient_scm_test.py b/tests/gclient_scm_test.py index 5f1adf14b6..005518b1b5 100755 --- a/tests/gclient_scm_test.py +++ b/tests/gclient_scm_test.py @@ -584,7 +584,7 @@ class ManagedGitWrapperTestCase(BaseGitWrapperTestCase): scm.update(options, (), []) self.assertEqual( e.exception.args[0], '\n____ . at refs/remotes/origin/main\n' - '\tYou have unstaged changes.\n' + '\tYou have uncommitted changes.\n' '\tcd into ., run git status to see changes,\n' '\tand commit, stash, or reset.\n')