-
Notifications
You must be signed in to change notification settings - Fork 75
fix: getGitEmail() should accept a directory parameter for cwd consistency #44
Copy link
Copy link
Open
Description
Problem
In src/services/tags.ts, getGitEmail() calls execSync("git config user.email") without passing cwd, so it uses the process working directory rather than the project directory.
The recently added getGitRemoteUrl() correctly passes { cwd: directory }, creating an inconsistency between the two functions that have the same shape.
Impact
In practice this is low-risk because git user email is typically global (~/.gitconfig), but if a user has a per-repo email override, the wrong email could be read when the process working directory differs from the project directory.
Suggested Fix
Add a directory parameter to getGitEmail() and pass it as cwd:
export function getGitEmail(directory?: string): string | null {
try {
const email = execSync("git config user.email", {
cwd: directory,
encoding: "utf-8",
stdio: ["pipe", "pipe", "pipe"],
}).trim();
return email || null;
} catch {
return null;
}
}Update the call site in getUserTag() (or pass directory through getTags).
Context
Found during systems review of PR #43.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels