[jira] [Commented] (SCM-882) ScmWagon has no way to work with GIT in binary mode
[ https://issues.apache.org/jira/browse/SCM-882?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16452090#comment-16452090 ] Ilya Basin commented on SCM-882: This line fails: // [https://github.com/apache/maven-wagon/blob/be94400731575f54ff537ec90359460f42a561cc/wagon-provider-test/src/main/java/org/apache/maven/wagon/WagonTestCase.java#L1060] assertEquals( "compare checksums", "6b144b7285ffd6b0bc8300da162120b9", checksumObserver.getActualChecksum() ); Of course, to make it fail I had to edit %APPDATA%\Subversion\config : {code:java} [auto-props] test-resource = svn:eol-style=CRLF{code} You might find it impossible in real life, but a the following line is more likely to appear in a real config: "*.txt = svn:eol-style=native". > ScmWagon has no way to work with GIT in binary mode > --- > > Key: SCM-882 > URL: https://issues.apache.org/jira/browse/SCM-882 > Project: Maven SCM > Issue Type: Bug > Components: maven-scm-provider-cvs >Affects Versions: 1.9.5 >Reporter: Ilya Basin >Assignee: Olivier Lamy (*$^¨%`£) >Priority: Major > Fix For: 1.9.6 > > > Msysgit will checkout wagon-scm test-resource with CRLF by default, breaking > the test. Need to clone with core.autocrlf=false -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCM-882) ScmWagon has no way to work with GIT in binary mode
[ https://issues.apache.org/jira/browse/SCM-882?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16447185#comment-16447185 ] Michael Osipov commented on SCM-882: So this is about test portability? How does a failure on your machine look like? > ScmWagon has no way to work with GIT in binary mode > --- > > Key: SCM-882 > URL: https://issues.apache.org/jira/browse/SCM-882 > Project: Maven SCM > Issue Type: Bug > Components: maven-scm-provider-cvs >Affects Versions: 1.9.5 >Reporter: Ilya Basin >Assignee: Olivier Lamy (*$^¨%`£) >Priority: Major > Fix For: 1.9.6 > > > Msysgit will checkout wagon-scm test-resource with CRLF by default, breaking > the test. Need to clone with core.autocrlf=false -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCM-882) ScmWagon has no way to work with GIT in binary mode
[ https://issues.apache.org/jira/browse/SCM-882?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16446765#comment-16446765 ] Ilya Basin commented on SCM-882: Your .gitattributes file has nothing to do with the wagon test, because the test neither clones, nor commits to the "maven-wagon" git repository. It clones the test git repository which is similar to your {{test-repo-svn}} and is added by one of my other pull requests, see WAGON-501 . Now, about the test resource. It is actually just one text file named "test-resource". Here's a highlight of how it gets into the test repo: // https://github.com/apache/maven-wagon/blob/be94400731575f54ff537ec90359460f42a561cc/wagon-provider-test/src/main/java/org/apache/maven/wagon/WagonTestCase.java#L150 resource = "test-resource"; // https://github.com/apache/maven-wagon/blob/be94400731575f54ff537ec90359460f42a561cc/wagon-provider-test/src/main/java/org/apache/maven/wagon/WagonTestCase.java#L927 putFile( resource, "test-resource", content ); // https://github.com/apache/maven-wagon/blob/be94400731575f54ff537ec90359460f42a561cc/wagon-provider-test/src/main/java/org/apache/maven/wagon/WagonTestCase.java#L879 wagon.put( sourceFile, resourceName ); > ScmWagon has no way to work with GIT in binary mode > --- > > Key: SCM-882 > URL: https://issues.apache.org/jira/browse/SCM-882 > Project: Maven SCM > Issue Type: Bug > Components: maven-scm-provider-cvs >Affects Versions: 1.9.5 >Reporter: Ilya Basin >Assignee: Olivier Lamy (*$^¨%`£) >Priority: Major > Fix For: 1.9.6 > > > Msysgit will checkout wagon-scm test-resource with CRLF by default, breaking > the test. Need to clone with core.autocrlf=false -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCM-882) ScmWagon has no way to work with GIT in binary mode
[ https://issues.apache.org/jira/browse/SCM-882?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16446752#comment-16446752 ] Michael Osipov commented on SCM-882: Which resources in detail? I have added {{wagon-providers/wagon-scm/src/test/resources/test-repo-svn/db/.gitattributes}} more than two years ago. I'd like to understand the root cause. > ScmWagon has no way to work with GIT in binary mode > --- > > Key: SCM-882 > URL: https://issues.apache.org/jira/browse/SCM-882 > Project: Maven SCM > Issue Type: Bug > Components: maven-scm-provider-cvs >Affects Versions: 1.9.5 >Reporter: Ilya Basin >Assignee: Olivier Lamy (*$^¨%`£) >Priority: Major > Fix For: 1.9.6 > > > Msysgit will checkout wagon-scm test-resource with CRLF by default, breaking > the test. Need to clone with core.autocrlf=false -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCM-882) ScmWagon has no way to work with GIT in binary mode
[ https://issues.apache.org/jira/browse/SCM-882?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16439404#comment-16439404 ] Ilya Basin commented on SCM-882: [~michael-o] the test files are created on-the-fly by the test cases and committed during the preparation phase. Then the actual test starts. See WagonTestCase.testWagon() > ScmWagon has no way to work with GIT in binary mode > --- > > Key: SCM-882 > URL: https://issues.apache.org/jira/browse/SCM-882 > Project: Maven SCM > Issue Type: Bug > Components: maven-scm-provider-cvs >Affects Versions: 1.9.5 >Reporter: Ilya Basin >Assignee: Olivier Lamy (*$^¨%`£) >Priority: Major > Fix For: 1.9.6 > > > Msysgit will checkout wagon-scm test-resource with CRLF by default, breaking > the test. Need to clone with core.autocrlf=false -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCM-882) ScmWagon has no way to work with GIT in binary mode
[ https://issues.apache.org/jira/browse/SCM-882?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16439393#comment-16439393 ] Michael Osipov commented on SCM-882: What test resources are you referring to? wagon-scm-test does not contain any test resources. If you talk about the mangled Subversion repo on Windows, I have set {{.gitattributes}} on those files last year. The change you proposed does not correlate with the issue you have. > ScmWagon has no way to work with GIT in binary mode > --- > > Key: SCM-882 > URL: https://issues.apache.org/jira/browse/SCM-882 > Project: Maven SCM > Issue Type: Bug > Components: maven-scm-provider-cvs >Affects Versions: 1.9.5 >Reporter: Ilya Basin >Assignee: Olivier Lamy (*$^¨%`£) >Priority: Major > Fix For: 1.9.6 > > > Msysgit will checkout wagon-scm test-resource with CRLF by default, breaking > the test. Need to clone with core.autocrlf=false -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCM-882) ScmWagon has no way to work with GIT in binary mode
[ https://issues.apache.org/jira/browse/SCM-882?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16436740#comment-16436740 ] ASF GitHub Bot commented on SCM-882: olamy closed pull request #69: [SCM-882] git checkout in binary mode when requested URL: https://github.com/apache/maven-scm/pull/69 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): 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/checkout/GitCheckOutCommand.java b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/checkout/GitCheckOutCommand.java index 296e51b27..d2e8613c7 100644 --- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/checkout/GitCheckOutCommand.java +++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/checkout/GitCheckOutCommand.java @@ -19,10 +19,15 @@ * under the License. */ +import java.io.File; + +import org.apache.maven.scm.CommandParameter; +import org.apache.maven.scm.CommandParameters; import org.apache.maven.scm.ScmBranch; import org.apache.maven.scm.ScmException; import org.apache.maven.scm.ScmFileSet; import org.apache.maven.scm.ScmFileStatus; +import org.apache.maven.scm.ScmResult; import org.apache.maven.scm.ScmTag; import org.apache.maven.scm.ScmVersion; import org.apache.maven.scm.command.checkout.AbstractCheckOutCommand; @@ -39,8 +44,6 @@ import org.codehaus.plexus.util.cli.CommandLineUtils; import org.codehaus.plexus.util.cli.Commandline; -import java.io.File; - /** * @author mailto:strub...@yahoo.de;>Mark Struberg * @@ -57,10 +60,15 @@ * TODO We currently assume a '.git' directory, so this does not work for --bare repos * {@inheritDoc} */ -protected CheckOutScmResult executeCheckOutCommand( ScmProviderRepository repo, ScmFileSet fileSet, - ScmVersion version, boolean recursive, boolean shallow ) +@Override +public ScmResult executeCommand( ScmProviderRepository repo, ScmFileSet fileSet, + CommandParameters parameters ) throws ScmException { +ScmVersion version = parameters.getScmVersion( CommandParameter.SCM_VERSION, null ); +boolean binary = parameters.getBoolean( CommandParameter.BINARY, false ); +boolean shallow = parameters.getBoolean( CommandParameter.SHALLOW, false ); + GitScmProviderRepository repository = (GitScmProviderRepository) repo; if ( GitScmProviderRepository.PROTOCOL_FILE.equals( repository.getFetchInfo().getProtocol() ) @@ -85,7 +93,7 @@ protected CheckOutScmResult executeCheckOutCommand( ScmProviderRepository repo, } // no git repo seems to exist, let's clone the original repo -Commandline clClone = createCloneCommand( repository, fileSet.getBasedir(), version, shallow ); +Commandline clClone = createCloneCommand( repository, fileSet.getBasedir(), version, binary, shallow ); exitCode = GitCommandLineUtils.execute( clClone, stdout, stderr, getLogger() ); if ( exitCode != 0 ) @@ -163,10 +171,12 @@ public static Commandline createCommandLine( GitScmProviderRepository repository * create a git-clone repository command */ private Commandline createCloneCommand( GitScmProviderRepository repository, File workingDirectory, -ScmVersion version, boolean shallow ) +ScmVersion version, boolean binary, boolean shallow ) { Commandline cl = GitCommandLineUtils.getBaseGitCommandLine( workingDirectory.getParentFile(), "clone" ); +forceBinary( cl, binary ); + if ( shallow ) { cl.createArg().setValue( "--depth" ); @@ -189,6 +199,15 @@ private Commandline createCloneCommand( GitScmProviderRepository repository, Fil return cl; } +private void forceBinary( Commandline cl, boolean binary ) +{ +if ( binary ) +{ +cl.createArg().setValue( "-c" ); +cl.createArg().setValue( "core.autocrlf=false" ); +} +} + /** * create a git-pull repository command */ @@ -228,4 +247,17 @@ private Commandline createPullCommand( GitScmProviderRepository repository, File } return cl; } + +/** + * The overriden {@link
[jira] [Commented] (SCM-882) ScmWagon has no way to work with GIT in binary mode
[ https://issues.apache.org/jira/browse/SCM-882?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16433653#comment-16433653 ] ASF GitHub Bot commented on SCM-882: basinilya opened a new pull request #69: [SCM-882] git checkout in binary mode when requested URL: https://github.com/apache/maven-scm/pull/69 This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > ScmWagon has no way to work with GIT in binary mode > --- > > Key: SCM-882 > URL: https://issues.apache.org/jira/browse/SCM-882 > Project: Maven SCM > Issue Type: Bug > Components: maven-scm-provider-cvs >Affects Versions: 1.9.5 >Reporter: Ilya Basin >Assignee: Olivier Lamy (*$^¨%`£) >Priority: Major > Fix For: 1.9.6 > > > Msysgit will checkout wagon-scm test-resource with CRLF by default, breaking > the test. Need to clone with core.autocrlf=false -- This message was sent by Atlassian JIRA (v7.6.3#76005)