sheimi / SGit

A Git client for Android.
http://tiny.cc/sgit
GNU General Public License v3.0
358 stars 113 forks source link

clone fails with ENOTDIR at the end #106

Closed als-git closed 10 years ago

als-git commented 10 years ago

I was trying to clone one of my internal repos via ssh://foo@example.com/path/repo.git and it fails:

Stacktrace from adb logcat:

W/System.err(20502): org.eclipse.jgit.api.errors.JGitInternalException: open failed: ENOTDIR (Not a directory) W/System.err(20502): at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:130) W/System.err(20502): at me.sheimi.sgit.repo.tasks.repo.CloneTask.cloneRepo(CloneTask.java:69) W/System.err(20502): at me.sheimi.sgit.repo.tasks.repo.CloneTask.doInBackground(CloneTask.java:32) W/System.err(20502): at me.sheimi.sgit.repo.tasks.repo.CloneTask.doInBackground(CloneTask.java:1) W/System.err(20502): at android.os.AsyncTask$2.call(AsyncTask.java:288) W/System.err(20502): at java.util.concurrent.FutureTask.run(FutureTask.java:237) W/System.err(20502): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) W/System.err(20502): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) W/System.err(20502): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) W/System.err(20502): at java.lang.Thread.run(Thread.java:818) W/System.err(20502): Caused by: java.io.IOException: open failed: ENOTDIR (Not a directory) W/System.err(20502): at java.io.File.createNewFile(File.java:941) W/System.err(20502): at java.io.File.createTempFile(File.java:1006) W/System.err(20502): at org.eclipse.jgit.dircache.DirCacheCheckout.checkoutEntry(DirCacheCheckout.java:1112) W/System.err(20502): at org.eclipse.jgit.dircache.DirCacheCheckout.doCheckout(DirCacheCheckout.java:457) W/System.err(20502): at org.eclipse.jgit.dircache.DirCacheCheckout.checkout(DirCacheCheckout.java:391) W/System.err(20502): at org.eclipse.jgit.api.CloneCommand.checkout(CloneCommand.java:236) W/System.err(20502): at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:127) W/System.err(20502): ... 9 more W/System.err(20502): Caused by: android.system.ErrnoException: open failed: ENOTDIR (Not a directory) W/System.err(20502): at libcore.io.Posix.open(Native Method) W/System.err(20502): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186) W/System.err(20502): at java.io.File.createNewFile(File.java:934) W/System.err(20502): ... 15 more

Watching the filesystem with a file system browser while the clone is running shows that the local repo does get created (repo directory, .git directory inside with expected structure).

als-git commented 10 years ago

And found the cause: It is not SGit, but the Android emulated sdcard filesystem behaviour's fault. The filesystem behaviour Android provides on the emulated sdcard is case-preserving, case-insensitive. As a result, "travel" and "Travel" resolve to the same filesystem object and therefore conflict. sigh

Some repo-surgery later to avoid filename conflicts on stupid filesystems later and the repo was cloned correctly.

It might be worth mentioning somewhere under 'common traps' ;-)

Also, if SGit runs into this kind of error, explicitly mentioning the name of the filesystem object triggering the problem would make troubleshooting this a bit easier.