-
Notifications
You must be signed in to change notification settings - Fork 34
fix(syncer): [issue #42] Remove redundant path slices in file paths and ancestor root #44
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
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| # buildout files and folders | ||
| bin | ||
| .installed.cfg | ||
| eggs | ||
|
|
||
| # tox directory | ||
| .tox | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -158,9 +158,9 @@ def _compare(self, dir1, dir2): | |
|
|
||
| if add_path: | ||
| left.add(path) | ||
| anc_dirs = re_path[:-1].split('/') | ||
| anc_dirs = re_path.split('/') | ||
| anc_dirs_path = '' | ||
| for ad in anc_dirs[1:]: | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess we have to strip the root directory as we don't want it to appear in the |
||
| for ad in anc_dirs: | ||
| anc_dirs_path = os.path.join(anc_dirs_path, ad) | ||
| left.add(anc_dirs_path) | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really can't remember why the [:-1] was added here. This dates from when I completely rewrote / adapted dirsync from the original author's code. It was possibly to remove the trailing slash for directories, and I may never have hit this line with
re_pathbeing a file. However, to safe-guard against adding too many items toleft, shouldn't we either usere_path.rstrip("/").split("/")or add aif not ad: continuein the for loop that follows?