diff options
author | Mohamed Zenadi <mohamed@zenadi.com> | 2015-08-08 14:42:16 +0200 |
---|---|---|
committer | Mohamed Zenadi <mohamed@zenadi.com> | 2015-08-10 06:50:18 +0200 |
commit | 57037916b0401bd843b3678d888d253e9a36e92a (patch) | |
tree | ea9296f5917874c6fafd172237dd15ef99e2ece6 /app/src/main/java | |
parent | 2adbeeeba7e715ce1a26c1e56e4528cae54e8bf2 (diff) |
check that we have a repository before cloning
Diffstat (limited to 'app/src/main/java')
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/git/GitActivity.java | 3 | ||||
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/utils/PasswordRepository.java | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/git/GitActivity.java b/app/src/main/java/com/zeapo/pwdstore/git/GitActivity.java index aaa058ec..e94d8efc 100644 --- a/app/src/main/java/com/zeapo/pwdstore/git/GitActivity.java +++ b/app/src/main/java/com/zeapo/pwdstore/git/GitActivity.java @@ -439,6 +439,9 @@ public class GitActivity extends AppCompatActivity { * @param view */ public void cloneRepository(View view) { + if (PasswordRepository.getRepository(null) == null) { + PasswordRepository.initialize(this); + } localDir = PasswordRepository.getWorkTree(); hostname = ((EditText) findViewById(R.id.clone_uri)).getText().toString(); port = ((EditText) findViewById(R.id.server_port)).getText().toString(); diff --git a/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRepository.java b/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRepository.java index aaca0cf1..8fa08f48 100644 --- a/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRepository.java +++ b/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRepository.java @@ -37,7 +37,7 @@ public class PasswordRepository { * @return the git repository */ public static Repository getRepository(File localDir) { - if (repository == null) { + if (repository == null && localDir != null) { FileRepositoryBuilder builder = new FileRepositoryBuilder(); try { repository = builder.setGitDir(localDir) |