From 7bf18f23e5183726180f03e311ecda98daa5dc27 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 9 Apr 2019 14:07:47 -0400 Subject: [PATCH] todo --- doc/todo/adb_import.mdwn | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 doc/todo/adb_import.mdwn diff --git a/doc/todo/adb_import.mdwn b/doc/todo/adb_import.mdwn new file mode 100644 index 0000000000..1bfe0a707c --- /dev/null +++ b/doc/todo/adb_import.mdwn @@ -0,0 +1,34 @@ +Make adb special remote support import tree. + +This would be very useful for syncing with an android device without +needing to run git-annex on it. While git-annex works well enough in +termux, the horribleness of android's /sdcard makes it unappealing to put a +git annex repository on it (direct mode is still the best option there; +v7 unlocked works but without hard links has to store two copies of each +file). + +This needs at a minimum a way to list files in a directory via adb, +in order to find new files. `adb shell find /sdcard/ -type f` seems to work +across a range of android versions (5.1, 8.1). + +To avoid re-downloading each file each import, a way to list files +along with a good content identifier is needed. +`adb shell find /sdcard/ -type f -exec stat -c "'%d %i %s %Y %n'" {} +` +works on (5.1, 8.1) (note the weird quoting that it needs) + +To avoid losing modifications to files +that the user makes using the android device while the same files are being +exported to it would need an upload to a temp location followed by a check +that the original is unmodified before renaming. This needs +shell scripting in android's limited shell environment, or +`adb shell stat 'origfile'` followed by `adb shell mv 'tmpfile' 'origfile'`. + +That is necessarily racy, although the race window is +probably not much wider than the similar races when git checkout stats +work tree files before overwriting them. + +Alternatively, the documentation could tell the user to avoid modifying files +on their android device while git-annex is exporting to it, or to instead +only ever modify files on the android device, and import from it, but not +export any changes to it. (Or some combination of those +for different subdirectories on it.)