mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01:00
[git-bridge] fix symlink handling (#35133)
GitOrigin-RevId: 282823db63f64bfae950b00e77a6cdc2a048b0ce
This commit is contained in:
committed by
Copybot
parent
de429e18d8
commit
aa97f5794c
@@ -14,9 +14,11 @@ import org.apache.commons.io.IOUtils;
|
||||
import org.eclipse.jgit.api.Git;
|
||||
import org.eclipse.jgit.api.ResetCommand;
|
||||
import org.eclipse.jgit.api.errors.GitAPIException;
|
||||
import org.eclipse.jgit.lib.ConfigConstants;
|
||||
import org.eclipse.jgit.lib.Constants;
|
||||
import org.eclipse.jgit.lib.PersonIdent;
|
||||
import org.eclipse.jgit.lib.Repository;
|
||||
import org.eclipse.jgit.lib.StoredConfig;
|
||||
import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
|
||||
import uk.ac.ic.wlgitbridge.data.filestore.GitDirectoryContents;
|
||||
import uk.ac.ic.wlgitbridge.data.filestore.RawDirectory;
|
||||
@@ -84,6 +86,10 @@ public class GitProjectRepo implements ProjectRepo {
|
||||
return;
|
||||
}
|
||||
repo.create();
|
||||
StoredConfig config = repo.getConfig();
|
||||
config.setBoolean(
|
||||
ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_SYMLINKS, false);
|
||||
config.save();
|
||||
// Set default branch to "main" for new projects
|
||||
repo.updateRef(Constants.HEAD).link("refs/heads/main");
|
||||
}
|
||||
|
||||
@@ -109,7 +109,8 @@ public class Util {
|
||||
if (files != null) {
|
||||
for (File file : files) {
|
||||
if (!excluded.contains(file.getName())) {
|
||||
if (file.isDirectory()) {
|
||||
if (java.nio.file.Files.isDirectory(
|
||||
file.toPath(), java.nio.file.LinkOption.NOFOLLOW_LINKS)) {
|
||||
deleteInDirectory(file);
|
||||
}
|
||||
file.delete();
|
||||
|
||||
Reference in New Issue
Block a user