jb2170/better-adb-sync

Please follow rsync convention

Opened this issue · 5 comments

This script does not treat a trailing slash on the source side's filepath specially.

I would place a request to reconsider using rsync's behaviour of trailing slash in source. That is such a convention and will help a lot.

Hi,

I've added rsync's trailing-slash functionality back in this in this PR. I've tried it and it seems functional.

We just consider when the destination is a directory; if the source is a file, or a folder without a trailing slash, then the source is synced against a target with the same leaf-name as the source inside the destination.

I'm not sure 100% how this affects when the source or destination themselves are symlinks so I may leave this issue open, but for symlinks inside the trees -L works as normal.

Let me know if this is what you wanted and I'll merge the PR to the master branch.

(Edit 2022/03/04: rsync puts the source inside of a subfolder when the destination doesn't exist and the souce is a folder: this needs considering too)

I'm not sure 100% how this affects when the source or destination themselves are symlinks so I may leave this issue open, but for symlinks inside the trees -L works as normal.

Since symlinks are not that vital for Android one could skip this issue.

I've added rsync's trailing-slash functionality back
Thanks. Happy about this.

Ignoring symlink /sdcard
Source tree:

I get this error when trying to use the tool.

Inspecting /sdcard with $ adb shell ls -ld /sdcard we see it is (usually) a symlink, for me /sdcard -> /storage/self/primary, hence as there is no trailing slash on the source side nor -L flag supplied adbsync ignores it as expected

Inspecting /sdcard with $ adb shell ls -ld /sdcard we see it is (usually) a symlink, for me /sdcard -> /storage/self/primary, hence as there is no trailing slash on the source side nor -L flag supplied adbsync ignores it as expected

The thing is, /storage/self/primary is itself just a symlink to /storage/emulated/0
image

If there is some way for this tool to support just pulling from /sdcard that will be perfect, since it just runs adb pull in the background which is capable of running a pull on /sdcard I fail to see how this wouldn't be possible. /storage/emulated/0 has different permissions than /sdcard which can cause issues.