git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[RFC PATCH] config.mak.uname: add HAVE_DEV_TTY to cygwin config section

From
Ramsay Jones <ramsay@ramsayjones.plus.com>
Date
Sep 2, 2024, 22:15 UTC
Message-ID
<a59f53af-58f7-42f5-aefb-50a4d9f344c4@ramsayjones.plus.com>
Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
---
Hi,

I found a few minutes to try building with HAVE_DEV_TTY on cygwin tonight and had a quick test:

  $ printf "%s\n" protocol=https host=example.com path=git | ./git credential fill
  Username for 'https://example.com': user
  Password for 'https://user@example.com': 
  protocol=https
  host=example.com
  username=user
  password=pass
  $ 

So, that seems to work. Actually, when I first tried, it didn't work at all, because I typed 'git credential ...' not './git credential ...'! :)

Also, somewhat surprising, is that job control also works:
  $ printf "%s\n" protocol=https host=example.com path=git | ./git credential fill
  Username for 'https://example.com': 
  [1]+  Stopped                 printf "%s\n" protocol=https host=example.com path=git | ./git credential fill
  $ echo hhh
  hhh
  $ fg
  printf "%s\n" protocol=https host=example.com path=git | ./git credential fill
  user
  Password for 'https://user@example.com': 
  protocol=https
  host=example.com
  username=user
  password=pass
  $ 

The only difference between Linux and cygwin seems to be that cygwin does not echo ^Z when back-grounding.

Still, I need to do a full test suite run, just to check for any regressions. (Unfortunately, that takes about 6 hours to run, so I can't get to that soon).

Also, I should check other uses of these routines:
  $ git grep -n read_key_without_echo
  add-patch.c:1226:               int res = read_key_without_echo(&s->answer);
  compat/terminal.c:535:int read_key_without_echo(struct strbuf *buf)
  compat/terminal.c:602:int read_key_without_echo(struct strbuf *buf)
  compat/terminal.h:25:int read_key_without_echo(struct strbuf *buf);
  $ 
  $ git grep -n git_terminal_prompt
  compat/terminal.c:428:char *git_terminal_prompt(const char *prompt, int echo)
  compat/terminal.c:597:char *git_terminal_prompt(const char *prompt, int echo UNUSED)
  compat/terminal.h:22:char *git_terminal_prompt(const char *prompt, int echo);
  prompt.c:65:                    r = git_terminal_prompt(prompt, flags & PROMPT_ECHO);
  $ 
  $ git grep -n git_prompt
  builtin/bisect.c:401:           yesno = git_prompt(_("Are you sure [Y/n]? "), PROMPT_ECHO);
  builtin/bisect.c:913:   yesno = git_prompt(_("Do you want me to do it for you "
  credential.c:247:       r = git_prompt(prompt.buf, flags);
  help.c:712:                     answer = git_prompt(msg.buf, PROMPT_ECHO);
  prompt.c:45:char *git_prompt(const char *prompt, int flags)
  prompt.h:7:char *git_prompt(const char *prompt, int flags);
  $ 
  
So, 'add-patch', bisect and help (in addition to git-credential).

[Note: save_term() and restore_term() are not called outside of that TU, so they could be marked static!]

Anyhow, just a quick heads up.

ATB, Ramsay Jones

 config.mak.uname | 1 +
 1 file changed, 1 insertion(+)
diff --git a/config.mak.uname b/config.mak.uname
index d0cb2b8244..693dcd4714 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -250,6 +250,7 @@ ifeq ($(uname_O),Cygwin)
         else
 		NO_REGEX = UnfortunatelyYes
         endif
+	HAVE_DEV_TTY = YesPlease
 	HAVE_ALLOCA_H = YesPlease
 	NEEDS_LIBICONV = YesPlease
 	NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes
-- 
2.46.0
Next: Jeff King
Message 1 of 5 in “config.mak.uname: add HAVE_DEV_TTY to cygwin config section”
  1. config.mak.uname: add HAVE_DEV_TTY to cygwin config sectionRamsay Jones, Sep 2, 2024
  2. Jeff KingSep 5, 2024
  3. Ramsay JonesSep 6, 2024
  4. Jeff KingSep 7, 2024
  5. Ramsay JonesSep 7, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.