INNER CODE UNIT · TypeScript

pickGitIdentityConfig

EndBug/add-and-commit · src/util.ts:166

export function pickGitIdentityConfig(
  config: Record<string, unknown>,
): Record<string, unknown> {
  const result: Record<string, unknown> = {};
  for (const key of GIT_IDENTITY_CONFIG_KEYS) {
    if (Object.prototype.hasOwnProperty.call(config, key)) {
      result[key] = config[key];
    }
  }
  return result;
}

/**
 * Ensures `name` is safe to pass as a single git branch/ref positional argument.
 * Rejects empty values, leading hyphens (git option injection), whitespace/control
 * chars, and names rejected by `git check-ref-format --branch`.
 */
export function assertValidBranchName(name: string): void {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…