INNER CODE UNIT · TypeScript

code

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

      code === 0x7f || // DEL
      (code >= 0x80 && code <= 0x9f) || // C1 controls
      /\s/u.test(char) // Unicode whitespace (e.g. NBSP)
    ) {
      throw new Error(
        `The new_branch value '${neutralizeLogString(name)}' contains whitespace or control characters.`,
      );
    }
  }

  try {
    // Leading '-' is already rejected above so this cannot be parsed as a flag.
    execFileSync('git', ['check-ref-format', '--branch', name], {
      stdio: 'ignore',
    });
  } catch {
    throw new Error(
      `The new_branch value '${neutralizeLogString(name)}' is not a valid git branch name.`,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…