feat(git): add --server/--check-existing to mkrep for gitea/gitlab/github #150
No Reviewers
Labels
Clear labels
Area/CI
Area/Completions
Area/Components
Area/Config
Area/Docs
Area/Functions
Area/Integrations
Area/Prompt & Theme
Area/Scripts
Area/Tests
Compat/Breaking
Kind/Bug
Kind/Chore
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Performance
Kind/Refactor
Kind/Security
Kind/Testing
good first issue
help wanted
.github/workflows and repository automation
completions/ - tab-completion scripts
The opinionated-component system (C1-C6)
config.fish and conf.d/ - startup and environment
docs/manual/ and the generated manual, man page, and site
functions/ - user-facing functions and helpers
integrations/ - third-party tool wiring
themes/ and prompt appearance
scripts/ - standalone helper scripts
tests/ - the syntax lint and functional suite
Breaking change that won't be backward compatible
Something is not working
Tooling, dependencies, and housekeeping
Documentation changes
Improve existing functionality
New functionality
Makes existing behavior faster or lighter
Restructures code without changing behavior
This is security issue
Issue or pull request related to testing
Well-scoped and self-contained; a good place to start
Maintainer is looking for someone to pick this up
Priority
Critical
1
The priority is critical
Priority
High
2
The priority is high
Priority
Medium
3
The priority is medium
Priority
Low
4
The priority is low
Reviewed
Confirmed
1
Issue has been confirmed
Reviewed
Duplicate
2
This issue or pull request already exists
Reviewed
Invalid
3
Invalid issue
Reviewed
Won't Fix
3
This issue won't be fixed
Status
Blocked
1
Something is blocking this issue or pull request
Status
Need More Info
2
Feedback is required to reproduce issue or to continue work
Status
Abandoned
3
Somebody has started to work on this but abandoned work
Milestone
No items
No Milestone
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: rootiest/fish-config#150
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
mkrepgains--server <gitea|gitlab|github>and--check-existing, plus detection from$GIT_SERVERand$GITEA_URL/$GITEA_HOST/$GITLAB_URL/$GITLAB_HOST.--serveror$GIT_SERVER; the_URL/_HOSTvars only ever supply the base URL. This was a deliberate change from the original ask — see design note below.gh repo view/glab repo view/tea repos <owner>/<name>whether it already exists, and links instead of recreating it.--check-existingruns just that check and reports without touching remotes._mkrep_default_remote_cmd,_mkrep_remote_url,_mkrep_repo_exists.--remote/--new-remotestill override everything, exactly as before.Design note
The original spec had bare presence of
$GITEA_URL/$GITEA_HOST/$GITLAB_URL/$GITLAB_HOSTalone select the server type. Testing on this machine showed why that's unsafe:$GITEA_URL/$GITEA_HOSTare already exported here forbd-pull's Gitea API calls, unrelated tomkrep. With the original design, every plainmkrep some-dirwould have silently attempted to create a remote repo. Confirmed viaAskUserQuestionto require$GIT_SERVER(or--server) to pick the type; the URL vars stay URL-only.Test plan
fish tests/test-mkrep.fish— 58/58 pass, including new coverage for--server,--check-existing, env-var precedence, and conflict validation (gh/glab/tea calls stubbed via$PATH, no real network/auth needed)fish tests/run-tests.fish— full suite, 719/719 passpython3 docs/verify-manual.py— 84/84 passmkrep --server gitea some-diragainst a real Gitea instance once a remote is available to verify againstmkrep only ever runs git init, never a commit, so a freshly created repo has no HEAD yet. The gitea/gitlab default templates chained `git push -u origin HEAD` unconditionally after linking the remote, which fails immediately regardless of the remote ("src refspec HEAD does not match any") -- reproduced by a real user hitting it on the first mkrep --server call. Guard the push on HEAD actually resolving to a commit; skipping it is the correct outcome (nothing to push yet), and a real push failure once a commit exists still propagates.