-
Notifications
You must be signed in to change notification settings - Fork 808
refactor: consistent cloning & pattern-handling #388
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
Open
filipchristiansen
wants to merge
5
commits into
main
Choose a base branch
from
resolve-commit
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+714
−615
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7ab4af2
to
831a36d
Compare
cf1aa6f
to
d1224a6
Compare
d1224a6
to
979c88a
Compare
979c88a
to
3031e7c
Compare
Add `_handle_remove_readonly` on-error callback for `shutil.rmtree` that removes the read-only attribute and retries, preventing WinError 5 during temp-repo cleanup in tests.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
✨ Refactor: consistent cloning & pattern-handling
Why
→ Caching and reproducibility suffered.
query_parser
and duplicated ignore/include logic.→ Hard to unit-test and reuse.
packed-object files.
→ Shallow-clone cleanup broke with WinError 5.
What’s new
utils.git_utils.resolve_commit()
guarantees we always fetch the exact SHA(HEAD / branch / tag) before checkout.
Deterministic → enables caching (feat: Implement caching on a per-commit basis #343).
utils.pattern_utils.process_patterns()
centralises include/exclude parsing(moved out of
query_parser
). Adds thorough tests._handle_remove_readonly
on-error callback makes read-only Git objectswritable and retries
shutil.rmtree()
, preventing WinError 5 in CI.parse_query()
removed in favour ofparse_remote_repo()
(URLs/slugs)parse_local_dir_path()
(local paths)clone_repo
,ingest_query
,parse_query
are no longer re-exported fromgitingest.__init__
.(optional) → fetch commit → checkout → submodule update (optional).
_checkout_partial_clone
renamed & moved →git_utils.checkout_partial_clone
.query_processor
uses new pattern utilities and passes a typed enum.IngestRequest.validate_input_text()
now removes any.git
suffix.File changes
gitingest
__init__.py
clone_repo
,ingest_query
,parse_query
)clone.py
clone_repo
to callresolve_commit
, sparse checkout, and uniform fetch/checkout steps; move helper & renameentrypoint.py
_handle_remove_readonly
callback for Windows temp-dir cleanup;ingest_async
now usesparse_remote_repo
/parse_local_dir_path
output_formatter.py
Tag
prefix in_create_summary_prefix
query_parser.py
parse_query
; move pattern helpers topattern_utils.py
utils/git_utils.py
resolve_commit
helperutils/os_utils.py
ensure_directory
→ensure_directory_exists_or_create
utils/pattern_utils.py
process_patterns
utils/query_parser_utils.py
_is_valid_pattern
topattern_utils.py
server
models.py
.git
suffix invalidate_input_text
query_processor.py
parse_query
withparse_remote_repo
, integratePatternType
, useprocess_patterns
routers_utils.py
pattern_type
intoPatternType
enumtests
conftest.py
query_parser/test_git_host_agnostic.py
parse_remote_repo
query_parser/test_query_parser.py
parse_remote_repo
; addparse_local_dir_path
coveragetest_clone.py
test_pattern_utils.py
_parse_patterns
andprocess_patterns
test_summary.py
gitingest.ingest()
emits correct summaries