|
1 | 1 | package org.scm4j.vcs;
|
2 | 2 |
|
3 |
| -import java.io.ByteArrayOutputStream; |
4 |
| -import java.io.File; |
5 |
| -import java.io.FileWriter; |
6 |
| -import java.io.IOException; |
7 |
| -import java.net.Authenticator; |
8 |
| -import java.net.InetSocketAddress; |
9 |
| -import java.net.PasswordAuthentication; |
10 |
| -import java.net.Proxy; |
11 |
| -import java.net.Proxy.Type; |
12 |
| -import java.net.ProxySelector; |
13 |
| -import java.net.SocketAddress; |
14 |
| -import java.net.URI; |
15 |
| -import java.nio.charset.StandardCharsets; |
16 |
| -import java.util.ArrayList; |
17 |
| -import java.util.Collections; |
18 |
| -import java.util.HashSet; |
19 |
| -import java.util.List; |
20 |
| -import java.util.Set; |
21 |
| - |
22 | 3 | import org.apache.commons.io.FileUtils;
|
23 | 4 | import org.apache.commons.io.IOUtils;
|
24 | 5 | import org.eclipse.jgit.api.CreateBranchCommand.SetupUpstreamMode;
|
|
32 | 13 | import org.eclipse.jgit.diff.DiffEntry.ChangeType;
|
33 | 14 | import org.eclipse.jgit.diff.DiffEntry.Side;
|
34 | 15 | import org.eclipse.jgit.diff.DiffFormatter;
|
35 |
| -import org.eclipse.jgit.lib.Constants; |
36 |
| -import org.eclipse.jgit.lib.ObjectId; |
37 |
| -import org.eclipse.jgit.lib.ObjectReader; |
38 |
| -import org.eclipse.jgit.lib.Ref; |
39 |
| -import org.eclipse.jgit.lib.Repository; |
| 16 | +import org.eclipse.jgit.lib.*; |
40 | 17 | import org.eclipse.jgit.revwalk.RevCommit;
|
41 | 18 | import org.eclipse.jgit.revwalk.RevSort;
|
42 | 19 | import org.eclipse.jgit.revwalk.RevTag;
|
|
46 | 23 | import org.eclipse.jgit.transport.RefSpec;
|
47 | 24 | import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider;
|
48 | 25 | import org.eclipse.jgit.treewalk.CanonicalTreeParser;
|
49 |
| -import org.scm4j.vcs.api.IVCS; |
50 |
| -import org.scm4j.vcs.api.VCSChangeType; |
51 |
| -import org.scm4j.vcs.api.VCSCommit; |
52 |
| -import org.scm4j.vcs.api.VCSDiffEntry; |
53 |
| -import org.scm4j.vcs.api.VCSMergeResult; |
54 |
| -import org.scm4j.vcs.api.VCSTag; |
55 |
| -import org.scm4j.vcs.api.WalkDirection; |
| 26 | +import org.scm4j.vcs.api.*; |
56 | 27 | import org.scm4j.vcs.api.exceptions.EVCSBranchExists;
|
57 | 28 | import org.scm4j.vcs.api.exceptions.EVCSException;
|
58 | 29 | import org.scm4j.vcs.api.exceptions.EVCSFileNotFound;
|
|
61 | 32 | import org.scm4j.vcs.api.workingcopy.IVCSRepositoryWorkspace;
|
62 | 33 | import org.scm4j.vcs.api.workingcopy.IVCSWorkspace;
|
63 | 34 |
|
| 35 | +import java.io.ByteArrayOutputStream; |
| 36 | +import java.io.File; |
| 37 | +import java.io.FileWriter; |
| 38 | +import java.io.IOException; |
| 39 | +import java.net.*; |
| 40 | +import java.net.Proxy.Type; |
| 41 | +import java.nio.charset.StandardCharsets; |
| 42 | +import java.util.*; |
| 43 | + |
64 | 44 | public class GitVCS implements IVCS {
|
65 | 45 |
|
66 | 46 | private static final String MASTER_BRANCH_NAME = "master";
|
@@ -813,7 +793,7 @@ public VCSTag getLastTag() {
|
813 | 793 | List<Ref> tagRefs = getTagRefs();
|
814 | 794 | RevTag revTag;
|
815 | 795 | RevCommit revCommit;
|
816 |
| - Ref ref = tagRefs.get(0); |
| 796 | + Ref ref = tagRefs.get(tagRefs.size() - 1); |
817 | 797 | revTag = rw.parseTag(ref.getObjectId());
|
818 | 798 | revCommit = rw.parseCommit(ref.getObjectId());
|
819 | 799 | VCSCommit relatedCommit = new VCSCommit(revCommit.getName(), revCommit.getFullMessage(), revCommit.getAuthorIdent().getName());
|
|
0 commit comments