]> source.dussan.org Git - jgit.git/commit
Make InMemoryRepository pack names globally unique 32/6532/1
authorDave Borowitz <dborowitz@google.com>
Wed, 27 Jun 2012 20:55:25 +0000 (13:55 -0700)
committerDave Borowitz <dborowitz@google.com>
Wed, 27 Jun 2012 20:55:25 +0000 (13:55 -0700)
commitdc23a7cc421f09da42192c54ea8d54fb2ca30dfb
treecdb2505ff39eedccc973d39fb2b662d2a5ce5429
parent2d1124b89bbe739cf828c57a104a7b48e26c5db9
Make InMemoryRepository pack names globally unique

It was easy to create multiple packs with exactly the same name and
same DfsRepositoryDescription in a test, which can poison the
DfsBlockCache. The javadoc for DfsObjDatabase.newPack() explicitly
says pack names should be unique within an entire DFS, so do this by
making the packId AtomicInteger static.

Arguably, test writers shouldn't be doing things like putting
'new DfsRepositoryDescription("test")' in a setUp() method, but that's
a natural thing to do, and we don't document this restriction
anywhere.

Change-Id: I9477413ab3950d83b7d17e173fbc0a3e064896e3
org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/InMemoryRepository.java