Skip to content

Commit

Permalink
Merge branch 'sp/win'
Browse files Browse the repository at this point in the history
* sp/win:
  We need to check for msys as well as Windows in add--interactive.
  Convert CR/LF to LF in tag signatures
  Fixed text file auto-detection: treat EOF character 032 at the end of file as printable
  • Loading branch information
Junio C Hamano committed Jul 16, 2008
2 parents 1466080 + fdfd200 commit 223bb84
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
10 changes: 10 additions & 0 deletions builtin-tag.c
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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;
}

Expand Down
4 changes: 4 additions & 0 deletions convert.c
Original file line number Diff line number Diff line change
Expand Up @@ -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--;
}

/*
Expand Down
2 changes: 1 addition & 1 deletion git-add--interactive.perl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,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 ? "\"$_\"": $_ } @_;
Expand Down

0 comments on commit 223bb84

Please sign in to comment.