Skip to content

Commit 920d963

Browse files
dschoGit for Windows Build Agent
authored andcommitted
Merge branch 'msys2'
2 parents 67b45f3 + 72695a5 commit 920d963

File tree

5 files changed

+70
-20
lines changed

5 files changed

+70
-20
lines changed

compat/mingw.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2758,6 +2758,9 @@ static void setup_windows_environment(void)
27582758
if (!tmp && (tmp = getenv("USERPROFILE")))
27592759
setenv("HOME", tmp, 1);
27602760
}
2761+
2762+
if (!getenv("LC_ALL") && !getenv("LC_CTYPE") && !getenv("LANG"))
2763+
setenv("LC_CTYPE", "C", 1);
27612764
}
27622765

27632766
int is_valid_win32_path(const char *path, int allow_literal_nul)

compat/terminal.c

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "git-compat-util.h"
1+
#include "cache.h"
22
#include "compat/terminal.h"
33
#include "sigchain.h"
44
#include "strbuf.h"
@@ -193,6 +193,55 @@ static int mingw_getchar(void)
193193
}
194194
#define getchar mingw_getchar
195195

196+
static char *shell_prompt(const char *prompt, int echo)
197+
{
198+
const char *read_input[] = {
199+
/* Note: call 'bash' explicitly, as 'read -s' is bash-specific */
200+
"bash", "-c", echo ?
201+
"cat >/dev/tty && read -r line </dev/tty && echo \"$line\"" :
202+
"cat >/dev/tty && read -r -s line </dev/tty && echo \"$line\" && echo >/dev/tty",
203+
NULL
204+
};
205+
struct child_process child = CHILD_PROCESS_INIT;
206+
static struct strbuf buffer = STRBUF_INIT;
207+
int prompt_len = strlen(prompt), len = -1, code;
208+
209+
child.argv = read_input;
210+
child.in = -1;
211+
child.out = -1;
212+
child.silent_exec_failure = 1;
213+
214+
if (start_command(&child))
215+
return NULL;
216+
217+
if (write_in_full(child.in, prompt, prompt_len) != prompt_len) {
218+
error("could not write to prompt script");
219+
close(child.in);
220+
goto ret;
221+
}
222+
close(child.in);
223+
224+
strbuf_reset(&buffer);
225+
len = strbuf_read(&buffer, child.out, 1024);
226+
if (len < 0) {
227+
error("could not read from prompt script");
228+
goto ret;
229+
}
230+
231+
strbuf_strip_suffix(&buffer, "\n");
232+
strbuf_strip_suffix(&buffer, "\r");
233+
234+
ret:
235+
close(child.out);
236+
code = finish_command(&child);
237+
if (code) {
238+
error("failed to execute prompt script (exit code %d)", code);
239+
return NULL;
240+
}
241+
242+
return len < 0 ? NULL : buffer.buf;
243+
}
244+
196245
#endif
197246

198247
#ifndef FORCE_TEXT
@@ -205,6 +254,15 @@ char *git_terminal_prompt(const char *prompt, int echo)
205254
int r;
206255
FILE *input_fh, *output_fh;
207256

257+
#ifdef GIT_WINDOWS_NATIVE
258+
259+
/* try shell_prompt first, fall back to CONIN/OUT if bash is missing */
260+
char *result = shell_prompt(prompt, echo);
261+
if (result)
262+
return result;
263+
264+
#endif
265+
208266
input_fh = fopen(INPUT_PATH, "r" FORCE_TEXT);
209267
if (!input_fh)
210268
return NULL;

gpg-interface.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -432,11 +432,9 @@ int sign_buffer(struct strbuf *buffer, struct strbuf *signature, const char *sig
432432
struct child_process gpg = CHILD_PROCESS_INIT;
433433
int ret;
434434
size_t i, j, bottom;
435-
struct strbuf gpg_status = STRBUF_INIT;
436435

437436
argv_array_pushl(&gpg.args,
438437
use_format->program,
439-
"--status-fd=2",
440438
"-bsau", signing_key,
441439
NULL);
442440

@@ -448,12 +446,10 @@ int sign_buffer(struct strbuf *buffer, struct strbuf *signature, const char *sig
448446
*/
449447
sigchain_push(SIGPIPE, SIG_IGN);
450448
ret = pipe_command(&gpg, buffer->buf, buffer->len,
451-
signature, 1024, &gpg_status, 0);
449+
signature, 1024, NULL, 0);
452450
sigchain_pop(SIGPIPE);
453451

454-
ret |= !strstr(gpg_status.buf, "\n[GNUPG:] SIG_CREATED ");
455-
strbuf_release(&gpg_status);
456-
if (ret)
452+
if (ret || signature->len == bottom)
457453
return error(_("gpg failed to sign the data"));
458454

459455
/* Strip CR from the line endings, in case we are on Windows. */

t/t7004-tag.sh

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,26 +1365,13 @@ test_expect_success GPG \
13651365
'test_config user.signingkey BobTheMouse &&
13661366
test_must_fail git tag -s -m tail tag-gpg-failure'
13671367

1368-
# try to produce invalid signature
1369-
test_expect_success GPG \
1370-
'git tag -s fails if gpg is misconfigured (bad signature format)' \
1371-
'test_config gpg.program echo &&
1372-
test_must_fail git tag -s -m tail tag-gpg-failure'
1373-
13741368
# try to sign with bad user.signingkey
13751369
test_expect_success GPGSM \
13761370
'git tag -s fails if gpgsm is misconfigured (bad key)' \
13771371
'test_config user.signingkey BobTheMouse &&
13781372
test_config gpg.format x509 &&
13791373
test_must_fail git tag -s -m tail tag-gpg-failure'
13801374

1381-
# try to produce invalid signature
1382-
test_expect_success GPGSM \
1383-
'git tag -s fails if gpgsm is misconfigured (bad signature format)' \
1384-
'test_config gpg.x509.program echo &&
1385-
test_config gpg.format x509 &&
1386-
test_must_fail git tag -s -m tail tag-gpg-failure'
1387-
13881375
# try to verify without gpg:
13891376

13901377
rm -rf gpghome

t/t9020-remote-svn.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ then
1212
test_done
1313
fi
1414

15+
if test_have_prereq MINGW
16+
then
17+
skip_all='skipping remote-svn tests for lack of POSIX'
18+
test_done
19+
fi
20+
1521
# Override svnrdump with our simulator
1622
PATH="$HOME:$PATH"
1723
export PATH PYTHON_PATH GIT_BUILD_DIR

0 commit comments

Comments
 (0)