fix: prevent -m mode crash on single-label domains #941
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.
Summary
This PR fixes a crash when mapping unknown affiliations to email domains (
-m) for emails whose domain has no dot (e.g.user@localhost). It also hardens date parsing inlogparser.pyto acceptCommitDate:lines.Background / Reasoning
database.MapToEmployer()iterates domain suffixes to find domain mappings, but for single-label domains the suffix loop never runs, leavingaddrundefined. Whenunknown == 1, this leads to an exception instead of producing a domain-based fallback.logparser.getDate()only skipped theDate:token; if the input containsCommitDate:(possible withgit log --pretty=fuller), date parsing can fail.Changes
src/database.pyaddris always defined before domain suffix iteration.GetHackerDomain()treat single-label domains as a real label (e.g.Localhost *) instead of producing" *".src/logparser.pyCommitDate:token when extracting the date string.Impact
gmail.com,example.co.uk).-mmode for single-label domains.CommitDate:lines are present in the git log input.Compatibility / Non-overlap
master(includes recent merges up throughe5595aa1).Verification