-
Notifications
You must be signed in to change notification settings - Fork 3
findTreeEntry might not return existed entry if paths sorted not in lexicographical ordering #9
Copy link
Copy link
Open
Description
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch @discoveryjs/scan-git@0.1.5 for the project I'm working on.
Paths might be sorted in exotic way whe "<" comparision doesn't work
eg. "communities-entry" is going earlier than "communities"
But while loop breaks earlier than can find communities entry and return null.
Here is the diff that solved my problem:
diff --git a/node_modules/@discoveryjs/scan-git/lib/tree-utils.cjs b/node_modules/@discoveryjs/scan-git/lib/tree-utils.cjs
index a6a3e39..e9d98cd 100644
--- a/node_modules/@discoveryjs/scan-git/lib/tree-utils.cjs
+++ b/node_modules/@discoveryjs/scan-git/lib/tree-utils.cjs
@@ -16,9 +16,11 @@ function findTreeEntry(buffer, path) {
};
}
- if (path < entryPath) {
- break;
- }
+ // Paths might be sorted in exotic way whe "<" comparision doesn't work
+ // eg. "communities-entry" is going earlier than "communities"
+ // if (path < entryPath) {
+ // break;
+ // }
offset = nullchar + 21;
}This issue body was partially generated by patch-package.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels