Skip to content

Commit 4a18cf5

Browse files
committed
Properly handle fork mismatch in 'osc fork'
1 parent 9b7c388 commit 4a18cf5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

osc/commands/fork.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,11 @@ def run(self, args):
168168
fork_owner = e.fork_owner
169169
fork_repo = e.fork_repo
170170
print(f" * Fork already exists: {fork_owner}/{fork_repo}")
171+
except gitea_api.RepoExists as e:
172+
print(f"{tty.colorize('ERROR', 'red,bold')}: Repo already exists '{e.owner}/{e.repo}' and is not a fork of '{owner}/{repo}'")
173+
print(" * Consider forking with an alternative repo name")
174+
print(f" * You may also want to delete '{e.owner}/{e.repo}' and retry")
175+
sys.exit(1)
171176

172177
# XXX: implicit branch name should be forbidden; assumptions are bad
173178
fork_scmsync = urllib.parse.urlunparse(

0 commit comments

Comments
 (0)