* Re: [PATCH 06/12] connect: Fix custom ports with plink (Putty's ssh) @ 2008-07-03 3:07 Edward Z. Yang 2008-07-03 12:29 ` Johannes Schindelin 0 siblings, 1 reply; 10+ messages in thread From: Edward Z. Yang @ 2008-07-03 3:07 UTC (permalink / raw) To: git; +Cc: gitster, msysGit, junio Johannes Sixt wrote: > What about installing a wrapper script, plinkssh, that does this: > [snip] Well, the patch is shorter :-) Joking aside, it's a good question. I guess I prefer the patch because: 1. It's been tested, it works. I haven't tried the script yet, so I don't know if it works. 2. Git historically doesn't use bash, so the script would have to be rewritten in Perl or plain sh or tcl or something. 3. It's less brittle than the wrapper script if we decide to have Git pass more params to OpenSSH. 4. It's "more native". I don't know if these are compelling enough reasons, though. (cc'ed everyone else, whoops) ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 06/12] connect: Fix custom ports with plink (Putty's ssh) 2008-07-03 3:07 [PATCH 06/12] connect: Fix custom ports with plink (Putty's ssh) Edward Z. Yang @ 2008-07-03 12:29 ` Johannes Schindelin 2008-07-04 20:05 ` Edward Z. Yang 0 siblings, 1 reply; 10+ messages in thread From: Johannes Schindelin @ 2008-07-03 12:29 UTC (permalink / raw) To: Edward Z. Yang; +Cc: git, gitster, msysGit, junio Hi, On Wed, 2 Jul 2008, Edward Z. Yang wrote: > Johannes Sixt wrote: > > What about installing a wrapper script, plinkssh, that does this: > > [snip] > > Well, the patch is shorter :-) But you have to do it for every SSH backend that you might want to support. And you have to recompile. > 1. It's been tested, it works. I haven't tried the script yet, so I > don't know if it works. Sorry, that argument does not fly. "My patch is better, because I did not test your patch." > 2. Git historically doesn't use bash, so the script would have to be > rewritten in Perl or plain sh or tcl or something. That is so totally untrue. We have Perl scripts and Shell scripts (for which we need the bash), and then we have the two GUIs which use Tcl/Tk. Actually, we only have so few Perl scripts left that it might be possible to ship a version of Git on Windows without Perl. The only script that needs to be converted to a builtin is add -i. The rest of the scripts are shell. So this argument is totally bogus. > 3. It's less brittle than the wrapper script if we decide to have Git > pass more params to OpenSSH. Granted, should we decide one day to use more elaborate features of OpenSSH, then we would have to change the script, too. But most likely, Plink support would be broken by that update _anyway_, since it does not grok the OpenSSH options directly. And guess what is easier to fix, a script that rewrites the arguments from OpenSSH syntax to Plink syntax, or a C program with over 78,000 code lines that has to be recompiled? > 4. It's "more native". Would it not be even more native if we just linked in libssl? Would you write the patch? Further, would you like to convert and maintain all people's wrapper scripts to C code inside Git? BTW what is the reason why Hannes' mail does not appear to be the mail you replied to in GMane, but the patch Steffen sent? Ciao, Dscho ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 06/12] connect: Fix custom ports with plink (Putty's ssh) 2008-07-03 12:29 ` Johannes Schindelin @ 2008-07-04 20:05 ` Edward Z. Yang 0 siblings, 0 replies; 10+ messages in thread From: Edward Z. Yang @ 2008-07-04 20:05 UTC (permalink / raw) To: Johannes Schindelin; +Cc: msysGit, git, gitster, junio > Sorry, that argument does not fly. "My patch is better, because I did not > test your patch." Just tested, the patch works. > That is so totally untrue. We have Perl scripts and Shell scripts (for > which we need the bash), and then we have the two GUIs which use Tcl/Tk. I came up with that conclusion by grepping the Git source code for the word bash; no results. Granted, it's still a null point because the proposed script doesn't use any bash-specific features. > Further, would you like to convert and maintain all people's wrapper > scripts to C code inside Git? I was under the impression that wrapper scripts were for fleshing out new APIs and implementing non-performance critical functionality, without all the overhead of writing in C. There is little to no overhead from this patch. Anyway, Johannes still makes some pretty compelling points for the wrapper script, so you can count me +1 for the wrapper. > BTW what is the reason why Hannes' mail does not appear to be the mail > you replied to in GMane, but the patch Steffen sent? I actually did a "Reply" and so he was the only one who got the email at first. Then I resent it to the list, as well as the other CC'ed people. (Thus my comment at the bottom) ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to reduce remaining differences to 4msysgit? (was What's cooking in git.git (topics))
@ 2008-07-02 8:31 Steffen Prohaska
2008-07-02 8:32 ` [PATCH 01/12] Fake reencoding success under NO_ICONV instead of returning NULL Steffen Prohaska
0 siblings, 1 reply; 10+ messages in thread
From: Steffen Prohaska @ 2008-07-02 8:31 UTC (permalink / raw)
To: Johannes Sixt; +Cc: msysGit, Junio C Hamano, Git Mailing List
On Jun 30, 2008, at 8:47 PM, Johannes Sixt wrote:
> Then there are the extra patches in 4msysgit. From my POV, they are
> not
> _required_ because I can appearently work with git on Windows
> without them. I
> think some of them are not necessary. Can we go through them again?
I'll send a patch series in reply to this mail that contains the
following patches:
[PATCH 01/12] Fake reencoding success under NO_ICONV instead of
returning NULL.
[PATCH 02/12] Do not complain about "no common commits" in an empty
repo
[PATCH 03/12] MinGW: Convert CR/LF to LF in tag signatures
[PATCH 04/12] Avoid calling signal(SIGPIPE, ..) for MinGW builds.
[PATCH 05/12] Windows(msysgit): Per default, display help as HTML in
default browser
[PATCH 06/12] connect: Fix custom ports with plink (Putty's ssh)
[PATCH 07/12] Fixed text file auto-detection: treat EOF character
032 at the end of file as printable
[PATCH 08/12] fast-import: MinGW does not have getppid(). So do not
print it.
[PATCH 09/12] We need to check for msys as well as Windows in add--
interactive.
[PATCH 10/12] Add ANSI control code emulation for the Windows console
[PATCH 11/12] verify_path(): do not allow absolute paths
[PATCH 12/12] [TODO] setup: bring changes from 4msysgit/next to next
This series would bring *.{c,h,sh,perl} on Junio's next to 4msysgit/
next,
except for some minor differences (whitespace, comments, a workaround in
git-parse-remote.sh).
Steffen
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 01/12] Fake reencoding success under NO_ICONV instead of returning NULL. 2008-07-02 8:31 How to reduce remaining differences to 4msysgit? (was What's cooking in git.git (topics)) Steffen Prohaska @ 2008-07-02 8:32 ` Steffen Prohaska 2008-07-02 8:32 ` [PATCH 02/12] Do not complain about "no common commits" in an empty repo Steffen Prohaska 0 siblings, 1 reply; 10+ messages in thread From: Steffen Prohaska @ 2008-07-02 8:32 UTC (permalink / raw) To: Johannes Sixt Cc: git, msysgit, Junio C Hamano, Johannes Sixt, Steffen Prohaska From: Johannes Sixt <johannes.sixt@telecom.at> git-am when invoked from git-rebase seems to rely on successful conversion. Signed-off-by: Steffen Prohaska <prohaska@zib.de> --- utf8.c | 7 +++++++ utf8.h | 4 ---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/utf8.c b/utf8.c index dc37353..b07d43e 100644 --- a/utf8.c +++ b/utf8.c @@ -388,4 +388,11 @@ char *reencode_string(const char *in, const char *out_encoding, const char *in_e iconv_close(conv); return out; } +#else +char *reencode_string(const char *in, const char *out_encoding, const char *in_encoding) +{ + if (!in_encoding) + return NULL; + return xstrdup(in); +} #endif diff --git a/utf8.h b/utf8.h index 98cce1b..f22ef31 100644 --- a/utf8.h +++ b/utf8.h @@ -10,10 +10,6 @@ int is_encoding_utf8(const char *name); int print_wrapped_text(const char *text, int indent, int indent2, int len); -#ifndef NO_ICONV char *reencode_string(const char *in, const char *out_encoding, const char *in_encoding); -#else -#define reencode_string(a,b,c) NULL -#endif #endif -- 1.5.6.1.255.g32571 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 02/12] Do not complain about "no common commits" in an empty repo 2008-07-02 8:32 ` [PATCH 01/12] Fake reencoding success under NO_ICONV instead of returning NULL Steffen Prohaska @ 2008-07-02 8:32 ` Steffen Prohaska 2008-07-02 8:32 ` [PATCH 03/12] MinGW: Convert CR/LF to LF in tag signatures Steffen Prohaska 0 siblings, 1 reply; 10+ messages in thread From: Steffen Prohaska @ 2008-07-02 8:32 UTC (permalink / raw) To: Johannes Sixt Cc: git, msysgit, Junio C Hamano, Johannes Schindelin, Steffen Prohaska From: Johannes Schindelin <johannes.schindelin@gmx.de> If the repo is empty, we know that already, thank you very much. So shut fetch-pack up about that case. Fixes issue 3, too. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Steffen Prohaska <prohaska@zib.de> --- builtin-fetch-pack.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c index f4dbcf0..2175c6d 100644 --- a/builtin-fetch-pack.c +++ b/builtin-fetch-pack.c @@ -309,7 +309,8 @@ done: } flushes--; } - return retval; + /* it is no error to fetch into a completely empty repo */ + return count ? retval : 0; } static struct commit_list *complete; -- 1.5.6.1.255.g32571 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 03/12] MinGW: Convert CR/LF to LF in tag signatures 2008-07-02 8:32 ` [PATCH 02/12] Do not complain about "no common commits" in an empty repo Steffen Prohaska @ 2008-07-02 8:32 ` Steffen Prohaska 2008-07-02 8:32 ` [PATCH 04/12] Avoid calling signal(SIGPIPE, ..) for MinGW builds Steffen Prohaska 0 siblings, 1 reply; 10+ messages in thread From: Steffen Prohaska @ 2008-07-02 8:32 UTC (permalink / raw) To: Johannes Sixt Cc: git, msysgit, Junio C Hamano, Johannes Schindelin, Steffen Prohaska From: Johannes Schindelin <johannes.schindelin@gmx.de> On Windows, gpg outputs CR/LF signatures. But since the tag messages are already stripped of the CR by stripspace(), it is arguably nicer to do the same for the tag signature. Actually, this patch does not look for CR/LF, but strips all CRs from the signature. [ spr: ported code to use strbuf ] Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Steffen Prohaska <prohaska@zib.de> --- builtin-tag.c | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/builtin-tag.c b/builtin-tag.c index e675206..77977ba 100644 --- a/builtin-tag.c +++ b/builtin-tag.c @@ -241,6 +241,20 @@ static int do_sign(struct strbuf *buffer) if (finish_command(&gpg) || !len || len < 0) return error("gpg failed to sign the tag"); +#ifdef __MINGW32__ + /* strip CR from the line endings */ + { + int i, j; + for (i = j = 0; i < buffer->len; i++) + if (buffer->buf[i] != '\r') { + if (i != j) + buffer->buf[j] = buffer->buf[i]; + j++; + } + strbuf_setlen(buffer, j); + } +#endif + return 0; } -- 1.5.6.1.255.g32571 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 04/12] Avoid calling signal(SIGPIPE, ..) for MinGW builds. 2008-07-02 8:32 ` [PATCH 03/12] MinGW: Convert CR/LF to LF in tag signatures Steffen Prohaska @ 2008-07-02 8:32 ` Steffen Prohaska 2008-07-02 8:32 ` [PATCH 05/12] Windows(msysgit): Per default, display help as HTML in default browser Steffen Prohaska 0 siblings, 1 reply; 10+ messages in thread From: Steffen Prohaska @ 2008-07-02 8:32 UTC (permalink / raw) To: Johannes Sixt Cc: git, msysgit, Junio C Hamano, Marius Storm-Olsen, Steffen Prohaska From: Marius Storm-Olsen <mstormo_git@storm-olsen.com> SIGPIPE isn't supported in MinGW. Signed-off-by: Marius Storm-Olsen <mstormo_git@storm-olsen.com> Signed-off-by: Steffen Prohaska <prohaska@zib.de> --- builtin-verify-tag.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/builtin-verify-tag.c b/builtin-verify-tag.c index 92eaa89..540e3b9 100644 --- a/builtin-verify-tag.c +++ b/builtin-verify-tag.c @@ -100,9 +100,11 @@ int cmd_verify_tag(int argc, const char **argv, const char *prefix) i++; } +#ifndef __MINGW32__ /* sometimes the program was terminated because this signal * was received in the process of writing the gpg input: */ signal(SIGPIPE, SIG_IGN); +#endif while (i < argc) if (verify_tag(argv[i++], verbose)) had_error = 1; -- 1.5.6.1.255.g32571 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 05/12] Windows(msysgit): Per default, display help as HTML in default browser 2008-07-02 8:32 ` [PATCH 04/12] Avoid calling signal(SIGPIPE, ..) for MinGW builds Steffen Prohaska @ 2008-07-02 8:32 ` Steffen Prohaska 2008-07-02 8:32 ` [PATCH 06/12] connect: Fix custom ports with plink (Putty's ssh) Steffen Prohaska 0 siblings, 1 reply; 10+ messages in thread From: Steffen Prohaska @ 2008-07-02 8:32 UTC (permalink / raw) To: Johannes Sixt; +Cc: git, msysgit, Junio C Hamano, Steffen Prohaska The implementation directly calls the Win32 API to launch the browser. Note that the specific directory layout of msysgit is required. Signed-off-by: Steffen Prohaska <prohaska@zib.de> --- cache.h | 2 ++ help.c | 28 ++++++++++++++++++++++++++++ path.c | 13 +++++++++++++ 3 files changed, 43 insertions(+), 0 deletions(-) diff --git a/cache.h b/cache.h index 0d8edda..958d257 100644 --- a/cache.h +++ b/cache.h @@ -529,6 +529,8 @@ const char *make_nonrelative_path(const char *path); const char *make_relative_path(const char *abs, const char *base); int normalize_absolute_path(char *buf, const char *path); int longest_ancestor_length(const char *path, const char *prefix_list); +/* Convert slashes to backslashes on Windows. */ +char *make_native_separator(char *path); /* Read and unpack a sha1 file into memory, write memory to a sha1 file */ extern int sha1_object_info(const unsigned char *, unsigned long *); diff --git a/help.c b/help.c index ca9632b..811f8db 100644 --- a/help.c +++ b/help.c @@ -9,6 +9,7 @@ #include "common-cmds.h" #include "parse-options.h" #include "run-command.h" +#include "dir.h" static struct man_viewer_list { struct man_viewer_list *next; @@ -28,7 +29,11 @@ enum help_format { }; static int show_all = 0; +#ifdef __MINGW32__ +static enum help_format help_format = HELP_FORMAT_WEB; +#else static enum help_format help_format = HELP_FORMAT_MAN; +#endif static struct option builtin_help_options[] = { OPT_BOOLEAN('a', "all", &show_all, "print all available commands"), OPT_SET_INT('m', "man", &help_format, "show man page", HELP_FORMAT_MAN), @@ -644,12 +649,35 @@ static void get_html_page_path(struct strbuf *page_path, const char *page) static void show_html_page(const char *git_cmd) { +#ifdef __MINGW32__ + const char* exec_path = git_exec_path(); + char *htmlpath = make_native_separator( + mkpath("%s/../doc/git/html/%s.html" + , exec_path + , git_cmd) + ); + if (!file_exists(htmlpath)) { + htmlpath = make_native_separator( + mkpath("%s/../doc/git/html/git-%s.html" + , exec_path + , git_cmd) + ); + if (!file_exists(htmlpath)) { + fprintf(stderr, "Can't find HTML help for '%s'.\n" + , git_cmd); + exit(1); + } + } + printf("Launching default browser to display HTML help ...\n"); + ShellExecute(NULL, "open", htmlpath, NULL, "\\", 0); +#else const char *page = cmd_to_page(git_cmd); struct strbuf page_path; /* it leaks but we exec bellow */ get_html_page_path(&page_path, page); execl_git_cmd("web--browse", "-c", "help.browser", page_path.buf, NULL); +#endif } void help_unknown_cmd(const char *cmd) diff --git a/path.c b/path.c index 5983255..2a4a76a 100644 --- a/path.c +++ b/path.c @@ -439,3 +439,16 @@ int longest_ancestor_length(const char *path, const char *prefix_list) return max_len; } + +char *make_native_separator(char* path) { +#ifdef __MINGW32__ + char* c; + for (c = path; *c; c++) { + if (*c == '/') + *c = '\\'; + } + return path; +#else + return path; +#endif +} -- 1.5.6.1.255.g32571 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 06/12] connect: Fix custom ports with plink (Putty's ssh) 2008-07-02 8:32 ` [PATCH 05/12] Windows(msysgit): Per default, display help as HTML in default browser Steffen Prohaska @ 2008-07-02 8:32 ` Steffen Prohaska 2008-07-02 19:04 ` Johannes Sixt 0 siblings, 1 reply; 10+ messages in thread From: Steffen Prohaska @ 2008-07-02 8:32 UTC (permalink / raw) To: Johannes Sixt Cc: git, msysgit, Junio C Hamano, Edward Z. Yang, Steffen Prohaska From: Edward Z. Yang <edwardzyang@thewritingpot.com> PuTTY requires -P while OpenSSH requires -p; if plink is detected as GIT_SSH, use the alternate flag. Signed-off-by: Edward Z. Yang <edwardzyang@thewritingpot.com> Signed-off-by: Steffen Prohaska <prohaska@zib.de> --- connect.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/connect.c b/connect.c index 574f42f..0d007f3 100644 --- a/connect.c +++ b/connect.c @@ -599,11 +599,13 @@ struct child_process *git_connect(int fd[2], const char *url_orig, conn->argv = arg = xcalloc(6, sizeof(*arg)); if (protocol == PROTO_SSH) { const char *ssh = getenv("GIT_SSH"); + int putty = ssh && strstr(ssh, "plink"); if (!ssh) ssh = "ssh"; *arg++ = ssh; if (port) { - *arg++ = "-p"; + /* P is for PuTTY, p is for OpenSSH */ + *arg++ = putty ? "-P" : "-p"; *arg++ = port; } *arg++ = host; -- 1.5.6.1.255.g32571 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 06/12] connect: Fix custom ports with plink (Putty's ssh) 2008-07-02 8:32 ` [PATCH 06/12] connect: Fix custom ports with plink (Putty's ssh) Steffen Prohaska @ 2008-07-02 19:04 ` Johannes Sixt 2008-07-03 11:10 ` Johannes Schindelin 2008-07-04 9:18 ` Junio C Hamano 0 siblings, 2 replies; 10+ messages in thread From: Johannes Sixt @ 2008-07-02 19:04 UTC (permalink / raw) To: prohaska; +Cc: msysGit, git, Junio C Hamano, Edward Z. Yang On Mittwoch, 2. Juli 2008, Steffen Prohaska wrote: > From: Edward Z. Yang <edwardzyang@thewritingpot.com> > > PuTTY requires -P while OpenSSH requires -p; if plink is detected > as GIT_SSH, use the alternate flag. > > Signed-off-by: Edward Z. Yang <edwardzyang@thewritingpot.com> > Signed-off-by: Steffen Prohaska <prohaska@zib.de> > --- > connect.c | 4 +++- > 1 files changed, 3 insertions(+), 1 deletions(-) > > diff --git a/connect.c b/connect.c > index 574f42f..0d007f3 100644 > --- a/connect.c > +++ b/connect.c > @@ -599,11 +599,13 @@ struct child_process *git_connect(int fd[2], const > char *url_orig, conn->argv = arg = xcalloc(6, sizeof(*arg)); > if (protocol == PROTO_SSH) { > const char *ssh = getenv("GIT_SSH"); > + int putty = ssh && strstr(ssh, "plink"); > if (!ssh) ssh = "ssh"; > > *arg++ = ssh; > if (port) { > - *arg++ = "-p"; > + /* P is for PuTTY, p is for OpenSSH */ > + *arg++ = putty ? "-P" : "-p"; > *arg++ = port; > } > *arg++ = host; What about installing a wrapper script, plinkssh, that does this: #!/bin/bash if test "$1" = -p; then port="-P $2" shift; shift fi exec plink $port "$@" and require plink users to set GIT_SSH=plinkssh? -- Hannes ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 06/12] connect: Fix custom ports with plink (Putty's ssh) 2008-07-02 19:04 ` Johannes Sixt @ 2008-07-03 11:10 ` Johannes Schindelin 2008-07-04 8:50 ` Steffen Prohaska 2008-07-04 9:18 ` Junio C Hamano 1 sibling, 1 reply; 10+ messages in thread From: Johannes Schindelin @ 2008-07-03 11:10 UTC (permalink / raw) To: Johannes Sixt; +Cc: prohaska, msysGit, git, Junio C Hamano, Edward Z. Yang Hi, On Wed, 2 Jul 2008, Johannes Sixt wrote: > On Mittwoch, 2. Juli 2008, Steffen Prohaska wrote: > > From: Edward Z. Yang <edwardzyang@thewritingpot.com> > > > > PuTTY requires -P while OpenSSH requires -p; if plink is detected > > as GIT_SSH, use the alternate flag. > > > > Signed-off-by: Edward Z. Yang <edwardzyang@thewritingpot.com> > > Signed-off-by: Steffen Prohaska <prohaska@zib.de> > > --- > > connect.c | 4 +++- > > 1 files changed, 3 insertions(+), 1 deletions(-) > > > > diff --git a/connect.c b/connect.c > > index 574f42f..0d007f3 100644 > > --- a/connect.c > > +++ b/connect.c > > @@ -599,11 +599,13 @@ struct child_process *git_connect(int fd[2], const > > char *url_orig, conn->argv = arg = xcalloc(6, sizeof(*arg)); > > if (protocol == PROTO_SSH) { > > const char *ssh = getenv("GIT_SSH"); > > + int putty = ssh && strstr(ssh, "plink"); > > if (!ssh) ssh = "ssh"; > > > > *arg++ = ssh; > > if (port) { > > - *arg++ = "-p"; > > + /* P is for PuTTY, p is for OpenSSH */ > > + *arg++ = putty ? "-P" : "-p"; > > *arg++ = port; > > } > > *arg++ = host; > > What about installing a wrapper script, plinkssh, that does this: > > #!/bin/bash > > if test "$1" = -p; then > port="-P $2" > shift; shift > fi > > exec plink $port "$@" > > and require plink users to set GIT_SSH=plinkssh? I like that better than this special-casing of plink. Ciao, Dscho ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 06/12] connect: Fix custom ports with plink (Putty's ssh) 2008-07-03 11:10 ` Johannes Schindelin @ 2008-07-04 8:50 ` Steffen Prohaska 0 siblings, 0 replies; 10+ messages in thread From: Steffen Prohaska @ 2008-07-04 8:50 UTC (permalink / raw) To: Johannes Schindelin Cc: Johannes Sixt, msysGit, git, Junio C Hamano, Edward Z. Yang On Jul 3, 2008, at 1:10 PM, Johannes Schindelin wrote: > On Wed, 2 Jul 2008, Johannes Sixt wrote: > >> On Mittwoch, 2. Juli 2008, Steffen Prohaska wrote: >>> From: Edward Z. Yang <edwardzyang@thewritingpot.com> >>> >>> PuTTY requires -P while OpenSSH requires -p; if plink is detected >>> as GIT_SSH, use the alternate flag. >>> >>> Signed-off-by: Edward Z. Yang <edwardzyang@thewritingpot.com> >>> Signed-off-by: Steffen Prohaska <prohaska@zib.de> >>> --- >>> connect.c | 4 +++- >>> 1 files changed, 3 insertions(+), 1 deletions(-) >>> >>> diff --git a/connect.c b/connect.c >>> index 574f42f..0d007f3 100644 >>> --- a/connect.c >>> +++ b/connect.c >>> @@ -599,11 +599,13 @@ struct child_process *git_connect(int fd[2], >>> const >>> char *url_orig, conn->argv = arg = xcalloc(6, sizeof(*arg)); >>> if (protocol == PROTO_SSH) { >>> const char *ssh = getenv("GIT_SSH"); >>> + int putty = ssh && strstr(ssh, "plink"); >>> if (!ssh) ssh = "ssh"; >>> >>> *arg++ = ssh; >>> if (port) { >>> - *arg++ = "-p"; >>> + /* P is for PuTTY, p is for OpenSSH */ >>> + *arg++ = putty ? "-P" : "-p"; >>> *arg++ = port; >>> } >>> *arg++ = host; >> >> What about installing a wrapper script, plinkssh, that does this: >> >> #!/bin/bash >> >> if test "$1" = -p; then >> port="-P $2" >> shift; shift >> fi >> >> exec plink $port "$@" >> >> and require plink users to set GIT_SSH=plinkssh? > > I like that better than this special-casing of plink. I'd prefer to change connect.c. plinkssh would introduce another dependency on the shell, while our overall goal is to avoid shell as much as possible on Windows, no? Edward's solution also looks more obvious to me than the plinkssh wrapper script. Steffen ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 06/12] connect: Fix custom ports with plink (Putty's ssh) 2008-07-02 19:04 ` Johannes Sixt 2008-07-03 11:10 ` Johannes Schindelin @ 2008-07-04 9:18 ` Junio C Hamano 2008-07-04 9:29 ` Steffen Prohaska 1 sibling, 1 reply; 10+ messages in thread From: Junio C Hamano @ 2008-07-04 9:18 UTC (permalink / raw) To: johannes.sixt; +Cc: prohaska, msysGit, git, Edward Z. Yang Johannes Sixt <johannes.sixt@telecom.at> writes: > What about installing a wrapper script, plinkssh, that does this: > > #!/bin/bash > > if test "$1" = -p; then > port="-P $2" > shift; shift > fi > > exec plink $port "$@" > > and require plink users to set GIT_SSH=plinkssh? That's quite a nice solution with absolute minimum impact. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 06/12] connect: Fix custom ports with plink (Putty's ssh) 2008-07-04 9:18 ` Junio C Hamano @ 2008-07-04 9:29 ` Steffen Prohaska 2008-07-04 16:09 ` Clifford Caoile 0 siblings, 1 reply; 10+ messages in thread From: Steffen Prohaska @ 2008-07-04 9:29 UTC (permalink / raw) To: Junio C Hamano; +Cc: johannes.sixt, msysGit, git, Edward Z. Yang On Jul 4, 2008, at 11:18 AM, Junio C Hamano wrote: > Johannes Sixt <johannes.sixt@telecom.at> writes: > >> What about installing a wrapper script, plinkssh, that does this: >> >> #!/bin/bash >> >> if test "$1" = -p; then >> port="-P $2" >> shift; shift >> fi >> >> exec plink $port "$@" >> >> and require plink users to set GIT_SSH=plinkssh? > > That's quite a nice solution with absolute minimum impact. It has minimum impact on the source code of git. The same is not true, however, for the git user and the installer on Windows: - The proposed plinkssh requires that plink is in the PATH. This is not necessarily the case on Windows. If plink is not in the PATH, then the user needs to modify plinkssh. - The msysgit installer supports setting GIT_SSH to the full path of plink. It automatically detects this path based on Putty's entries in the Windows registry. If we choose the plinkssh solution the installer has to be modified. Setting '-P' in connect.c would have some impact on the git source, but would avoid changes elsewhere. Steffen ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 06/12] connect: Fix custom ports with plink (Putty's ssh) 2008-07-04 9:29 ` Steffen Prohaska @ 2008-07-04 16:09 ` Clifford Caoile 0 siblings, 0 replies; 10+ messages in thread From: Clifford Caoile @ 2008-07-04 16:09 UTC (permalink / raw) To: prohaska; +Cc: Junio C Hamano, johannes.sixt, msysGit, git, Edward Z. Yang Hi: On Fri, Jul 4, 2008 at 6:29 PM, Steffen Prohaska <prohaska@zib.de> wrote: > > On Jul 4, 2008, at 11:18 AM, Junio C Hamano wrote: > >> Johannes Sixt <johannes.sixt@telecom.at> writes: >> >>> What about installing a wrapper script, plinkssh, that does this: >> >> That's quite a nice solution with absolute minimum impact. > > It has minimum impact on the source code of git. The same is not > true, however, for the git user and the installer on Windows: > > - The proposed plinkssh requires that plink is in the PATH. This is > not necessarily the case on Windows. If plink is not in the PATH, > then the user needs to modify plinkssh. > > - The msysgit installer supports setting GIT_SSH to the full path > of plink. It automatically detects this path based on Putty's > entries in the Windows registry. If we choose the plinkssh > solution the installer has to be modified. How about we create one more global environment variable MSYSGIT_REAL_PLINK which points to the Windows plink during installation? Then we set the GIT_SSH to the plinkssh, and the proposed plinkssh can point to MSYSGIT_REAL_PLINK? + # fall back to plink if MSYSGIT_REAL_PLINK is not defined + # and hope plink is in the path + plink=${MSYSGIT_REAL_PLINK:-plink} - exec plink $port "$@" + exec ${plink} $port "$@" Perhaps I have traded one problem for another, because the msysgit user still has to be aware of MSYSGIT_REAL_PLINK (at least she doesn't have to set it up). And of course, the installer has to be modified to accommodate plinkssh and my proposal. Best regards, Clifford Caoile ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2008-07-04 20:07 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-07-03 3:07 [PATCH 06/12] connect: Fix custom ports with plink (Putty's ssh) Edward Z. Yang 2008-07-03 12:29 ` Johannes Schindelin 2008-07-04 20:05 ` Edward Z. Yang -- strict thread matches above, loose matches on Subject: below -- 2008-07-02 8:31 How to reduce remaining differences to 4msysgit? (was What's cooking in git.git (topics)) Steffen Prohaska 2008-07-02 8:32 ` [PATCH 01/12] Fake reencoding success under NO_ICONV instead of returning NULL Steffen Prohaska 2008-07-02 8:32 ` [PATCH 02/12] Do not complain about "no common commits" in an empty repo Steffen Prohaska 2008-07-02 8:32 ` [PATCH 03/12] MinGW: Convert CR/LF to LF in tag signatures Steffen Prohaska 2008-07-02 8:32 ` [PATCH 04/12] Avoid calling signal(SIGPIPE, ..) for MinGW builds Steffen Prohaska 2008-07-02 8:32 ` [PATCH 05/12] Windows(msysgit): Per default, display help as HTML in default browser Steffen Prohaska 2008-07-02 8:32 ` [PATCH 06/12] connect: Fix custom ports with plink (Putty's ssh) Steffen Prohaska 2008-07-02 19:04 ` Johannes Sixt 2008-07-03 11:10 ` Johannes Schindelin 2008-07-04 8:50 ` Steffen Prohaska 2008-07-04 9:18 ` Junio C Hamano 2008-07-04 9:29 ` Steffen Prohaska 2008-07-04 16:09 ` Clifford Caoile
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 NNTP newsgroup(s).