← 返回 stripe 的题目列表Integration: Review Assignment via Git Diff + CSV Owners (JGit)
类型:online_judge
Integration — reviewer assignment via Git diff + CSV owners (JGit)
Implement a "review-assignment" tool: given two branches in the same Git repository, compute the list of changed files between them; then, using a CSV mapping of file -> owner, find the owner who owns the largest number of changed files and return that owner.
Inputs
Local Git repository path repoPath
Two branch names branchA and branchB
A CSV file owners.csv describing file ownership (exact format provided in the interview)
Output
Return (or print) the owner identifier (username/email) who owns the most changed files between branchA and branchB.
If there is a tie: follow the rule specified in the interview; if not specified, define one (e.g., lexicographically smallest).
Required functionality
Use JGit to compute diffs between the two branches and collect changed file paths (added/modified/deleted).
Parse the CSV to build a mapping from file path (or pattern) to owner.
Map changed file paths to owners and count per-owner totals.
Output the owner with the maximum count.
Edge cases
Changed files missing from the CSV.
Files matching multiple owners.
Case sensitivity differences in paths.
Large repos: avoid inefficient full traversals.
Example (abstract)
Changed files: ["src/A.java", "src/B.java", "README.md"]
owners.csv: src/A.java -> alice, src/B.java -> bob, README.md -> alice
Output: alice