-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--diff options shows files "Only in dir1" twice, once correctly and again with no dir path and last character removed. #42
Comments
Maybe try making the changes and running it through the tests? Here's the permalink to the lines mentioned above: L161-165 Update:
Doing this gives me this error:
Apparently this was due to the spaces in the directory name, so maybe the [:-1] slicing is to remove trailing spaces or trailing slashes? @tkhyn, can you please explain bc if that's the case then it can easily be done via either re.replace() or str.strip() / lstrip() / rstrip() |
Update 2: However other than the [:-1] slicing, I do no understand the use of removing the root directory in the for loop here by using anc_dirs[1:]?
@davidi17 This loop however makes absolutely perfect sense as you might want to create the directory tree in case it doesn't exist on the target side. For example: However, I do believe this can be done in a better way than this. Not exaclty sure how though. |
If you use the --diff option to compare directories, it outputs the filenames "Only in dir1" twice, once correctly and then again but without the directory path and the filename has its last character missing.
Example
On Windows 10 using Python 3.9.1.
Where the problem is:
In dirsync 2.2.5, syncer.py, lines 159-165.
Line 161:
anc_dirs = re_path[:-1].split('/')
strips off the last character of the filename
file004.txt
->file004.tx
Perhaps it should be just
re_path.split('/')
And the loop lines 163-165 with
left.add(anc_dirs_path)
adds the unnecessary files to the listleft
(all with their last character missing).I really can't see what this loop with
anc_dirs_path
does. If lines 161-165 are simply removed, the program would seem to do the right thing. Maybe I've missed some important use case, but it's certainly wrong for the example above.The text was updated successfully, but these errors were encountered: