sailfork / t3code-github / apps/ mobile/ src/ features/ threads/ projectThreadCreationValidation.ts

export function resolveProjectThreadCreationBranch(input: {
  readonly workspaceMode: "local" | "worktree";
  readonly selectedBranch: string | null;
  readonly currentCheckoutBranch: string | null;
}): string | null {
  if (input.selectedBranch !== null) {
    return input.selectedBranch;
  }
  return input.workspaceMode === "local" ? input.currentCheckoutBranch : null;
}