Commit graph

14 commits

Author SHA1 Message Date
lif
1d506f5331
fix: simplify set-default remote parsing 2026-01-14 18:35:04 +08:00
majiayu000
5f305e81c2
Handle repo argument before remote name 2026-01-10 00:54:51 +08:00
majiayu000
73c7fd59ef feat: allow git remote names in gh repo set-default
When specifying a repository for `gh repo set-default`, users can now
use a git remote name (e.g., "origin", "upstream") instead of the
full OWNER/REPO format.

The command first checks if the argument is a git remote name. If
found, it uses the corresponding repository. Otherwise, it falls
back to parsing the argument as OWNER/REPO format.

Example:
  gh repo set-default origin

Fixes #9149

Signed-off-by: majiayu000 <1835304752@qq.com>
2025-12-26 19:21:11 +08:00
Azeem Sajid
eb44ec2d86 Update tests 2025-02-11 10:34:10 +05:00
Wing
0be5720c1c Update setdefault test 2025-01-15 14:55:17 +01:00
Prabhat Kumar Sahu
ab34d868aa
Change gh repo set-default --view to print to stderr when no default exists (#9431)
Change logging of `gh repo set-default --view` to `stderr` when no default exists to better conform with expectations and unix standards.

---------

Signed-off-by: Prabhat <iprabhatdev@gmail.com>
2024-08-08 13:44:52 -07:00
Yukai Chou
21e9ba3345 fixup! Use "GitHub Actions" as a whole 2023-11-23 07:29:04 +08:00
Jakub Kuczys
bd749b67f6
Allow gh repo set-default --view without repo argument (#7441) 2023-05-15 11:08:01 +12:00
Des Preston
94fe6c7764
Fix set-default interactive not showing all remotes (#6969) 2023-02-07 23:11:38 +00:00
Mislav Marohnić
8df1e9946f
repo set-default: support bare git repos
The command was using this to check for git repo context:

    git rev-parse --is-inside-work-tree

With this change, this is used instead:

    git rev-parse --git-dir

The latter approach works in the context of a bare git repository, which does not have a worktree.
2023-01-18 20:45:12 +01:00
vilmibm
f5d19b831e error instead of prompt when no base repo + fixes 2022-12-15 11:44:37 -08:00
vilmibm
5461d15b74 final bit of feedback 2022-12-14 16:26:01 -08:00
vilmibm
6532397963 use factory git client 2022-12-14 16:26:01 -08:00
vilmibm
db4de60307 rename command and fix tests 2022-12-14 16:26:01 -08:00
Renamed from pkg/cmd/repo/default/default_test.go (Browse further)