maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SCM-868) gitexe add() does not return added files when invoked in subdir
Date Wed, 16 May 2018 21:26:00 GMT

    [ https://issues.apache.org/jira/browse/SCM-868?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16478135#comment-16478135
] 

ASF GitHub Bot commented on SCM-868:
------------------------------------

michael-o commented on a change in pull request #66: [SCM-868] fix gitexe cannot deduce relative
path
URL: https://github.com/apache/maven-scm/pull/66#discussion_r188777779
 
 

 ##########
 File path: maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/status/GitStatusConsumerTest.java
 ##########
 @@ -215,19 +225,23 @@ public void testConsumerModifiedFileInComplexDirectorySetup() throws
IOException
 	public void testConsumerModifiedFileInComplexDirectoryWithSpaces() throws IOException {
 
 		File dir = createTempDirectory();
-		File subdir = new File( dir.getAbsolutePath() + "/sub Directory déjà vu special/" );
+        URI relativeCWD = URI.create( "" );
+		File subdir = new File( dir, "sub Directory déjà vu special" );
 		subdir.mkdir();
 		FileUtils.write( new File( subdir, "project.xml" ), "data" );
 
-		List<ScmFile> changedFiles = getChangedFiles( "M  \"sub Directory déjà vu special/project.xml\"",
subdir, dir.toURI() );
+        List<ScmFile> changedFiles =
+            getChangedFiles( "M  \"sub Directory déjà vu special/project.xml\"", dir, relativeCWD
);
 
 		assertNotNull( changedFiles );
 		assertEquals( 1, changedFiles.size() );
         assertEquals( "sub Directory déjà vu special/project.xml", changedFiles.get( 0
).getPath() );
 
         FileUtils.write( new File( subdir, "test file with spaces and a déjà vu character.xml"
), "data" );
 
-		changedFiles = getChangedFiles( "M  \"sub Directory déjà vu special/test file with spaces
and a déjà vu character.xml\"", subdir, dir.toURI() );
+        changedFiles =
 
 Review comment:
   check indentation

----------------------------------------------------------------
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:
users@infra.apache.org


> gitexe add() does not return added files when invoked in subdir
> ---------------------------------------------------------------
>
>                 Key: SCM-868
>                 URL: https://issues.apache.org/jira/browse/SCM-868
>             Project: Maven SCM
>          Issue Type: Bug
>          Components: maven-scm-provider-gitexe
>    Affects Versions: 1.9.5, 1.9.6
>            Reporter: Ilya Basin
>            Priority: Major
>
> I'm going to add a wagon-scm test suite for git. One of the test cases is calling the
GitAddCommand command with:
> {code:java}
> repo: file:///C:/progs/maven/maven-wagon/wagon-providers/wagon-scm/target/test-classes/test-repo-git-test/
> fileSet: basedir = C:\Users\basin\AppData\Local\Temp\wagon-scm2020146470.checkout\file-list;
files = [test-resource.txt]{code}
> After adding the files the command internally calls "git rev-parse --show-toplevel" which
prints:
> {code:java}
> C:/Users/basin/AppData/Local/Temp/wagon-scm2020146470.checkout{code}
> And on the next line it tries to do (pseudo code):
> {code:java}
> ("file:/C:/Users/basin/AppData/Local/Temp/wagon-scm1144102340.checkout/file-list/").relativize(URI.create(
> "C:/Users/basin/AppData/Local/Temp/wagon-scm2020146470.checkout")){code}
> This is so wrong! What were those people from SCM-709 trying to get? A double dot ".."?
The argument to the relativize() method MUST be a child, not a parent, otherwise the argument
is returned unchanged.
> There are so many reasons why getting an absolute path from git is a bad idea: Symlinks,
Windows paths.
> Nevertheless, there's a simple solution. The original problem was that "git status --porcelain"
printed paths relative to the top level instead of relative to the base dir.
> So we should just call 
> {code}
> git rev-parse --show-prefix
> {code} instead of "show-toplevel" and strip this prefix from the paths printed by "git
status"



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message