Add [name] argument to git-fork and git-clone#12
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
[name]positional argument togit-forkandgit-cloneso users can specify a custom name for the fork (different from the upstream repo name). Example:git-fork nvidia/cccl autocuda-ccclcreates the fork at<account>/autocuda-ccclinstead of<account>/cccl.<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.git-fork, the script passes--fork-name <name>togh repo forkwhen name differs from the upstream. The "skip fork" short-circuit andgit-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 "" myorginstead ofgit-fork foo/bar myorg).Test plan
./test.bash --lintpasses (shellcheck + bash -n + manifest + skill validation)../test.bash --unitpasses — 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.git-fork nvidia/cccl autocuda-cccl(not run — no auth to nvidia/cccl in this sandbox).