mirror of
				https://github.com/scm-manager/scm-manager.git
				synced 2025-10-31 10:35:56 +01:00 
			
		
		
		
	Improve committer accuracy
Changes made by the SCM-Manager, like those through the editor and pull requests, now more accurately define the committer on the underlying changeset. Committed-by: Eduard Heimbuch <eduard.heimbuch@cloudogu.com> Co-authored-by: Eduard Heimbuch <eduard.heimbuch@cloudogu.com>
This commit is contained in:
		
				
					committed by
					
						 SCM-Manager
						SCM-Manager
					
				
			
			
				
	
			
			
			
						parent
						
							8eb2687e10
						
					
				
				
					commit
					7e83d34fc0
				
			| @@ -232,7 +232,7 @@ class AbstractGitCommand { | ||||
|         if (!status.isClean() || isInMerge()) { | ||||
|           return of(clone.commit() | ||||
|             .setAuthor(authorToUse.getName(), authorToUse.getMail()) | ||||
|             .setCommitter("SCM-Manager", "noreply@scm-manager.org") | ||||
|             .setCommitter(authorToUse.getName(), authorToUse.getMail()) | ||||
|             .setMessage(message) | ||||
|             .setSign(sign) | ||||
|             .setSigningKey(sign ? "SCM-MANAGER-DEFAULT-KEY" : null) | ||||
|   | ||||
| @@ -24,6 +24,9 @@ | ||||
|  | ||||
| package sonia.scm.repository.spi; | ||||
|  | ||||
| import com.github.sdorra.shiro.SubjectAware; | ||||
| import org.apache.shiro.subject.SimplePrincipalCollection; | ||||
| import org.apache.shiro.subject.Subject; | ||||
| import org.eclipse.jgit.api.Git; | ||||
| import org.eclipse.jgit.api.errors.GitAPIException; | ||||
| import org.eclipse.jgit.lib.ObjectId; | ||||
| @@ -39,6 +42,7 @@ import sonia.scm.ScmConstraintViolationException; | ||||
| import sonia.scm.repository.GitTestHelper; | ||||
| import sonia.scm.repository.Person; | ||||
| import sonia.scm.repository.RepositoryHookType; | ||||
| import sonia.scm.user.User; | ||||
|  | ||||
| import java.io.File; | ||||
| import java.io.IOException; | ||||
| @@ -55,6 +59,8 @@ import static org.mockito.Mockito.verify; | ||||
|  | ||||
| public class GitModifyCommandTest extends GitModifyCommandTestBase { | ||||
|  | ||||
|   private static final String REALM = "AdminRealm"; | ||||
|  | ||||
|   @Override | ||||
|   protected String getZippedRepositoryResource() { | ||||
|     return "sonia/scm/repository/spi/scm-git-spi-move-test.zip"; | ||||
| @@ -75,6 +81,8 @@ public class GitModifyCommandTest extends GitModifyCommandTestBase { | ||||
|       RevCommit lastCommit = getLastCommit(git); | ||||
|       assertThat(lastCommit.getFullMessage()).isEqualTo("Make some change"); | ||||
|       assertThat(lastCommit.getAuthorIdent().getName()).isEqualTo("Dirk Gently"); | ||||
|       assertThat(lastCommit.getCommitterIdent().getName()).isEqualTo("Dirk Gently"); | ||||
|       assertThat(lastCommit.getCommitterIdent().getEmailAddress()).isEqualTo("dirk@holistic.det"); | ||||
|       assertThat(newRef).isEqualTo(lastCommit.toObjectId().name()); | ||||
|     } | ||||
|   } | ||||
| @@ -528,4 +536,11 @@ public class GitModifyCommandTest extends GitModifyCommandTestBase { | ||||
|     return request; | ||||
|   } | ||||
|  | ||||
|   private ModifyCommandRequest prepareModifyCommandRequestWithoutAuthorEmail() { | ||||
|     ModifyCommandRequest request = new ModifyCommandRequest(); | ||||
|     request.setAuthor(new Person("Dirk Gently", "")); | ||||
|     request.setCommitMessage("Make some change"); | ||||
|     return request; | ||||
|   } | ||||
|  | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user