Merge pull request #13133 from thingsboard/fix/git-open-check

Fix repo open catch
This commit is contained in:
Viacheslav Klimov 2025-04-08 17:21:15 +03:00 committed by GitHub
commit 49498e9ba2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -42,7 +42,6 @@ import org.eclipse.jgit.diff.RawText;
import org.eclipse.jgit.diff.RawTextComparator; import org.eclipse.jgit.diff.RawTextComparator;
import org.eclipse.jgit.errors.LargeObjectException; import org.eclipse.jgit.errors.LargeObjectException;
import org.eclipse.jgit.errors.RepositoryNotFoundException; import org.eclipse.jgit.errors.RepositoryNotFoundException;
import org.eclipse.jgit.errors.TransportException;
import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ObjectLoader; import org.eclipse.jgit.lib.ObjectLoader;
@ -158,7 +157,7 @@ public class GitRepository {
return repository; return repository;
} catch (RepositoryNotFoundException e) { } catch (RepositoryNotFoundException e) {
log.warn("{} not a git repository, reinitializing", directory); log.warn("{} not a git repository, reinitializing", directory);
} catch (TransportException e) { } catch (org.eclipse.jgit.errors.TransportException | org.eclipse.jgit.api.errors.TransportException e) {
if (StringUtils.containsIgnoreCase(e.getMessage(), "missing commit")) { if (StringUtils.containsIgnoreCase(e.getMessage(), "missing commit")) {
log.warn("Couldn't fetch {} due to {}, reinitializing", directory, e.getMessage()); log.warn("Couldn't fetch {} due to {}, reinitializing", directory, e.getMessage());
} else { } else {