Skip to content

Commit 1e82256

Browse files
committed
Merge branch 'misc-patches'
# Conflicts: # compat/mingw.c
2 parents 37d28e2 + 898c264 commit 1e82256

17 files changed

Lines changed: 79 additions & 22 deletions

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3667,6 +3667,13 @@ endif
36673667
ln "$$execdir/git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
36683668
ln -s "git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
36693669
cp "$$execdir/git-remote-http$X" "$$execdir/$$p" || exit; } \
3670+
done && \
3671+
remote_curl_names="$(REMOTE_CURL_NAMES)" && \
3672+
for p in $$remote_curl_names; do \
3673+
$(RM) "$$bindir/$$p" && \
3674+
{ ln "$$execdir/$$p" "$$bindir/$$p" 2>/dev/null || \
3675+
ln -s "$$execdir/$$p" "$$bindir/$$p" 2>/dev/null || \
3676+
cp "$$execdir/$$p" "$$bindir/$$p" || exit; } \
36703677
done
36713678

36723679
.PHONY: install-doc install-man install-man-perl install-html install-info install-pdf

builtin/update-ref.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ static const char *parse_arg(const char *next, struct strbuf *arg)
4848
return next;
4949
}
5050

51+
static const char *skip_trailing_space(const char *next)
52+
{
53+
if (line_termination)
54+
while (*next && *next != line_termination && isspace(*next))
55+
next++;
56+
return next;
57+
}
58+
5159
/*
5260
* Parse the reference name immediately after "command SP". If not
5361
* -z, then handle C-quoting. Return a pointer to a newly allocated
@@ -264,6 +272,7 @@ static void parse_cmd_update(struct ref_transaction *transaction,
264272
have_old = !parse_next_oid(&next, end, &old_oid, "update", refname,
265273
PARSE_SHA1_OLD);
266274

275+
next = skip_trailing_space(next);
267276
if (*next != line_termination)
268277
die("update %s: extra input: %s", refname, next);
269278

@@ -352,6 +361,7 @@ static void parse_cmd_create(struct ref_transaction *transaction,
352361
if (is_null_oid(&new_oid))
353362
die("create %s: zero <new-oid>", refname);
354363

364+
next = skip_trailing_space(next);
355365
if (*next != line_termination)
356366
die("create %s: extra input: %s", refname, next);
357367

compat/mingw.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ enum hide_dotfiles_type {
244244
HIDE_DOTFILES_DOTGITONLY
245245
};
246246

247-
static enum hide_dotfiles_type hide_dotfiles = HIDE_DOTFILES_DOTGITONLY;
247+
static enum hide_dotfiles_type hide_dotfiles = HIDE_DOTFILES_FALSE;
248248
static char *unset_environment_variables;
249249

250250
int mingw_core_config(const char *var, const char *value,
@@ -2777,7 +2777,7 @@ static void setup_windows_environment(void)
27772777

27782778
/* simulate TERM to enable auto-color (see color.c) */
27792779
if (!getenv("TERM"))
2780-
setenv("TERM", "cygwin", 1);
2780+
setenv("TERM", "xterm-256color", 1);
27812781

27822782
/* calculate HOME if not set */
27832783
if (!getenv("HOME")) {

compat/snprintf.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ int git_vsnprintf(char *str, size_t maxsize, const char *format, va_list ap)
2222
va_list cp;
2323
char *s;
2424
int ret = -1;
25+
int save_errno = errno;
2526

2627
if (maxsize > 0) {
2728
va_copy(cp, ap);
@@ -33,7 +34,7 @@ int git_vsnprintf(char *str, size_t maxsize, const char *format, va_list ap)
3334
str[maxsize-1] = 0;
3435
}
3536
if (ret != -1)
36-
return ret;
37+
goto out;
3738

3839
s = NULL;
3940
if (maxsize < 128)
@@ -42,8 +43,10 @@ int git_vsnprintf(char *str, size_t maxsize, const char *format, va_list ap)
4243
while (ret == -1) {
4344
maxsize *= 4;
4445
str = realloc(s, maxsize);
45-
if (! str)
46+
if (!str) {
47+
save_errno = ENOMEM;
4648
break;
49+
}
4750
s = str;
4851
va_copy(cp, ap);
4952
ret = vsnprintf(str, maxsize-SNPRINTF_SIZE_CORR, format, cp);
@@ -52,6 +55,8 @@ int git_vsnprintf(char *str, size_t maxsize, const char *format, va_list ap)
5255
ret = -1;
5356
}
5457
free(s);
58+
out:
59+
errno = save_errno;
5560
return ret;
5661
}
5762

path.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,17 +1436,19 @@ int daemon_avoid_alias(const char *p)
14361436
* be true as long as dots continue after that without intervening
14371437
* non-dot character.
14381438
*/
1439-
if (!p || (*p != '/' && *p != '~'))
1439+
if (!p || (!is_absolute_path(p) && *p != '~'))
14401440
return -1;
14411441
sl = 1; ndot = 0;
1442+
if (has_dos_drive_prefix(p))
1443+
p += 2;
14421444
p++;
14431445

14441446
while (1) {
14451447
char ch = *p++;
14461448
if (sl) {
14471449
if (ch == '.')
14481450
ndot++;
1449-
else if (ch == '/') {
1451+
else if (is_dir_sep(ch)) {
14501452
if (ndot < 3)
14511453
/* reject //, /./ and /../ */
14521454
return -1;
@@ -1463,7 +1465,7 @@ int daemon_avoid_alias(const char *p)
14631465
}
14641466
else if (ch == 0)
14651467
return 0;
1466-
else if (ch == '/') {
1468+
else if (is_dir_sep(ch)) {
14671469
sl = 1;
14681470
ndot = 0;
14691471
}

t/t0001-init.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,14 +463,14 @@ test_expect_success 're-init to move gitdir within linked worktree (relative)' '
463463
sep_git_dir_worktree linkwt relative
464464
'
465465

466-
test_expect_success MINGW '.git hidden' '
466+
test_expect_success MINGW '.git not hidden' '
467467
rm -rf newdir &&
468468
(
469469
sane_unset GIT_DIR GIT_WORK_TREE &&
470470
mkdir newdir &&
471471
cd newdir &&
472472
git init &&
473-
test_path_is_hidden .git
473+
! test_path_is_hidden .git
474474
) &&
475475
check_config newdir/.git false unset
476476
'

t/t1060-object-corruption.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ obj_to_file() {
1313
corrupt_byte() {
1414
obj_file=$(obj_to_file "$1") &&
1515
chmod +w "$obj_file" &&
16-
printf '\0' | dd of="$obj_file" bs=1 seek="$2" conv=notrunc
16+
printf '\0' | test_overwrite_bytes "$obj_file" "$2"
1717
}
1818

1919
test_expect_success 'setup corrupt repo' '

t/t1400-update-ref.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ test_expect_success 'stdin fails create with no new value' '
629629
test_expect_success 'stdin fails create with too many arguments' '
630630
echo "create $a $m $m" >stdin &&
631631
test_must_fail git update-ref --stdin <stdin 2>err &&
632-
grep "fatal: create $a: extra input: $m" err
632+
grep "fatal: create $a: extra input: $m" err
633633
'
634634

635635
test_expect_success 'stdin fails update with no ref' '
@@ -647,7 +647,7 @@ test_expect_success 'stdin fails update with no new value' '
647647
test_expect_success 'stdin fails update with too many arguments' '
648648
echo "update $a $m $m $m" >stdin &&
649649
test_must_fail git update-ref --stdin <stdin 2>err &&
650-
grep "fatal: update $a: extra input: $m" err
650+
grep "fatal: update $a: extra input: $m" err
651651
'
652652

653653
test_expect_success 'stdin fails delete with no ref' '

t/t3903-stash.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ test_expect_success 'drop middle stash' '
161161
git reset --hard &&
162162
echo 8 >file &&
163163
git stash &&
164+
sleep 1 &&
164165
echo 9 >file &&
165166
git stash &&
166167
git stash drop stash@{1} &&

t/t5300-pack-object.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ test_expect_success 'verify-pack catches mismatched .idx and .pack files' '
290290

291291
test_expect_success 'verify-pack catches a corrupted pack signature' '
292292
cat test-1-${packname_1}.pack >test-3.pack &&
293-
echo | dd of=test-3.pack count=1 bs=1 conv=notrunc seek=2 &&
293+
echo | test_overwrite_bytes test-3.pack 2 &&
294294
if git verify-pack test-3.idx
295295
then false
296296
else :;
@@ -299,7 +299,7 @@ test_expect_success 'verify-pack catches a corrupted pack signature' '
299299

300300
test_expect_success 'verify-pack catches a corrupted pack version' '
301301
cat test-1-${packname_1}.pack >test-3.pack &&
302-
echo | dd of=test-3.pack count=1 bs=1 conv=notrunc seek=7 &&
302+
echo | test_overwrite_bytes test-3.pack 7 &&
303303
if git verify-pack test-3.idx
304304
then false
305305
else :;
@@ -308,7 +308,7 @@ test_expect_success 'verify-pack catches a corrupted pack version' '
308308

309309
test_expect_success 'verify-pack catches a corrupted type/size of the 1st packed object data' '
310310
cat test-1-${packname_1}.pack >test-3.pack &&
311-
echo | dd of=test-3.pack count=1 bs=1 conv=notrunc seek=12 &&
311+
echo | test_overwrite_bytes test-3.pack 12 &&
312312
if git verify-pack test-3.idx
313313
then false
314314
else :;
@@ -319,7 +319,7 @@ test_expect_success 'verify-pack catches a corrupted sum of the index file itsel
319319
l=$(wc -c <test-3.idx) &&
320320
l=$(expr $l - 20) &&
321321
cat test-1-${packname_1}.pack >test-3.pack &&
322-
printf "%20s" "" | dd of=test-3.idx count=20 bs=1 conv=notrunc seek=$l &&
322+
printf "%20s" "" | test_overwrite_bytes test-3.idx $l &&
323323
if git verify-pack test-3.pack
324324
then false
325325
else :;

0 commit comments

Comments
 (0)