Better error checking in git freeze

R=iannucci@chromium.org
BUG=567157

Review-Url: https://codereview.chromium.org/1527403002
changes/90/365990/1
agable 9 years ago committed by Commit bot
parent cd0b7abe26
commit 96e179bba0

@ -431,15 +431,24 @@ def freeze():
except subprocess2.CalledProcessError:
pass
add_errors = False
try:
run('add', '-A', '--ignore-errors')
except subprocess2.CalledProcessError:
add_errors = True
try:
run('add', '-A')
run('commit', '--no-verify', '-m', FREEZE + '.unindexed')
took_action = True
except subprocess2.CalledProcessError:
pass
ret = []
if add_errors:
ret.append('Failed to index some unindexed files.')
if not took_action:
return 'Nothing to freeze.'
ret.append('Nothing to freeze.')
return ' '.join(ret) or None
def get_branch_tree():

@ -872,6 +872,17 @@ class GitFreezeThaw(git_test_utils.GitRepoReadWriteTestBase):
self.repo.run(inner)
def testAddError(self):
def inner():
self.repo.git('checkout', '-b', 'unreadable_file_branch')
with open('bad_file', 'w') as f:
f.write('some text')
os.chmod('bad_file', 0111)
ret = self.repo.run(self.gc.freeze)
self.assertIn('Failed to index some unindexed files.', ret)
self.repo.run(inner)
class GitMakeWorkdir(git_test_utils.GitRepoReadOnlyTestBase, GitCommonTestBase):
def setUp(self):

Loading…
Cancel
Save