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

Re: [RFC PATCH 2/3] connect: group CONNECT_DIAG_URL handling code

From
Torsten Bögershausen <tboegi@web.de>
Date
Apr 29, 2016, 20:00 UTC
Message-ID
<632a7629-645b-43a7-abd7-fcbc35362f60@web.de>
In-Reply-To
<1461890625-23222-2-git-send-email-mh@glandium.org>
On 29.04.16 02:43, Mike Hommey wrote:
> get_host_and_port(&ssh_host, &port);
> +			if (!port)
> +				port = get_port(ssh_host);
I'm not sure, if this is an improvement or not.

The original intention was, to check what the parser did, before going out to the external program (like ssh) or opening a socket.

Everything should be prepared, as if the action had been taken, and in the last nanosecond we jump out and print what would have been done. (The nanosecond may depend on the CPU speed)

In any case, for SSH there should be only one line calling get_host_and_port(), or get_port().

This is to check the complete logic path in test cases, as well as it allows the user to check the URL, especially when using SSH.

Splitting the logic into a path where we just print and one, where the connection is really made, looses "single point of truth" - we don't know any longer, what we test or print for diag.

Previous: Junio C HamanoNext: Mike Hommey
Message 13 of 15 in “git_connect: add some flexibility”
  1. 0/4 git_connect: add some flexibilityMike Hommey, Apr 28, 2016
  2. 1/4 git_connect: extend to take a pseudo format string for the program to runMike Hommey, Apr 28, 2016
  3. 2/4 git_connect: avoid quoting the path on the command line when it's not necessaryMike Hommey, Apr 28, 2016
  4. Stefan BellerApr 28, 2016
  5. 3/4 git_connect: allow a file descriptor to be allocated for stderrMike Hommey, Apr 28, 2016
  6. 4/4 git_connect: add a flag to consider the path part of ssh urls relativeMike Hommey, Apr 28, 2016
  7. Junio C HamanoApr 28, 2016
  8. Mike HommeyApr 28, 2016
  9. 1/3 connect: make parse_connect_url publicMike Hommey, Apr 29, 2016
  10. 2/3 connect: group CONNECT_DIAG_URL handling codeMike Hommey, Apr 29, 2016
  11. Junio C HamanoApr 29, 2016
  12. Junio C HamanoApr 29, 2016
  13. Torsten BögershausenApr 29, 2016
  14. 3/3 connect: move ssh command line preparation to a separate (public) functionMike Hommey, Apr 29, 2016
  15. Junio C HamanoApr 29, 2016

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.