| Index: git_cl.py
|
| diff --git a/git_cl.py b/git_cl.py
|
| index 62f339d9a3e3e2534aa4801b72f5ccf7d635da15..fd426f05e7d171393e105e95d8492742862a2de7 100755
|
| --- a/git_cl.py
|
| +++ b/git_cl.py
|
| @@ -999,10 +999,13 @@ def CMDpresubmit(parser, args):
|
|
|
| # Make sure index is up-to-date before running diff-index.
|
| RunGit(['update-index', '--refresh', '-q'], error_ok=True)
|
| - if not options.force and RunGit(['diff-index', 'HEAD']):
|
| + diff_index = RunGit(['diff-index', 'HEAD'])
|
| + if not options.force and diff_index:
|
| # TODO(maruel): Is this really necessary?
|
| - print ('Cannot presubmit with a dirty tree.\n'
|
| - 'You must commit locally first (or use --force).')
|
| + print >> sys.stderr, (
|
| + 'Cannot presubmit with a dirty tree.\n'
|
| + 'You must commit locally first (or use --force).\n'
|
| + 'git diff-index HEAD\n%s' % diff_index[:4096])
|
| return 1
|
|
|
| cl = Changelist()
|
| @@ -1201,8 +1204,11 @@ def CMDupload(parser, args):
|
|
|
| # Make sure index is up-to-date before running diff-index.
|
| RunGit(['update-index', '--refresh', '-q'], error_ok=True)
|
| - if RunGit(['diff-index', 'HEAD']):
|
| - print 'Cannot upload with a dirty tree. You must commit locally first.'
|
| + diff_index = RunGit(['diff-index', 'HEAD'])
|
| + if diff_index:
|
| + print >> sys.stderr, (
|
| + 'Cannot upload with a dirty tree. You must commit locally first.'
|
| + 'git diff-index HEAD\n%s' % diff_index[:4096])
|
| return 1
|
|
|
| cl = Changelist()
|
| @@ -1274,8 +1280,11 @@ def SendUpstream(parser, args, cmd):
|
|
|
| # Make sure index is up-to-date before running diff-index.
|
| RunGit(['update-index', '--refresh', '-q'], error_ok=True)
|
| - if RunGit(['diff-index', 'HEAD']):
|
| - print 'Cannot %s with a dirty tree. You must commit locally first.' % cmd
|
| + diff_index = RunGit(['diff-index', 'HEAD'])
|
| + if diff_index:
|
| + print >> sys.stderr, (
|
| + 'Cannot %s with a dirty tree. You must commit locally first.'
|
| + 'git diff-index HEAD\n%s' % (cmd, diff_index[:4096]))
|
| return 1
|
|
|
| # This rev-list syntax means "show all commits not in my branch that
|
|
|