Skip to content

Commit d30438f

Browse files
dschoGit for Windows Build Agent
authored andcommitted
Merge branch 'msys2'
2 parents 4bdc079 + dba0bed commit d30438f

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
@@ -2545,6 +2545,9 @@ static void setup_windows_environment(void)
25452545
if (!tmp && (tmp = getenv("USERPROFILE")))
25462546
setenv("HOME", tmp, 1);
25472547
}
2548+
2549+
if (!getenv("LC_ALL") && !getenv("LC_CTYPE") && !getenv("LANG"))
2550+
setenv("LC_CTYPE", "C", 1);
25482551
}
25492552

25502553
int handle_long_path(wchar_t *path, int len, int max_path, int expand)

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"
@@ -194,6 +194,55 @@ static int mingw_getchar(void)
194194
}
195195
#define getchar mingw_getchar
196196

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

199248
#ifndef FORCE_TEXT
@@ -206,6 +255,15 @@ char *git_terminal_prompt(const char *prompt, int echo)
206255
int r;
207256
FILE *input_fh, *output_fh;
208257

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

gpg-interface.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -296,11 +296,9 @@ int sign_buffer(struct strbuf *buffer, struct strbuf *signature, const char *sig
296296
struct child_process gpg = CHILD_PROCESS_INIT;
297297
int ret;
298298
size_t i, j, bottom;
299-
struct strbuf gpg_status = STRBUF_INIT;
300299

301300
argv_array_pushl(&gpg.args,
302301
use_format->program,
303-
"--status-fd=2",
304302
"-bsau", signing_key,
305303
NULL);
306304

@@ -312,12 +310,10 @@ int sign_buffer(struct strbuf *buffer, struct strbuf *signature, const char *sig
312310
*/
313311
sigchain_push(SIGPIPE, SIG_IGN);
314312
ret = pipe_command(&gpg, buffer->buf, buffer->len,
315-
signature, 1024, &gpg_status, 0);
313+
signature, 1024, NULL, 0);
316314
sigchain_pop(SIGPIPE);
317315

318-
ret |= !strstr(gpg_status.buf, "\n[GNUPG:] SIG_CREATED ");
319-
strbuf_release(&gpg_status);
320-
if (ret)
316+
if (ret || signature->len == bottom)
321317
return error(_("gpg failed to sign the data"));
322318

323319
/* 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
@@ -1366,26 +1366,13 @@ test_expect_success GPG \
13661366
'test_config user.signingkey BobTheMouse &&
13671367
test_must_fail git tag -s -m tail tag-gpg-failure'
13681368

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

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

13911378
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)