You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2022/05/19 17:18:17 UTC

[maven-scm] branch master updated: [SCM-976] GitExe changelog does not work in if the user has defined a custom format

This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-scm.git


The following commit(s) were added to refs/heads/master by this push:
     new 178b111b [SCM-976] GitExe changelog does not work in if the user has defined a custom format
178b111b is described below

commit 178b111bb9976caafd97bce174260f12f0faa8d6
Author: Niels Basjes <ni...@basjes.nl>
AuthorDate: Thu Feb 10 14:28:15 2022 +0100

    [SCM-976] GitExe changelog does not work in if the user has defined a custom format
    
    This closes #134
---
 .../command/changelog/GitChangeLogCommand.java     |  1 +
 .../command/changelog/GitChangeLogCommandTest.java | 24 +++++++++++-----------
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogCommand.java b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogCommand.java
index 6f87a431..2d76f449 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogCommand.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogCommand.java
@@ -208,6 +208,7 @@ public class GitChangeLogCommand
         dateFormat.setTimeZone( TimeZone.getTimeZone( "GMT" ) );
 
         Commandline cl = GitCommandLineUtils.getBaseGitCommandLine( workingDirectory, "whatchanged" );
+        cl.createArg().setValue( "--format=medium" );
 
         if ( startDate != null || endDate != null )
         {
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogCommandTest.java b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogCommandTest.java
index 105fc06d..820e000f 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogCommandTest.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogCommandTest.java
@@ -51,14 +51,14 @@ public class GitChangeLogCommandTest
         throws Exception
     {
         testCommandLine( "scm:git:http://foo.com/git", null, (Date) null, (Date) null, 40,
-                         "git whatchanged --date=iso --max-count=40 -- ." );
+                         "git whatchanged --format=medium --date=iso --max-count=40 -- ." );
     }
 
     public void testCommandLineNoDatesLimitedCount()
         throws Exception
     {
         testCommandLine( "scm:git:http://foo.com/git", null, (Date) null, (Date) null,
-                         "git whatchanged --date=iso -- ." );
+                         "git whatchanged --format=medium --date=iso -- ." );
     }
 
     public void testCommandLineWithDates()
@@ -68,7 +68,7 @@ public class GitChangeLogCommandTest
         Date endDate = getDate( 2007, Calendar.OCTOBER, 10, GMT_TIME_ZONE );
 
         testCommandLine( "scm:git:http://foo.com/git", null, startDate, endDate,
-                         "git whatchanged \"--since=2003-09-10 00:00:00 +0000\" \"--until=2007-10-10 00:00:00 +0000\" --date=iso -- ." );
+                         "git whatchanged --format=medium \"--since=2003-09-10 00:00:00 +0000\" \"--until=2007-10-10 00:00:00 +0000\" --date=iso -- ." );
     }
 
     public void testCommandLineStartDateOnly()
@@ -77,7 +77,7 @@ public class GitChangeLogCommandTest
         Date startDate = getDate( 2003, Calendar.SEPTEMBER, 10, 1, 1, 1, GMT_TIME_ZONE );
 
         testCommandLine( "scm:git:http://foo.com/git", null, startDate, null,
-                         "git whatchanged \"--since=2003-09-10 01:01:01 +0000\" --date=iso -- ." );
+                         "git whatchanged --format=medium \"--since=2003-09-10 01:01:01 +0000\" --date=iso -- ." );
     }
 
     public void testCommandLineDateFormat()
@@ -87,7 +87,7 @@ public class GitChangeLogCommandTest
         Date endDate = getDate( 2005, Calendar.NOVEMBER, 13, 23, 23, 23, GMT_TIME_ZONE );
 
         testCommandLine( "scm:git:http://foo.com/git", null, startDate, endDate,
-                         "git whatchanged \"--since=2003-09-10 01:01:01 +0000\" \"--until=2005-11-13 23:23:23 +0000\" --date=iso -- ." );
+                         "git whatchanged --format=medium \"--since=2003-09-10 01:01:01 +0000\" \"--until=2005-11-13 23:23:23 +0000\" --date=iso -- ." );
     }
 
     public void testCommandLineDateVersionRanges()
@@ -97,7 +97,7 @@ public class GitChangeLogCommandTest
         Date endDate = getDate( 2005, Calendar.NOVEMBER, 13, 23, 23, 23, GMT_TIME_ZONE );
     
         testCommandLine( "scm:git:http://foo.com/git", null, startDate, endDate, new ScmRevision( "1" ), new ScmRevision( "10" ),
-                         "git whatchanged \"--since=2003-09-10 01:01:01 +0000\" \"--until=2005-11-13 23:23:23 +0000\" --date=iso 1..10 -- ." );
+                         "git whatchanged --format=medium \"--since=2003-09-10 01:01:01 +0000\" \"--until=2005-11-13 23:23:23 +0000\" --date=iso 1..10 -- ." );
     }
     
     public void testCommandLineEndDateOnly()
@@ -107,14 +107,14 @@ public class GitChangeLogCommandTest
 
         // Only specifying end date should print no dates at all
         testCommandLine( "scm:git:http://foo.com/git", null, null, endDate,
-                         "git whatchanged \"--until=2003-11-10 00:00:00 +0000\" --date=iso -- ." );
+                         "git whatchanged --format=medium \"--until=2003-11-10 00:00:00 +0000\" --date=iso -- ." );
     }
 
     public void testCommandLineWithBranchNoDates()
         throws Exception
     {
         testCommandLine( "scm:git:http://foo.com/git", new ScmBranch( "my-test-branch" ), (Date) null, (Date) null, 
-                         "git whatchanged --date=iso my-test-branch -- ." );
+                         "git whatchanged --format=medium --date=iso my-test-branch -- ." );
     }
 
 
@@ -122,28 +122,28 @@ public class GitChangeLogCommandTest
         throws Exception
     {
         testCommandLine( "scm:git:http://foo.com/git", null, new ScmRevision( "1" ), null, 
-                         "git whatchanged --date=iso 1.. -- ." );
+                         "git whatchanged --format=medium --date=iso 1.. -- ." );
     }
 
     public void testCommandLineWithStartVersionAndEndVersion()
         throws Exception
     {
         testCommandLine( "scm:git:http://foo.com/git", null, new ScmRevision( "1" ), new ScmRevision( "10" ), 
-                         "git whatchanged --date=iso 1..10 -- ." );
+                         "git whatchanged --format=medium --date=iso 1..10 -- ." );
     }
 
     public void testCommandLineWithStartVersionAndEndVersionEquals()
         throws Exception
     {
         testCommandLine( "scm:git:http://foo.com/git", null, new ScmRevision( "1" ), new ScmRevision( "1" ), 
-                         "git whatchanged --date=iso 1..1 -- ." );
+                         "git whatchanged --format=medium --date=iso 1..1 -- ." );
     }
 
     public void testCommandLineWithStartVersionAndEndVersionAndBranch()
         throws Exception
     {
         testCommandLine( "scm:git:http://foo.com/git", new ScmBranch( "my-test-branch" ), new ScmRevision( "1" ), new ScmRevision( "10" ), 
-                         "git whatchanged --date=iso 1..10 my-test-branch -- ." );
+                         "git whatchanged --format=medium --date=iso 1..10 my-test-branch -- ." );
     }
 
     // ----------------------------------------------------------------------