Rename a remote in the configuration. The refspecs in standard format will be renamed. Returns a list of fetch refspecs (list of strings) which were not in the standard format and thus could not be remapped.
(self, name: str, new_name: str)
| 478 | return Remote(self._repo, cremote[0]) |
| 479 | |
| 480 | def rename(self, name: str, new_name: str) -> list[str]: |
| 481 | """Rename a remote in the configuration. The refspecs in standard |
| 482 | format will be renamed. |
| 483 | |
| 484 | Returns a list of fetch refspecs (list of strings) which were not in |
| 485 | the standard format and thus could not be remapped. |
| 486 | """ |
| 487 | |
| 488 | if not name: |
| 489 | raise ValueError('Current remote name must be a non-empty string') |
| 490 | |
| 491 | if not new_name: |
| 492 | raise ValueError('New remote name must be a non-empty string') |
| 493 | |
| 494 | problems = ffi.new('git_strarray *') |
| 495 | err = C.git_remote_rename( |
| 496 | problems, self._repo._repo, to_bytes(name), to_bytes(new_name) |
| 497 | ) |
| 498 | check_error(err) |
| 499 | return strarray_to_strings(problems) |
| 500 | |
| 501 | def delete(self, name: str) -> None: |
| 502 | """Remove a remote from the configuration |
no test coverage detected