threads / patch / 62030

v2compat/terminal: mark parameter of git_terminal_prompt() UNUSED

Subject: [PATCH v2] compat/terminal: mark parameter of git_terminal_prompt() UNUSED

## tl;dr

2 messages between Aug 31, 2024 and Sep 5, 2024. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Ramsay Jones· Aug 31, 2024, 14:58 UTC · lore

If neither HAVE_DEV_TTY nor GIT_WINDOWS_NATIVE is set, the fallback code calls the system getpass(). This unfortunately ignores the "echo" boolean parameter, as we have no way to implement that functionality. But we still have to keep the unused parameter, since our interface has to match the other implementations.

Co-authored-by: Jeff King <peff@peff.net>
Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
---
Hi,
Sorry for being a bit tardy with this, but I'm up-to-my-ears! :)

I feel a bit sheepish about taking authorship of this patch, since Jeff contributed way more than I did to the text! (I was going to count the words to get a better metric, but I have to go out now; if I don't send this now it will be tomorrow ...).

ATB, Ramsay Jones

 compat/terminal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to compat/terminal.c +1 −1
diff --git a/compat/terminal.c b/compat/terminal.c
index 0afda730f2..d54efa1c5d 100644
--- a/compat/terminal.c
+++ b/compat/terminal.c
@@ -594,7 +594,7 @@ void restore_term(void)
 {
 }
 
-char *git_terminal_prompt(const char *prompt, int echo)
+char *git_terminal_prompt(const char *prompt, int echo UNUSED)
 {
 	return getpass(prompt);
 }
-- 
2.46.0
Jeff King· Sep 5, 2024, 10:48 UTC · re: Ramsay Jones · lore

Re: [PATCH v2] compat/terminal: mark parameter of git_terminal_prompt() UNUSED

On Sat, Aug 31, 2024 at 03:58:56PM +0100, Ramsay Jones wrote:
> Sorry for being a bit tardy with this, but I'm up-to-my-ears! :)
Well, then I don't feel so bad about being late to respond. :)
> I feel a bit sheepish about taking authorship of this patch, since Jeff
> contributed way more than I did to the text! (I was going to count the
> words to get a better metric, but I have to go out now; if I don't send
> this now it will be tomorrow ...).

This looks great to me, and I think the authorship is fine as it is. The hard part IMHO was finding the problem in the first place!

-Peff

← back to recent threads