diff --git a/gclient_scm.py b/gclient_scm.py index 0bbc940e6..5294ceafa 100644 --- a/gclient_scm.py +++ b/gclient_scm.py @@ -906,8 +906,8 @@ class GitWrapper(SCMWrapper): merge_output = self._Capture(merge_args) except subprocess2.CalledProcessError as e: rebase_files = [] - if re.match(b'fatal: Not possible to fast-forward, aborting.', - e.stderr): + if re.search(b'fatal: Not possible to fast-forward, aborting.', + e.stderr): if not printed_path: self.Print('_____ %s at %s' % (self.relpath, revision), timestamp=False) @@ -1375,8 +1375,9 @@ class GitWrapper(SCMWrapper): except subprocess2.CalledProcessError: raise gclient_utils.Error('\n____ %s at %s\n' '\tYou have unstaged changes.\n' - '\tPlease commit, stash, or reset.\n' - % (self.relpath, revision)) + '\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', '--'], @@ -1384,8 +1385,9 @@ class GitWrapper(SCMWrapper): except subprocess2.CalledProcessError: raise gclient_utils.Error('\n____ %s at %s\n' '\tYour index contains uncommitted changes\n' - '\tPlease commit, stash, or reset.\n' - % (self.relpath, revision)) + '\tcd into %s, run git status to see changes,\n' + '\tand commit, stash, or reset.\n' % + (self.relpath, revision, self.relpath)) def _CheckDetachedHead(self, revision, _options): # HEAD is detached. Make sure it is safe to move away from (i.e., it is diff --git a/tests/gclient_scm_test.py b/tests/gclient_scm_test.py index 3f1484f8c..5ed42a0cf 100755 --- a/tests/gclient_scm_test.py +++ b/tests/gclient_scm_test.py @@ -598,10 +598,10 @@ class ManagedGitWrapperTestCase(BaseGitWrapperTestCase): with self.assertRaises(gclient_scm.gclient_utils.Error) as e: scm.update(options, (), []) self.assertEqual( - e.exception.args[0], - '\n____ . at refs/remotes/origin/main\n' + e.exception.args[0], '\n____ . at refs/remotes/origin/main\n' '\tYou have unstaged changes.\n' - '\tPlease commit, stash, or reset.\n') + '\tcd into ., run git status to see changes,\n' + '\tand commit, stash, or reset.\n') sys.stdout.close()