WorkingTreeIterator should pass FS to submodules

Change-Id: I4b7bc6bab449b9e3aebba8170788ff9e4a04195a
Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>
This commit is contained in:
Marc Strapetz 2017-12-13 22:46:47 +01:00 committed by Matthias Sohn
parent de49edbffb
commit 8779092716
2 changed files with 22 additions and 3 deletions

View File

@ -223,7 +223,8 @@ public static File getSubmoduleDirectory(final Repository parent,
*/
public static Repository getSubmoduleRepository(final Repository parent,
final String path) throws IOException {
return getSubmoduleRepository(parent.getWorkTree(), path);
return getSubmoduleRepository(parent.getWorkTree(), path,
parent.getFS());
}
/**
@ -238,6 +239,23 @@ public static Repository getSubmoduleRepository(final Repository parent,
*/
public static Repository getSubmoduleRepository(final File parent,
final String path) throws IOException {
return getSubmoduleRepository(parent, path, FS.DETECTED);
}
/**
* Get submodule repository at path, using the specified file system
* abstraction
*
* @param parent
* @param path
* @param fs
* the file system abstraction to be used
* @return repository or null if repository doesn't exist
* @throws IOException
* @since 4.10
*/
public static Repository getSubmoduleRepository(final File parent,
final String path, FS fs) throws IOException {
File subWorkTree = new File(parent, path);
if (!subWorkTree.isDirectory())
return null;
@ -245,7 +263,7 @@ public static Repository getSubmoduleRepository(final File parent,
try {
return new RepositoryBuilder() //
.setMustExist(true) //
.setFS(FS.DETECTED) //
.setFS(fs) //
.setWorkTree(workTree) //
.build();
} catch (RepositoryNotFoundException e) {

View File

@ -341,7 +341,8 @@ protected byte[] idSubmodule(File directory, Entry e) {
final Repository submoduleRepo;
try {
submoduleRepo = SubmoduleWalk.getSubmoduleRepository(directory,
e.getName());
e.getName(),
repository != null ? repository.getFS() : FS.DETECTED);
} catch (IOException exception) {
return zeroid;
}