From: Junio C Hamano <gitster@pobox.com> To: "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com> Cc: git@vger.kernel.org, Jeff King <peff@peff.net>, Johannes Schindelin <johannes.schindelin@gmx.de> Subject: Re: [PATCH v2 1/2] Refactor code asking the user for input interactively Date: Fri, 10 Apr 2020 10:44:59 -0700 [thread overview] Message-ID: <xmqqftdbjkv8.fsf@gitster.c.googlers.com> (raw) In-Reply-To: <9d2ee78a9e414c0b6aacbc9c878ab08eb70703d5.1586518072.git.gitgitgadget@gmail.com> (Johannes Schindelin via GitGitGadget's message of "Fri, 10 Apr 2020 11:27:50 +0000") "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com> writes: > - if (strbuf_getline(&input, stdin) == EOF) { > + if (git_read_line_interactively(&input) == EOF) { It's not like we are mimicking or giving a thin wrapper to improve an existing read_line_interactively() from a third-party, so I do not see much point in giving "git_" prefix here. On the other hand, "strbuf_" prefix may not hurt (but the type of its first parameter is sufficient so it is not exactly required). > printf(_("Remove %s [y/N]? "), qname); > - if (strbuf_getline_lf(&confirm, stdin) != EOF) { > - strbuf_trim(&confirm); > - } else { > + if (git_read_line_interactively(&confirm) == EOF) { > putchar('\n'); > eof = 1; A fat-finger that gave an answer " yes <RET>" used to be still taken as a yes but now it is interpreted as "no", because the new helper trims a lot less. In general, the existing code should be already choosing the safer default, so such a change in behaviour brought in by this change, even if they were not intentional, should probably be safe. Thanks.
next prev parent reply other threads:[~2020-04-10 17:45 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-04-08 19:33 [PATCH] clean: explicitly `fflush` stdout Johannes Schindelin via GitGitGadget 2020-04-08 20:14 ` Jeff King 2020-04-08 21:51 ` Junio C Hamano 2020-04-08 22:38 ` Jeff King 2020-04-10 14:03 ` Johannes Schindelin 2020-04-10 11:27 ` [PATCH v2 0/2] Explicitly fflush stdout in git clean Johannes Schindelin via GitGitGadget 2020-04-10 11:27 ` [PATCH v2 1/2] Refactor code asking the user for input interactively Johannes Schindelin via GitGitGadget 2020-04-10 12:27 ` Derrick Stolee 2020-04-10 14:01 ` Johannes Schindelin 2020-04-10 15:07 ` Jeff King 2020-04-10 17:44 ` Junio C Hamano [this message] 2020-04-10 11:27 ` [PATCH v2 2/2] Explicitly `fflush` stdout before expecting interactive input 마누엘 via GitGitGadget 2020-04-10 12:28 ` Derrick Stolee 2020-04-10 18:16 ` [PATCH v3 0/2] Explicitly fflush stdout in git clean Johannes Schindelin via GitGitGadget 2020-04-10 18:16 ` [PATCH v3 1/2] Refactor code asking the user for input interactively Johannes Schindelin via GitGitGadget 2020-04-10 18:16 ` [PATCH v3 2/2] Explicitly `fflush` stdout before expecting interactive input 마누엘 via GitGitGadget
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style List information: http://vger.kernel.org/majordomo-info.html * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=xmqqftdbjkv8.fsf@gitster.c.googlers.com \ --to=gitster@pobox.com \ --cc=git@vger.kernel.org \ --cc=gitgitgadget@gmail.com \ --cc=johannes.schindelin@gmx.de \ --cc=peff@peff.net \ --subject='Re: [PATCH v2 1/2] Refactor code asking the user for input interactively' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Code repositories for project(s) associated with this inbox: https://80x24.org/mirrors/git.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).