Sebastian Sdorra avatar Sebastian Sdorra committed b69de76

do not strip git ids

Comments (0)

Files changed (7)

scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/GitChangesetConverter.java

    * @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);
   }
 
   /**
    * @param idLength
    */
   public GitChangesetConverter(org.eclipse.jgit.lib.Repository repository,
-    RevWalk revWalk, int idLength)
+    RevWalk revWalk)
   {
     this.repository = repository;
 
       this.revWalk = new RevWalk(repository);
     }
 
-    this.idLength = idLength;
     this.tags = GitUtil.createTagMap(repository, revWalk);
     treeWalk = new TreeWalk(repository);
   }
    */
   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();
 
 
       for (RevCommit parent : parents)
       {
-        parentList.add(parent.getId().abbreviate(idLength).name());
+        parentList.add(parent.getId().name());
       }
     }
 
   //~--- fields ---------------------------------------------------------------
 
   /** Field description */
-  private int idLength;
-
-  /** Field description */
   private org.eclipse.jgit.lib.Repository repository;
 
   /** Field description */

scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/GitChangesetViewer.java

 
         if (commit != null)
         {
-          converter = new GitChangesetConverter(gr, revWalk, GitUtil.ID_LENGTH);
+          converter = new GitChangesetConverter(gr, revWalk);
           changeset = converter.createChangeset(commit);
         }
         else if (logger.isWarnEnabled())
 
       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);
 
       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);

scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/GitRepositoryHookEvent.java

       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);

scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/GitUtil.java

 {
 
   /** Field description */
-  public static final int ID_LENGTH = 20;
-
-  /** Field description */
   public static final String REF_HEAD = "HEAD";
 
   /** Field description */

scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java

 
 import java.io.IOException;
 
-import java.util.Collection;
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 
         if (commit != null)
         {
-          converter = new GitChangesetConverter(gr, revWalk, GitUtil.ID_LENGTH);
+          converter = new GitChangesetConverter(gr, revWalk);
           changeset = converter.createChangeset(commit);
         }
         else if (logger.isWarnEnabled())
 
         RevWalk revWalk = new RevWalk(gr);
 
-        converter = new GitChangesetConverter(gr, revWalk, GitUtil.ID_LENGTH);
+        converter = new GitChangesetConverter(gr, revWalk);
 
         if (!Strings.isNullOrEmpty(request.getPath()))
         {

scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/client/spi/GitCommitCommand.java

  */
 
 
+
 package sonia.scm.repository.client.spi;
 
 //~--- non-JDK imports --------------------------------------------------------
 
 import sonia.scm.repository.Changeset;
 import sonia.scm.repository.GitChangesetConverter;
-import sonia.scm.repository.GitUtil;
 import sonia.scm.repository.client.api.RepositoryClientException;
 
 //~--- JDK imports ------------------------------------------------------------
                            request.getAuthor().getMail()).setMessage(
                              request.getMessage()).call();
 
-      converter = new GitChangesetConverter(git.getRepository(),
-        GitUtil.ID_LENGTH);
+      converter = new GitChangesetConverter(git.getRepository());
 
       changeset = converter.createChangeset(commit);
     }

scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/GitLogCommandTest.java

     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());
   }
 
   /**
     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());
   }
 
   /**
     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());
   }
 
   /**
     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());
     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());
   }
 
   /**
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.