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