Skip to content

Commit 223bb84

Browse files
committed
Merge branch 'sp/win'
* 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
2 parents 1466080 + fdfd200 commit 223bb84

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

builtin-tag.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ static int do_sign(struct strbuf *buffer)
202202
const char *args[4];
203203
char *bracket;
204204
int len;
205+
int i, j;
205206

206207
if (!*signingkey) {
207208
if (strlcpy(signingkey, git_committer_info(IDENT_ERROR_ON_NO_NAME),
@@ -241,6 +242,15 @@ static int do_sign(struct strbuf *buffer)
241242
if (finish_command(&gpg) || !len || len < 0)
242243
return error("gpg failed to sign the tag");
243244

245+
/* Strip CR from the line endings, in case we are on Windows. */
246+
for (i = j = 0; i < buffer->len; i++)
247+
if (buffer->buf[i] != '\r') {
248+
if (i != j)
249+
buffer->buf[j] = buffer->buf[i];
250+
j++;
251+
}
252+
strbuf_setlen(buffer, j);
253+
244254
return 0;
245255
}
246256

convert.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ static void gather_stats(const char *buf, unsigned long size, struct text_stat *
6161
else
6262
stats->printable++;
6363
}
64+
65+
/* If file ends with EOF then don't count this EOF as non-printable. */
66+
if (size >= 1 && buf[size-1] == '\032')
67+
stats->nonprintable--;
6468
}
6569

6670
/*

git-add--interactive.perl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ sub colored {
5454
my $patch_mode;
5555

5656
sub run_cmd_pipe {
57-
if ($^O eq 'MSWin32') {
57+
if ($^O eq 'MSWin32' || $^O eq 'msys') {
5858
my @invalid = grep {m/[":*]/} @_;
5959
die "$^O does not support: @invalid\n" if @invalid;
6060
my @args = map { m/ /o ? "\"$_\"": $_ } @_;

0 commit comments

Comments
 (0)