Skip to content

FIx issue #464 corrupt log file #469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Aug 2, 2016
Prev Previous commit
Next Next commit
add test to detect the corrupt log
- add a second line to commit messages with the "BAD MESSAGE" text
- read in the log and confirm that the seond line is not in the log file
  • Loading branch information
barry-scott committed Aug 1, 2016
commit 8bde1038e19108ec90f899ce4aff7f31c1e387eb
13 changes: 12 additions & 1 deletion git/test/test_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -775,12 +775,23 @@ def test_empty_repo(self, rw_dir):
new_file_path = os.path.join(rw_dir, "new_file.ext")
touch(new_file_path)
r.index.add([new_file_path])
r.index.commit("initial commit")
r.index.commit("initial commit\nBAD MESSAGE 1\n")

# Now a branch should be creatable
nb = r.create_head('foo')
assert nb.is_valid()

with open( new_file_path, 'w' ) as f:
f.write( 'Line 1\n' )

r.index.add([new_file_path])
r.index.commit("add line 1\nBAD MESSAGE 2\n")

with open( '%s/.git/logs/refs/heads/master' % (rw_dir,), 'r' ) as f:
contents = f.read()

assert 'BAD MESSAGE' not in contents, 'log is corrupt'

def test_merge_base(self):
repo = self.rorepo
c1 = 'f6aa8d1'
Expand Down