algos to sort the entries:readme-edits
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 1.7k
- フォーク
- 408
- 平均マージ
- 2日 57分
- マージ済み PR(30日)
- 7
説明
I found the problem: git_tree.entries uses 2 different algos to sort the entries:
entry_search_cmp and entry_sort_cmp
entry_search_cmp makes an alphabetic sort, but entry_sort_cmp is more sophisticated (directories and files are not sorted the same way).
So i see 3 solutions:
1- We need to sort the list alphabetically before make the search (problem: git_vector_bsearch2 makes a sort)
2- We split entry_search_cmp into 2 functions: entry_search_file_cmp and entry_search_dir_cmp, we use gitfo_cmp_path and we search for a file and after for a directory.
3- Maybe we can always (everywhere) use an alphabetic sort???
4- An other better solution, ...
I made this patch:
https://github.com/versmisse/libgit2/commit/8ee19a25ab4b54ff583bb46093610db0f53d2ab5
to test the solution and it works fine with git_tree_entry_byname. But it is not very clean (i change a private member (_cmp)) and incomplete (we must find a solution for all bsearch2 in the code).
Originally posted by @versmisse in https://github.com/libgit2/libgit2/issues/127#issuecomment-1038775
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
git_tree.entries、entry_search_cmp、entry_sort_cmp、および issue に記載された git_vector_bsearch2 の呼び出しから始めます。リンク先のパッチを比較し、git_tree_entry_byname とその他の bsearch2 の使用箇所について、一貫した検索およびソート戦略を決定します。完了の条件は、回避策として private member を変更せずにエントリ検索の動作が正しくなることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- devtools
- issue の種類
- バグ
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 20/100