mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-26 17:53:14 +00:00
ログ追加
This commit is contained in:
parent
43b0dd4eed
commit
132991122f
|
@ -3,10 +3,18 @@ package one.nem.lacerta.source.jgit.impl;
|
|||
import org.eclipse.jgit.api.Git;
|
||||
import org.eclipse.jgit.lib.Repository;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import one.nem.lacerta.source.jgit.ActionRepo;
|
||||
import one.nem.lacerta.utils.LacertaLogger;
|
||||
|
||||
public class ActionRepoImpl implements ActionRepo{
|
||||
|
||||
@Inject // Inject logger
|
||||
LacertaLogger logger;
|
||||
|
||||
private final String TAG = "ActionRepoImpl";
|
||||
|
||||
Repository repository;
|
||||
|
||||
Git git;
|
||||
|
@ -14,6 +22,7 @@ public class ActionRepoImpl implements ActionRepo{
|
|||
// Internal method
|
||||
private Git getGit() {
|
||||
if (this.git == null) {
|
||||
logger.debug(TAG, "getGit: git is null. Creating new Git instance");
|
||||
this.git = new Git(repository);
|
||||
}
|
||||
return this.git;
|
||||
|
@ -27,6 +36,7 @@ public class ActionRepoImpl implements ActionRepo{
|
|||
@Override
|
||||
public Repository getRepository() {
|
||||
if (repository == null) {
|
||||
logger.warn(TAG, "getRepository: repository is null. Throwing RuntimeException");
|
||||
throw new RuntimeException("リポジトリが設定されていません");
|
||||
}
|
||||
return repository;
|
||||
|
@ -43,6 +53,7 @@ public class ActionRepoImpl implements ActionRepo{
|
|||
try {
|
||||
return git.status().call().getUntracked().toArray(new String[0]);
|
||||
} catch (Exception e) { // TODO-rca: エラーハンドリング
|
||||
logger.error(TAG, "getUnstagedFiles: " + e.getMessage());
|
||||
return new String[0];
|
||||
}
|
||||
}
|
||||
|
@ -53,6 +64,7 @@ public class ActionRepoImpl implements ActionRepo{
|
|||
try {
|
||||
return git.status().call().getAdded().toArray(new String[0]);
|
||||
} catch (Exception e) { // TODO-rca: エラーハンドリング
|
||||
logger.error(TAG, "getStagedFiles: " + e.getMessage());
|
||||
return new String[0];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user