mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-26 17:53:14 +00:00
WIP
This commit is contained in:
parent
3bab78883b
commit
5fd3a88b38
|
@ -1,5 +1,6 @@
|
|||
package one.nem.lacerta.source.jgit.impl;
|
||||
|
||||
import org.eclipse.jgit.api.Git;
|
||||
import org.eclipse.jgit.lib.Repository;
|
||||
|
||||
import one.nem.lacerta.source.jgit.ActionRepo;
|
||||
|
@ -8,6 +9,11 @@ public class ActionRepoImpl implements ActionRepo{
|
|||
|
||||
Repository repository;
|
||||
|
||||
// Internal method
|
||||
private Git getGit() {
|
||||
return new Git(repository);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRepository(Repository repository) {
|
||||
this.repository = repository;
|
||||
|
@ -15,23 +21,36 @@ public class ActionRepoImpl implements ActionRepo{
|
|||
|
||||
@Override
|
||||
public Repository getRepository() {
|
||||
return null;
|
||||
if (repository == null) {
|
||||
throw new RuntimeException("リポジトリが設定されていません");
|
||||
}
|
||||
return repository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRepositoryName() {
|
||||
return null;
|
||||
return repository.getDirectory().getParentFile().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getUnstagedFiles() {
|
||||
Git git = new Git(repository);
|
||||
try {
|
||||
return git.status().call().getUntracked().toArray(new String[0]);
|
||||
} catch (Exception e) { // TODO-rca: エラーハンドリング
|
||||
return new String[0];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getStagedFiles() {
|
||||
Git git = new Git(repository);
|
||||
try {
|
||||
return git.status().call().getAdded().toArray(new String[0]);
|
||||
} catch (Exception e) { // TODO-rca: エラーハンドリング
|
||||
return new String[0];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stageFile(String path) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user