fix(git_util): derive pack first-created date from the add commit - #5504
Open
rshunim wants to merge 6 commits into
Open
fix(git_util): derive pack first-created date from the add commit#5504rshunim wants to merge 6 commits into
rshunim wants to merge 6 commits into
Conversation
Derive the file creation date from the commit that first added the file (following renames) instead of the oldest reachable commit, and log a warning when the result may be unreliable (for example, a shallow clone). CRTX-221269
|
Changelog(s) in markdown:
|
The tests commit via the git CLI, which fails when no user.name/user.email is configured (for example, on a CI runner). Pass an explicit author and committer identity through the commit environment.
rshunim
marked this pull request as ready for review
August 20, 2026 10:50
Contributor
Author
|
Checked for both cases, when a pack like Base contains the "created" filed in its metadata and the other case for "AHA" and "Traceable" which have not this field and made sure in this case the first commit is being taken. |
TestSuite.repo.Repo.create_pack replaces GitUtil.get_file_creation_date with a MagicMock on the class and never restores it, so a test that ran earlier in the suite leaked the mock into these tests and they asserted against the mocked date. Restore the real implementation via a fixture.
Git 2.5x renders a zero UTC offset in '%aI' as a 'Z' suffix, which datetime.fromisoformat only accepts from Python 3.11 onwards. On Python 3.10 the resulting ValueError made get_file_creation_date fall back to iter_commits, which doesn't follow renames, so the returned date was the rename commit's rather than the add commit's. CRTX-221269
Collaborator
Coverage Report for CI Build 32458127194Warning No base build found for commit Coverage: 86.615%Details
Uncovered Changes
Coverage RegressionsRequires a base build to compare against. How to fix this → Coverage Stats
💛 - Coveralls |
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
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.
Related Issues
fixes: https://jira-dc.paloaltonetworks.com/browse/CRTX-221269
Description
Derive the file creation date from the commit that first added the file (following renames) instead of the oldest reachable commit, and log a warning when the result may be unreliable (for example, a shallow clone).