maks / MGit

A Git client for Android.
https://manichord.com/projects/mgit.html
GNU General Public License v3.0
1.26k stars 169 forks source link

Git repository deleted when open share with the same URL end #289

Closed mvbasov closed 4 years ago

mvbasov commented 6 years ago

How to reproduce:

  1. Open some URL in browser (for example https://github.com/maks/MGit) an choice MGit in application selector.
  2. Repository automatically cloned.
  3. Open URL with the same end in browser (for example https://github.com/morristech/MGit)
  4. Some dialog box about already exists...
  5. Previously cloned repository gravatar changes...
  6. Attempt to open previously cloned repository and the application crashes with the following report SER_COMMENT= ANDROID_VERSION=7.1.2 APP_VERSION_NAME=1.5.4.2 BRAND=Xiaomi PHONE_MODEL=MI 5s CUSTOM_DATA= STACK_TRACE=java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Throwable.getLocalizedMessage()' on a null object reference at me.sheimi.sgit.repo.tasks.repo.RepoOpTask.onPostExecute(RepoOpTask.java:31) at me.sheimi.sgit.repo.tasks.repo.GetCommitTask.onPostExecute(GetCommitTask.java:39) at me.sheimi.sgit.repo.tasks.repo.GetCommitTask.onPostExecute(GetCommitTask.java:13) at android.os.AsyncTask.finish(AsyncTask.java:667) at android.os.AsyncTask.-wrap1(AsyncTask.java) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:684) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6186) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
  7. Directory with previously cloned repository deleted from disk
  8. attempt to open broken repository crashes application again.
kb-1000 commented 6 years ago

The clone errors and it tries to delete the not cloned repository. This accidentally removes the already cloned repository. I'm preparing to fix this.

maks commented 4 years ago

@kb-1000 did you want to do a PR with that fix?

kb-1000 commented 4 years ago

tbh I don't remember, it has been nearly a year ago... probably yes, although I'm not sure if the commit you can see above actually fixes this.

kb-1000 commented 4 years ago

It looks like it is already in master though

maks commented 4 years ago

@kb-1000 thanks, yes, so it is.