1
2
3
4
5
6
7
8
9
10
11 package org.eclipse.jgit.internal.storage.file;
12
13 import static org.junit.Assert.assertTrue;
14
15 import java.util.Collections;
16
17 import org.eclipse.jgit.lib.ObjectId;
18 import org.eclipse.jgit.revwalk.RevBlob;
19 import org.eclipse.jgit.revwalk.RevTag;
20 import org.junit.Test;
21
22 public class GcTagTest extends GcTestCase {
23 @Test
24 public void lightweightTag_objectNotPruned() throws Exception {
25 RevBlob a = tr.blob("a");
26 tr.lightweightTag("t", a);
27 gc.setExpireAgeMillis(0);
28 fsTick();
29 gc.prune(Collections.<ObjectId> emptySet());
30 assertTrue(repo.getObjectDatabase().has(a));
31 }
32
33 @Test
34 public void annotatedTag_objectNotPruned() throws Exception {
35 RevBlob a = tr.blob("a");
36 RevTag t = tr.tag("t", a);
37 tr.lightweightTag("t", t);
38
39 gc.setExpireAgeMillis(0);
40 fsTick();
41 gc.prune(Collections.<ObjectId> emptySet());
42 assertTrue(repo.getObjectDatabase().has(t));
43 assertTrue(repo.getObjectDatabase().has(a));
44 }
45 }