summaryrefslogtreecommitdiff
path: root/builtin/describe.c
diff options
context:
space:
mode:
authorLibravatar Ben Keene <seraphire@gmail.com>2019-12-16 14:02:19 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-12-16 12:31:47 -0800
commite2aed5fd5bfb0381a6f69373c01ef09d70467a5c (patch)
tree3c54279f863159de44d137e153f74e80f3809f8c /builtin/describe.c
parentGit 2.24.1 (diff)
downloadtgif-e2aed5fd5bfb0381a6f69373c01ef09d70467a5c.tar.xz
git-p4: yes/no prompts should sanitize user text
When prompting the user interactively for direction, the tests are not forgiving of user input format. For example, the first query asks for a yes/no response. If the user enters the full word "yes" or "no" or enters a capital "Y" the test will fail. Create a new function, prompt(prompt_text) where * prompt_text is the text prompt for the user * returns a single character where valid return values are found by inspecting prompt_text for single characters surrounded by square brackets This new function must prompt the user for input and sanitize it by converting the response to a lower case string, trimming leading and trailing spaces, and checking if the first character is in the list of choices. If it is, return the first letter. Change the current references to raw_input() to use this new function. Since the method requires the returned text to be one of the available choices, remove the loop from the calling code that handles response verification. Thanks-to: Denton Liu <liu.denton@gmail.com> Signed-off-by: Ben Keene <seraphire@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/describe.c')
0 files changed, 0 insertions, 0 deletions