check that we have a repository before cloning

This commit is contained in:
Mohamed Zenadi 2015-08-08 14:42:16 +02:00
parent 2adbeeeba7
commit 57037916b0
2 changed files with 4 additions and 1 deletions

View file

@ -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();

View file

@ -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)