Skip to content
Browse files
[git-webkit] Question 'Are you sure want to setup a fork?' always ret…
…urns 'Yes'

Reviewed by Jonathan Bedard.

When the response of the user is an empty string, function 'Terminal.choose'
always returns the first option.

The reason for that is a 'startswith' comparison of an option with an empty
string. This comparison is always true, thus the first option is selected
instead of the default option.

Canonical link:
git-svn-id: 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
dpino committed May 20, 2022
1 parent 144605f commit ba0fcb4ec4ad26fd05459a1c38ee2bb162215575
Showing 2 changed files with 2 additions and 2 deletions.
@@ -65,7 +65,7 @@ def choose(cls, prompt, options=None, default=None, strict=False, numbered=False
if index >= 0 and index < len(options):
response = options[index]

if not strict:
if not strict and len(response) > 0:
for option in options:
if option.lower().startswith(response.lower()):
response = option
@@ -441,7 +441,7 @@ def git(cls, args, repository, additional_setup=None, hooks=None, **kwargs):

if not forking:
if not forking or forking == 'No':
return result

if cls.github(args, rmt, **kwargs):

0 comments on commit ba0fcb4

Please sign in to comment.