From 81dc92f449e4555e0b823bcc4e56335daca6888c Mon Sep 17 00:00:00 2001 From: r-ca Date: Sat, 16 Dec 2023 14:12:58 +0900 Subject: [PATCH] WIP --- .../nem/lacerta/source/jgit/impl/ActionRepoImpl.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/source/src/main/java/one/nem/lacerta/source/jgit/impl/ActionRepoImpl.java b/source/src/main/java/one/nem/lacerta/source/jgit/impl/ActionRepoImpl.java index 53d8033a..d6fecad9 100644 --- a/source/src/main/java/one/nem/lacerta/source/jgit/impl/ActionRepoImpl.java +++ b/source/src/main/java/one/nem/lacerta/source/jgit/impl/ActionRepoImpl.java @@ -9,9 +9,14 @@ public class ActionRepoImpl implements ActionRepo{ Repository repository; + Git git; + // Internal method private Git getGit() { - return new Git(repository); + if (this.git == null) { + this.git = new Git(repository); + } + return this.git; } @Override @@ -34,7 +39,7 @@ public class ActionRepoImpl implements ActionRepo{ @Override public String[] getUnstagedFiles() { - Git git = new Git(repository); + Git git = getGit(); try { return git.status().call().getUntracked().toArray(new String[0]); } catch (Exception e) { // TODO-rca: エラーハンドリング @@ -44,7 +49,7 @@ public class ActionRepoImpl implements ActionRepo{ @Override public String[] getStagedFiles() { - Git git = new Git(repository); + Git git = getGit(); try { return git.status().call().getAdded().toArray(new String[0]); } catch (Exception e) { // TODO-rca: エラーハンドリング