Skip to content

Add [name] argument to git-fork and git-clone#12

Merged
brycelelbach merged 1 commit into
brycelelbach:mainfrom
robobryce:add-fork-name-arg
May 14, 2026
Merged

Add [name] argument to git-fork and git-clone#12
brycelelbach merged 1 commit into
brycelelbach:mainfrom
robobryce:add-fork-name-arg

Conversation

@robobryce

Copy link
Copy Markdown

Summary

  • Adds an [name] positional argument to git-fork and git-clone so users can specify a custom name for the fork (different from the upstream repo name). Example: git-fork nvidia/cccl autocuda-cccl creates the fork at <account>/autocuda-cccl instead of <account>/cccl.
  • New signature for both scripts: <repo> [name] [account] [directory]. [directory] now defaults to [name] (which itself defaults to the upstream repo name). Pass "" for any optional arg to use its default.
  • For git-fork, the script passes --fork-name <name> to gh repo fork when name differs from the upstream. The "skip fork" short-circuit and git-clone's "no fork to wire up" guard now require both account and name to match the upstream.

This is a breaking change to the positional order: previous callers passing [account] as the second positional now need an empty [name] first (e.g. git-fork foo/bar "" myorg instead of git-fork foo/bar myorg).

Test plan

  • ./test.bash --lint passes (shellcheck + bash -n + manifest + skill validation).
  • ./test.bash --unit passes — all 77 bats tests green, including 5 new git-fork cases and 4 new git-clone cases covering renamed forks, [name]+[account] combination, [name] with separate [directory], empty-[name] fallback, missing renamed fork, and forking the upstream owner under a different name.
  • Manual smoke test: git-fork nvidia/cccl autocuda-cccl (not run — no auth to nvidia/cccl in this sandbox).

Lets users specify a custom name for the fork (different from the
upstream repo name). Useful for namespacing forks, e.g.
`git-fork nvidia/cccl autocuda-cccl` creates the fork at
`<account>/autocuda-cccl` instead of `<account>/cccl`.

New signature for both scripts:
  <repo> [name] [account] [directory]

`[name]` slots in between `<repo>` and `[account]`, and the local
`[directory]` now defaults to `[name]` (which itself defaults to the
upstream repo name). Pass `""` for any optional arg to use its default.

This is a breaking change to the positional order: previous callers
passing `[account]` as the second positional now need an empty `[name]`
first (`git-fork foo/bar "" myorg`).

Wiring:
- git-fork passes `--fork-name <name>` to `gh repo fork` when name
  differs from the upstream.
- git-fork's "skip fork" short-circuit now requires both account and
  name to match the upstream — `git-fork foo/bar renamed foo` is a
  real fork, not a no-op.
- git-clone's "no fork to wire up" guard does the same.
- The `fork` remote URL and the slug passed to repo/security settings
  are built from `<account>/<name>`.

Tests:
- gh stub learns `--fork-name`.
- New cases cover renamed forks, [name]+[account] together,
  [name] with separate [directory], empty-[name] fallback, and
  forking the upstream owner under a different name.
@brycelelbach brycelelbach merged commit 4b5405c into brycelelbach:main May 14, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants