-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SCM-530] Add support for git submodules to git SCM provider
- Loading branch information
Showing
36 changed files
with
163 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
...he/maven/scm/provider/git/gitexe/command/checkout/GitExeCheckOutCommandRecursiveTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.maven.scm.provider.git.gitexe.command.checkout; | ||
|
||
import java.io.File; | ||
import java.util.Collections; | ||
|
||
import org.apache.maven.scm.ScmFileSet; | ||
import org.apache.maven.scm.ScmTestCase; | ||
import org.apache.maven.scm.ScmVersion; | ||
import org.apache.maven.scm.command.checkout.CheckOutScmResult; | ||
import org.apache.maven.scm.provider.git.gitexe.command.GitCommandLineUtils; | ||
import org.apache.maven.scm.provider.git.repository.GitScmProviderRepository; | ||
import org.apache.maven.scm.repository.ScmRepository; | ||
import org.codehaus.plexus.util.FileUtils; | ||
import org.codehaus.plexus.util.cli.CommandLineUtils; | ||
import org.codehaus.plexus.util.cli.Commandline; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
import static org.apache.maven.scm.provider.git.GitScmTestUtils.GIT_COMMAND_LINE; | ||
import static org.junit.Assert.assertEquals; | ||
|
||
/** | ||
* @author Wen Wu | ||
* | ||
*/ | ||
public class GitExeCheckOutCommandRecursiveTest extends ScmTestCase { | ||
private File workingDirectory; | ||
|
||
private File repo; | ||
|
||
private ScmRepository scmRepository; | ||
|
||
@Before | ||
@Override | ||
public void setUp() throws Exception { | ||
super.setUp(); | ||
|
||
workingDirectory = new File("target/checkout-recursive"); | ||
FileUtils.deleteDirectory(workingDirectory); | ||
repo = new File("src/test/resources/repository_submodule"); | ||
|
||
scmRepository = getScmManager() | ||
.makeScmRepository( | ||
"scm:git:" + repo.toPath().toAbsolutePath().toUri().toASCIIString()); | ||
} | ||
|
||
@Test | ||
public void testCheckoutNoBranch() throws Exception { | ||
checkScmPresence(GIT_COMMAND_LINE); | ||
CheckOutScmResult result = checkoutRepo(false); | ||
|
||
assertEquals(5, result.getCheckedOutFiles().size()); | ||
|
||
// git submodule set-url sub-prj file:///... | ||
Commandline cl = GitCommandLineUtils.getBaseGitCommandLine( | ||
workingDirectory, | ||
"submodule", | ||
(GitScmProviderRepository) scmRepository.getProviderRepository(), | ||
Collections.emptyMap()); | ||
|
||
String repoUrl = repo.toPath().toAbsolutePath().toUri().toASCIIString(); | ||
cl.createArg().setValue("set-url"); | ||
cl.createArg().setValue("sub-prj"); | ||
cl.createArg().setValue(repoUrl); | ||
|
||
CommandLineUtils.StringStreamConsumer stdout = new CommandLineUtils.StringStreamConsumer(); | ||
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer(); | ||
GitCommandLineUtils.execute(cl, stdout, stderr); | ||
|
||
result = checkoutRepo(true); | ||
assertEquals(9, result.getCheckedOutFiles().size()); | ||
} | ||
|
||
protected CheckOutScmResult checkoutRepo(boolean recursive) throws Exception { | ||
CheckOutScmResult result = | ||
getScmManager().checkOut(scmRepository, new ScmFileSet(workingDirectory), (ScmVersion) null, recursive); | ||
|
||
assertResultIsSuccess(result); | ||
return result; | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...-scm-providers-git/maven-scm-provider-gitexe/src/test/resources/repository_submodule/HEAD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ref: refs/heads/master |
5 changes: 5 additions & 0 deletions
5
...cm-providers-git/maven-scm-provider-gitexe/src/test/resources/repository_submodule/config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[core] | ||
repositoryformatversion = 0 | ||
filemode = true | ||
bare = true | ||
ignorecase = true |
1 change: 1 addition & 0 deletions
1
...oviders-git/maven-scm-provider-gitexe/src/test/resources/repository_submodule/description
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Unnamed repository; edit this file to name it for gitweb. |
Empty file.
6 changes: 6 additions & 0 deletions
6
...viders-git/maven-scm-provider-gitexe/src/test/resources/repository_submodule/info/exclude
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# git-ls-files --others --exclude-from=.git/info/exclude | ||
# Lines that start with '#' are comments. | ||
# For a project mostly in C, the following would be a good set of | ||
# exclude patterns (uncomment them if you want to use them): | ||
# *.[oa] | ||
# *~ |
4 changes: 4 additions & 0 deletions
4
...providers-git/maven-scm-provider-gitexe/src/test/resources/repository_submodule/logs/HEAD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
0000000000000000000000000000000000000000 c51dcd33e7b71897603c203b5e0afc1d75f70051 Mark Struberg <[email protected]> 1196106917 +0100 | ||
c51dcd33e7b71897603c203b5e0afc1d75f70051 baa229a9193371fad604444f64c4f26f8ff702f3 Mark Struberg <[email protected]> 1197041894 +0100 push | ||
baa229a9193371fad604444f64c4f26f8ff702f3 1d308c3b92eb0df9c0dc76436d50edfd0ca41d18 Mark Struberg <[email protected]> 1197042012 +0100 push | ||
92f139dfec4d1dfb79c3cd2f94e83bf13129668b 021d26a81797f675c66ee7f875dcb4255caa6a84 wuwen <[email protected]> 1688375554 +0800 push |
4 changes: 4 additions & 0 deletions
4
.../maven-scm-provider-gitexe/src/test/resources/repository_submodule/logs/refs/heads/master
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
0000000000000000000000000000000000000000 c51dcd33e7b71897603c203b5e0afc1d75f70051 Mark Struberg <[email protected]> 1196106917 +0100 | ||
c51dcd33e7b71897603c203b5e0afc1d75f70051 baa229a9193371fad604444f64c4f26f8ff702f3 Mark Struberg <[email protected]> 1197041894 +0100 push | ||
baa229a9193371fad604444f64c4f26f8ff702f3 1d308c3b92eb0df9c0dc76436d50edfd0ca41d18 Mark Struberg <[email protected]> 1197042012 +0100 push | ||
92f139dfec4d1dfb79c3cd2f94e83bf13129668b 021d26a81797f675c66ee7f875dcb4255caa6a84 wuwen <[email protected]> 1688375554 +0800 push |
1 change: 1 addition & 0 deletions
1
...m-provider-gitexe/src/test/resources/repository_submodule/logs/refs/remotes/origin/master
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0000000000000000000000000000000000000000 c51dcd33e7b71897603c203b5e0afc1d75f70051 Mark Struberg <[email protected]> 1196106917 +0100 clone: from /home/msx/tmp/maven-git/repository/.git |
2 changes: 2 additions & 0 deletions
2
...src/test/resources/repository_submodule/objects/02/1d26a81797f675c66ee7f875dcb4255caa6a84
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...src/test/resources/repository_submodule/objects/07/b300aafa39acce00868af0141f75b73cf14664
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
xm���0DYۯ��Gba�3�C�ZmPZG�Ӗ�'�]�ӝO���z9=������tm�W�l��t47�5mS8�wAXˊ3P�Y�p@pمar�V�tP��%�����Q��]ㆠ�T��VQ3IT�w�_RE� |
Binary file added
BIN
+37 Bytes
...src/test/resources/repository_submodule/objects/17/e953589369a48dcb0a0cbad084a76ef852cd11
Binary file not shown.
Binary file added
BIN
+199 Bytes
...src/test/resources/repository_submodule/objects/1d/308c3b92eb0df9c0dc76436d50edfd0ca41d18
Binary file not shown.
Binary file added
BIN
+75 Bytes
...src/test/resources/repository_submodule/objects/3b/459fa9451a94fc1acd10e2e29ab73d93eb816d
Binary file not shown.
Binary file added
BIN
+116 Bytes
...src/test/resources/repository_submodule/objects/3b/d305c57c635aead10cf59f7c1dc51af03edaf7
Binary file not shown.
Binary file added
BIN
+46 Bytes
...src/test/resources/repository_submodule/objects/3c/f7bb86c15554148bf5b0b12bfd639e54a77e58
Binary file not shown.
Binary file added
BIN
+23 Bytes
...src/test/resources/repository_submodule/objects/61/4a3fd04313593d67f4154855a06941046326b3
Binary file not shown.
Binary file added
BIN
+45 Bytes
...src/test/resources/repository_submodule/objects/61/a0d22b023d6e31894d736cca8c1a47b6edd822
Binary file not shown.
Binary file added
BIN
+183 Bytes
...src/test/resources/repository_submodule/objects/6c/19dac26d45acdca2aa830e8dc5835da37ae5d6
Binary file not shown.
Binary file added
BIN
+54 Bytes
...src/test/resources/repository_submodule/objects/92/09a983605d6e43e5cf841a1ea18a1914bb7407
Binary file not shown.
1 change: 1 addition & 0 deletions
1
...src/test/resources/repository_submodule/objects/92/f139dfec4d1dfb79c3cd2f94e83bf13129668b
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
x��1�0@Q��;��� !.�� \ǡ�A��=�ly�R��@k����1H�������p�Q(I ��5q��W�j��;\����_�:�y�u����H=}[$D'ߥ�_ؕ�X���Y����<m |
Binary file added
BIN
+28 Bytes
...src/test/resources/repository_submodule/objects/94/d3d586e355f318d67e3da6bb16a91be7aad1a7
Binary file not shown.
Binary file added
BIN
+43 Bytes
...src/test/resources/repository_submodule/objects/9e/131cfc732b0d9f42b9b712a528d0632d9bcca7
Binary file not shown.
Binary file added
BIN
+36 Bytes
...src/test/resources/repository_submodule/objects/b5/3306f849b69ef0459ddf5cccff06b5fbb08c23
Binary file not shown.
1 change: 1 addition & 0 deletions
1
...src/test/resources/repository_submodule/objects/ba/a229a9193371fad604444f64c4f26f8ff702f3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
x��MN1@a�9����O���XqDZ��ʤ nB����<�~��|��9T�I�K��������ENV��� F��w��IԤ���f*K>b��&E6���e�D������x��9�U����:}����/@�d�TJ���_��͎[��~�}����Ƕ���}���jP� |
Binary file added
BIN
+60 Bytes
...src/test/resources/repository_submodule/objects/ba/cd4ee105073117b30e5dcdba5150373b6b53c6
Binary file not shown.
Binary file added
BIN
+46 Bytes
...src/test/resources/repository_submodule/objects/c3/8b0351660113545db270ba6918cc22a9eb17ce
Binary file not shown.
Binary file added
BIN
+147 Bytes
...src/test/resources/repository_submodule/objects/c5/1dcd33e7b71897603c203b5e0afc1d75f70051
Binary file not shown.
Binary file added
BIN
+116 Bytes
...src/test/resources/repository_submodule/objects/dc/4204852765c12f398ef4a5fbcabf23cf17a183
Binary file not shown.
Binary file added
BIN
+46 Bytes
...src/test/resources/repository_submodule/objects/f7/1429f9ff9214a546b438c611ae942c9cf5a49e
Binary file not shown.
Binary file added
BIN
+24 Bytes
...src/test/resources/repository_submodule/objects/fd/39fa3de0f63bc5c78eca219e74e0a8531bd3e6
Binary file not shown.
Binary file added
BIN
+27 Bytes
...src/test/resources/repository_submodule/objects/fe/a16119a5b4ec0562d4f65b4237314250773bf8
Binary file not shown.
1 change: 1 addition & 0 deletions
1
...s-git/maven-scm-provider-gitexe/src/test/resources/repository_submodule/refs/heads/master
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
021d26a81797f675c66ee7f875dcb4255caa6a84 |
1 change: 1 addition & 0 deletions
1
...aven-scm-provider-gitexe/src/test/resources/repository_submodule/refs/remotes/origin/HEAD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ref: refs/remotes/origin/master |
1 change: 1 addition & 0 deletions
1
...en-scm-provider-gitexe/src/test/resources/repository_submodule/refs/remotes/origin/master
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
c51dcd33e7b71897603c203b5e0afc1d75f70051 |