From d44fa850cdfdbb8ed9c58f6a16af651766d04843 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Borgstr=C3=B6m?= Date: Sun, 16 Feb 2014 22:37:12 +0100 Subject: [PATCH] Fix exception during "attic create" with repeated files Closes #39 --- CHANGES | 1 + attic/cache.py | 3 ++- attic/testsuite/archiver.py | 5 +++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index d0e6fe8e6..15ed5beb7 100644 --- a/CHANGES +++ b/CHANGES @@ -10,6 +10,7 @@ Version 0.11 - New "check" command for repository consistency checking (#24) - Documentation improvements +- Fix exception during "attic create" with repeated files (#39) Version 0.10 ------------ diff --git a/attic/cache.py b/attic/cache.py index 62c4b725c..8c4a4caf3 100644 --- a/attic/cache.py +++ b/attic/cache.py @@ -206,7 +206,8 @@ def file_known_and_unchanged(self, path_hash, st): if (entry and entry[3] == st_mtime_ns(st) and entry[2] == st.st_size and entry[1] == st.st_ino): # reset entry age - self.files[path_hash][0] = 0 + if entry[0] != 0: + self.files[path_hash][0] = 0 return entry[4] else: return None diff --git a/attic/testsuite/archiver.py b/attic/testsuite/archiver.py index 72ef59864..43c770be7 100644 --- a/attic/testsuite/archiver.py +++ b/attic/testsuite/archiver.py @@ -179,6 +179,11 @@ def test_path_normalization(self): self.assert_not_in('..', output) self.assert_in(' input/dir1/dir2/file', output) + def test_repeated_files(self): + self.create_regual_file('file1', size=1024 * 80) + self.attic('init', self.repository_location) + self.attic('create', self.repository_location + '::test', 'input', 'input') + def test_overwrite(self): self.create_regual_file('file1', size=1024 * 80) self.create_regual_file('dir2/file2', size=1024 * 80)