From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
git@vger.kernel.org, Segev Finer <segev208@gmail.com>
Subject: Re: [PATCH] connect: handle putty/plink also in GIT_SSH_COMMAND
Date: Wed, 25 Jan 2017 17:40:43 -0500 [thread overview]
Message-ID: <20170125224043.jxjc4avuy4ztnkm4@sigill.intra.peff.net> (raw)
In-Reply-To: <xmqqinp2939j.fsf@gitster.mtv.corp.google.com>
On Wed, Jan 25, 2017 at 02:35:36PM -0800, Junio C Hamano wrote:
> -- >8 --
> Subject: [PATCH] connect: core.sshvariant to correct misidentification
I have been watching this discussion from the sidelines, and I agree
that this direction is a big improvement.
> +static void override_ssh_variant(int *port_option, int *needs_batch)
> +{
> + const char *variant;
> +
> + if (git_config_get_string_const("core.sshvariant", &variant))
> + return;
> + if (!strcmp(variant, "tortoiseplink")) {
> + *port_option = 'P';
> + *needs_batch = 1;
> + } else if (!strcmp(variant, "putty")) {
> + *port_option = 'P';
> + *needs_batch = 0;
> + } else {
> + /* default */
> + if (strcmp(variant, "ssh")) {
> + warning(_("core.sshvariant: unknown value '%s'"), variant);
> + warning(_("using OpenSSH compatible behaviour"));
> + }
> + *port_option = 'p';
> + *needs_batch = 0;
> + }
> +}
IIRC, the "const" in git_config_get_string_const is only about avoiding
an annoying cast. The result is still allocated and needs freed. Since
you are not keeping the value after the function returns, I think you
could just use git_config_get_value().
(Grepping around, I see a few other places that seem to make the same
mistake. I think this is a confusing interface that should probably be
fixed).
-Peff
next prev parent reply other threads:[~2017-01-25 22:40 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-02 12:09 [PATCH] connect: handle putty/plink also in GIT_SSH_COMMAND Johannes Schindelin
2017-01-08 2:33 ` Junio C Hamano
2017-01-09 1:08 ` Junio C Hamano
2017-01-09 7:46 ` Johannes Schindelin
2017-01-09 9:28 ` Junio C Hamano
2017-01-09 11:13 ` Johannes Schindelin
2017-01-09 14:19 ` Junio C Hamano
2017-01-25 12:34 ` Johannes Schindelin
2017-01-25 22:35 ` Junio C Hamano
2017-01-25 22:37 ` Junio C Hamano
2017-01-26 14:45 ` Johannes Schindelin
2017-01-25 22:40 ` Jeff King [this message]
2017-01-25 23:25 ` Junio C Hamano
2017-01-26 12:01 ` Johannes Schindelin
2017-01-26 14:51 ` [PATCH v2 0/3] Handle PuTTY (plink/tortoiseplink) even " Johannes Schindelin
[not found] ` <cover.1485442231.git.johannes.schindelin@gmx.de>
2017-01-26 14:51 ` [PATCH v2 1/3] connect: handle putty/plink also " Johannes Schindelin
2017-01-26 14:51 ` [PATCH v2 2/3] connect: rename tortoiseplink and putty variables Johannes Schindelin
2017-01-26 14:52 ` [PATCH v2 3/3] connect: Add the envvar GIT_SSH_VARIANT and ssh.variant config Johannes Schindelin
2017-01-26 19:27 ` Junio C Hamano
2017-01-27 10:35 ` Johannes Schindelin
2017-01-27 18:17 ` Junio C Hamano
2017-02-01 12:01 ` Johannes Schindelin
2017-02-01 16:53 ` Junio C Hamano
2017-02-01 11:57 ` [PATCH v3 0/4] Handle PuTTY (plink/tortoiseplink) even in GIT_SSH_COMMAND Johannes Schindelin
2017-02-01 12:01 ` [PATCH v3 1/4] connect: handle putty/plink also " Johannes Schindelin
2017-02-01 12:01 ` [PATCH v3 2/4] connect: rename tortoiseplink and putty variables Johannes Schindelin
2017-02-01 12:01 ` [PATCH v3 3/4] git_connect(): factor out SSH variant handling Johannes Schindelin
2017-02-01 12:01 ` [PATCH v3 4/4] connect: Add the envvar GIT_SSH_VARIANT and ssh.variant config Johannes Schindelin
2017-02-01 19:19 ` Junio C Hamano
2017-02-01 19:46 ` Junio C Hamano
2017-02-01 22:24 ` Johannes Schindelin
2017-02-01 22:33 ` Junio C Hamano
2017-02-01 22:42 ` Johannes Schindelin
2017-02-01 22:43 ` Junio C Hamano
2017-02-01 23:07 ` Johannes Schindelin
2017-02-01 20:07 ` [PATCH v3 0/4] Handle PuTTY (plink/tortoiseplink) even in GIT_SSH_COMMAND Junio C Hamano
2017-02-01 22:17 ` Johannes Schindelin
2017-02-01 22:55 ` Junio C Hamano
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=20170125224043.jxjc4avuy4ztnkm4@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=segev208@gmail.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public 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).