cli/pkg/cmd/repo
Tim Rogers c719d920c3
When renaming an existing remote in gh repo fork, log the change
When running `gh repo fork` in the context of an existing repo, the CLI offers to create a remote for the fork:

```
? Would you like to add a remote for the fork? Yes
```

If you accept, it prints a log stating that the `origin` remote has been created:

```
✓ Added remote origin
```

Where there is an existing `origin` remote, this is renamed to `upstream`, but this is done silently without any notification to the user.

```bash
$ git remote -v
origin	https://github.com/timrogers/badger.github.io.git (fetch)
origin	https://github.com/timrogers/badger.github.io.git (push)
upstream	https://github.com/badger/badger.github.io.git (fetch)
upstream	https://github.com/badger/badger.github.io.git (push)
```

It seems kinda fine to rename the remote without explicitly confirming since this is not a truly destructive action, but it should make it clear what it is doing.

This updates the logging to explicitly log about the renaming of
the existing remote:

```
✓ Renamed remote origin to upstream
```

Fixes #9982.
2024-11-30 21:19:55 +00:00
..
archive Move config interfaces into gh package (#9060) 2024-05-10 10:39:36 +02:00
clone Allow client fetch to use insecure credentials pattern 2024-11-26 22:30:03 +01:00
create Rename backwards compatible credentials pattern 2024-11-27 12:21:55 +01:00
credits Unify use of tab indent in non-test source files 2024-08-03 00:35:30 +08:00
delete Apply suggestions from code review 2024-11-21 13:55:35 -07:00
deploy-key Remove uses of FuzzyAgoAbbr in tables (#8222) 2023-10-22 17:33:49 +02:00
edit Assert stderr for gh repo edit visibility tests 2024-10-30 13:31:00 -04:00
fork When renaming an existing remote in gh repo fork, log the change 2024-11-30 21:19:55 +00:00
garden Move config interfaces into gh package (#9060) 2024-05-10 10:39:36 +02:00
gitignore Return nil instead of empty objects when err 2024-10-11 12:08:10 -06:00
license Return nil instead of empty objects when err 2024-10-11 12:08:10 -06:00
list Test json flags for repo view and list 2024-10-22 13:38:51 +02:00
rename Fix repo fork to use remote protocol if none configured 2024-05-10 10:48:36 +02:00
setdefault Change gh repo set-default --view to print to stderr when no default exists (#9431) 2024-08-08 13:44:52 -07:00
shared Reverse repo/shared package name change 2024-10-09 20:49:29 -06:00
sync Rename backwards compatible credentials pattern 2024-11-27 12:21:55 +01:00
unarchive Move config interfaces into gh package (#9060) 2024-05-10 10:39:36 +02:00
view Test json flags for repo view and list 2024-10-22 13:38:51 +02:00
repo.go implement gitignore list 2024-09-29 12:29:56 -06:00