From f9dd4bf4e58af0b4828c7e7013080dba59f8a6b9 Mon Sep 17 00:00:00 2001 From: Dmitry Kakurin Date: Fri, 11 Jul 2008 18:48:16 +0200 Subject: [PATCH 1/3] Fixed text file auto-detection: treat EOF character 032 at the end of file as printable Signed-off-by: Dmitry Kakurin Signed-off-by: Steffen Prohaska Signed-off-by: Junio C Hamano --- convert.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/convert.c b/convert.c index 352b69d4ce..78efed800d 100644 --- a/convert.c +++ b/convert.c @@ -61,6 +61,10 @@ static void gather_stats(const char *buf, unsigned long size, struct text_stat * else stats->printable++; } + + /* If file ends with EOF then don't count this EOF as non-printable. */ + if (size >= 1 && buf[size-1] == '\032') + stats->nonprintable--; } /* From c4adea82c5064971ff6d090be8db89c44456186b Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 11 Jul 2008 18:55:57 +0200 Subject: [PATCH 2/3] Convert CR/LF to LF in tag signatures 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. It does so not only on Windows but on all platforms to keep the code simpler. [ spr: ported code to use strbuf ] Signed-off-by: Johannes Schindelin Signed-off-by: Steffen Prohaska Signed-off-by: Junio C Hamano --- builtin-tag.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/builtin-tag.c b/builtin-tag.c index 3c97c696a5..a70922b21c 100644 --- a/builtin-tag.c +++ b/builtin-tag.c @@ -202,6 +202,7 @@ static int do_sign(struct strbuf *buffer) const char *args[4]; char *bracket; int len; + int i, j; if (!*signingkey) { if (strlcpy(signingkey, git_committer_info(IDENT_ERROR_ON_NO_NAME), @@ -241,6 +242,15 @@ static int do_sign(struct strbuf *buffer) if (finish_command(&gpg) || !len || len < 0) return error("gpg failed to sign the tag"); + /* Strip CR from the line endings, in case we are on Windows. */ + 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); + return 0; } From fdfd20080239c8564e40498bbaae63c1b87ccdba Mon Sep 17 00:00:00 2001 From: Mike Pape Date: Fri, 11 Jul 2008 18:52:42 +0200 Subject: [PATCH 3/3] We need to check for msys as well as Windows in add--interactive. Signed-off-by: Mike Pape Signed-off-by: Steffen Prohaska Signed-off-by: Junio C Hamano --- git-add--interactive.perl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-add--interactive.perl b/git-add--interactive.perl index 903953e68e..78a64e6e8a 100755 --- a/git-add--interactive.perl +++ b/git-add--interactive.perl @@ -42,7 +42,7 @@ sub colored { my $patch_mode; sub run_cmd_pipe { - if ($^O eq 'MSWin32') { + if ($^O eq 'MSWin32' || $^O eq 'msys') { my @invalid = grep {m/[":*]/} @_; die "$^O does not support: @invalid\n" if @invalid; my @args = map { m/ /o ? "\"$_\"": $_ } @_;