mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-06 13:35:44 +01:00
do not strip git ids
This commit is contained in:
@@ -84,10 +84,9 @@ public class GitChangesetConverter implements Closeable
|
||||
* @param repository
|
||||
* @param idLength
|
||||
*/
|
||||
public GitChangesetConverter(org.eclipse.jgit.lib.Repository repository,
|
||||
int idLength)
|
||||
public GitChangesetConverter(org.eclipse.jgit.lib.Repository repository)
|
||||
{
|
||||
this(repository, null, idLength);
|
||||
this(repository, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -99,7 +98,7 @@ public class GitChangesetConverter implements Closeable
|
||||
* @param idLength
|
||||
*/
|
||||
public GitChangesetConverter(org.eclipse.jgit.lib.Repository repository,
|
||||
RevWalk revWalk, int idLength)
|
||||
RevWalk revWalk)
|
||||
{
|
||||
this.repository = repository;
|
||||
|
||||
@@ -113,7 +112,6 @@ public class GitChangesetConverter implements Closeable
|
||||
this.revWalk = new RevWalk(repository);
|
||||
}
|
||||
|
||||
this.idLength = idLength;
|
||||
this.tags = GitUtil.createTagMap(repository, revWalk);
|
||||
treeWalk = new TreeWalk(repository);
|
||||
}
|
||||
@@ -143,7 +141,7 @@ public class GitChangesetConverter implements Closeable
|
||||
*/
|
||||
public Changeset createChangeset(RevCommit commit) throws IOException
|
||||
{
|
||||
String id = commit.getId().abbreviate(idLength).name();
|
||||
String id = commit.getId().name();
|
||||
List<String> parentList = null;
|
||||
RevCommit[] parents = commit.getParents();
|
||||
|
||||
@@ -153,7 +151,7 @@ public class GitChangesetConverter implements Closeable
|
||||
|
||||
for (RevCommit parent : parents)
|
||||
{
|
||||
parentList.add(parent.getId().abbreviate(idLength).name());
|
||||
parentList.add(parent.getId().name());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -307,9 +305,6 @@ public class GitChangesetConverter implements Closeable
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private int idLength;
|
||||
|
||||
/** Field description */
|
||||
private org.eclipse.jgit.lib.Repository repository;
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ public class GitChangesetViewer implements ChangesetViewer
|
||||
|
||||
if (commit != null)
|
||||
{
|
||||
converter = new GitChangesetConverter(gr, revWalk, GitUtil.ID_LENGTH);
|
||||
converter = new GitChangesetConverter(gr, revWalk);
|
||||
changeset = converter.createChangeset(commit);
|
||||
}
|
||||
else if (logger.isWarnEnabled())
|
||||
@@ -169,7 +169,7 @@ public class GitChangesetViewer implements ChangesetViewer
|
||||
|
||||
if (!gr.getAllRefs().isEmpty())
|
||||
{
|
||||
converter = new GitChangesetConverter(gr, GitUtil.ID_LENGTH);
|
||||
converter = new GitChangesetConverter(gr);
|
||||
|
||||
Git git = new Git(gr);
|
||||
ObjectId headId = GitUtil.getRepositoryHead(gr);
|
||||
@@ -253,7 +253,7 @@ public class GitChangesetViewer implements ChangesetViewer
|
||||
|
||||
if (!gr.getAllRefs().isEmpty())
|
||||
{
|
||||
converter = new GitChangesetConverter(gr, GitUtil.ID_LENGTH);
|
||||
converter = new GitChangesetConverter(gr);
|
||||
|
||||
Git git = new Git(gr);
|
||||
ObjectId revisionId = GitUtil.getRevisionId(gr, revision);
|
||||
|
||||
@@ -141,7 +141,7 @@ public class GitRepositoryHookEvent extends AbstractRepositoryHookEvent
|
||||
try
|
||||
{
|
||||
repository = GitUtil.open(directory);
|
||||
converter = new GitChangesetConverter(repository, GitUtil.ID_LENGTH);
|
||||
converter = new GitChangesetConverter(repository);
|
||||
walk = new RevWalk(repository);
|
||||
walk.reset();
|
||||
walk.sort(RevSort.NONE);
|
||||
|
||||
@@ -66,9 +66,6 @@ import java.util.Map;
|
||||
public class GitUtil
|
||||
{
|
||||
|
||||
/** Field description */
|
||||
public static final int ID_LENGTH = 20;
|
||||
|
||||
/** Field description */
|
||||
public static final String REF_HEAD = "HEAD";
|
||||
|
||||
|
||||
@@ -60,7 +60,6 @@ import sonia.scm.util.IOUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@@ -128,7 +127,7 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand
|
||||
|
||||
if (commit != null)
|
||||
{
|
||||
converter = new GitChangesetConverter(gr, revWalk, GitUtil.ID_LENGTH);
|
||||
converter = new GitChangesetConverter(gr, revWalk);
|
||||
changeset = converter.createChangeset(commit);
|
||||
}
|
||||
else if (logger.isWarnEnabled())
|
||||
@@ -210,7 +209,7 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand
|
||||
|
||||
RevWalk revWalk = new RevWalk(gr);
|
||||
|
||||
converter = new GitChangesetConverter(gr, revWalk, GitUtil.ID_LENGTH);
|
||||
converter = new GitChangesetConverter(gr, revWalk);
|
||||
|
||||
if (!Strings.isNullOrEmpty(request.getPath()))
|
||||
{
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.repository.client.spi;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
@@ -42,7 +43,6 @@ import org.eclipse.jgit.revwalk.RevCommit;
|
||||
|
||||
import sonia.scm.repository.Changeset;
|
||||
import sonia.scm.repository.GitChangesetConverter;
|
||||
import sonia.scm.repository.GitUtil;
|
||||
import sonia.scm.repository.client.api.RepositoryClientException;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
@@ -92,8 +92,7 @@ public class GitCommitCommand implements CommitCommand
|
||||
request.getAuthor().getMail()).setMessage(
|
||||
request.getMessage()).call();
|
||||
|
||||
converter = new GitChangesetConverter(git.getRepository(),
|
||||
GitUtil.ID_LENGTH);
|
||||
converter = new GitChangesetConverter(git.getRepository());
|
||||
|
||||
changeset = converter.createChangeset(commit);
|
||||
}
|
||||
|
||||
@@ -94,8 +94,8 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase
|
||||
assertNotNull(result);
|
||||
assertEquals(2, result.getTotal());
|
||||
assertEquals(2, result.getChangesets().size());
|
||||
assertEquals("fcd0ef1831e4002ac43e", result.getChangesets().get(0).getId());
|
||||
assertEquals("435df2f061add3589cb3", result.getChangesets().get(1).getId());
|
||||
assertEquals("fcd0ef1831e4002ac43ea539f4094334c79ea9ec", result.getChangesets().get(0).getId());
|
||||
assertEquals("435df2f061add3589cb326cc64be9b9c3897ceca", result.getChangesets().get(1).getId());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -121,12 +121,12 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase
|
||||
Changeset c1 = result.getChangesets().get(0);
|
||||
|
||||
assertNotNull(c1);
|
||||
assertEquals("fcd0ef1831e4002ac43e", c1.getId());
|
||||
assertEquals("fcd0ef1831e4002ac43ea539f4094334c79ea9ec", c1.getId());
|
||||
|
||||
Changeset c2 = result.getChangesets().get(1);
|
||||
|
||||
assertNotNull(c2);
|
||||
assertEquals("86a6645eceefe8b9a247", c2.getId());
|
||||
assertEquals("86a6645eceefe8b9a247db5eb16e3d89a7e6e6d1", c2.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -153,12 +153,12 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase
|
||||
Changeset c1 = result.getChangesets().get(0);
|
||||
|
||||
assertNotNull(c1);
|
||||
assertEquals("86a6645eceefe8b9a247", c1.getId());
|
||||
assertEquals("86a6645eceefe8b9a247db5eb16e3d89a7e6e6d1", c1.getId());
|
||||
|
||||
Changeset c2 = result.getChangesets().get(1);
|
||||
|
||||
assertNotNull(c2);
|
||||
assertEquals("592d797cd36432e59141", c2.getId());
|
||||
assertEquals("592d797cd36432e591416e8b2b98154f4f163411", c2.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -172,7 +172,7 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase
|
||||
Changeset c = command.getChangeset("435df2f061add3589cb3");
|
||||
|
||||
assertNotNull(c);
|
||||
assertEquals("435df2f061add3589cb3", c.getId());
|
||||
assertEquals("435df2f061add3589cb326cc64be9b9c3897ceca", c.getId());
|
||||
assertEquals("added a and b files", c.getDescription());
|
||||
checkDate(c.getDate());
|
||||
assertEquals("Douglas Adams", c.getAuthor().getName());
|
||||
@@ -214,9 +214,9 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase
|
||||
Changeset c2 = result.getChangesets().get(1);
|
||||
|
||||
assertNotNull(c1);
|
||||
assertEquals("592d797cd36432e59141", c1.getId());
|
||||
assertEquals("592d797cd36432e591416e8b2b98154f4f163411", c1.getId());
|
||||
assertNotNull(c2);
|
||||
assertEquals("435df2f061add3589cb3", c2.getId());
|
||||
assertEquals("435df2f061add3589cb326cc64be9b9c3897ceca", c2.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user