Skip to content

Commit b7ee2f0

Browse files
author
Git for Windows Build Agent
committed
Merge 'misc-vs-fixes' into HEAD
2 parents 2098f14 + 2fa916f commit b7ee2f0

15 files changed

+49
-17
lines changed

.gitattributes

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
* whitespace=!indent,trail,space
2-
*.[ch] whitespace=indent,trail,space diff=cpp
3-
*.sh whitespace=indent,trail,space
2+
*.[ch] whitespace=indent,trail,space diff=cpp eol=lf
3+
*.sh whitespace=indent,trail,space eol=lf
4+
*.{perl,pm,txt} eol=lf

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2015,7 +2015,7 @@ exec_cmd.sp exec_cmd.s exec_cmd.o: GIT-PREFIX
20152015
exec_cmd.sp exec_cmd.s exec_cmd.o: EXTRA_CPPFLAGS = \
20162016
'-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \
20172017
'-DBINDIR="$(bindir_relative_SQ)"' \
2018-
'-DPREFIX="$(prefix_SQ)"'
2018+
'-DFALLBACK_RUNTIME_PREFIX="$(prefix_SQ)"'
20192019

20202020
builtin/init-db.sp builtin/init-db.s builtin/init-db.o: GIT-PREFIX
20212021
builtin/init-db.sp builtin/init-db.s builtin/init-db.o: EXTRA_CPPFLAGS = \
@@ -2267,7 +2267,7 @@ bin-wrappers/%: wrap-for-bin.sh
22672267
@mkdir -p bin-wrappers
22682268
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
22692269
-e 's|@@BUILD_DIR@@|$(shell pwd)|' \
2270-
-e 's|@@PROG@@|$(patsubst test-%,t/helper/test-%,$(@F))|' < $< > $@ && \
2270+
-e 's|@@PROG@@|$(patsubst test-%,t/helper/test-%$(X),$(@F))$(patsubst git%,$(X),$(filter $(@F),$(BINDIR_PROGRAMS_NEED_X)))|' < $< > $@ && \
22712271
chmod +x $@
22722272

22732273
# GNU make supports exporting all variables by "export" without parameters.

builtin/rev-list.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,8 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
388388
mark_edges_uninteresting(&revs, show_edge);
389389

390390
if (bisect_list) {
391-
int reaches = reaches, all = all;
391+
FAKE_INIT(int, reaches, 0);
392+
FAKE_INIT(int, all, 0);
392393

393394
revs.commits = find_bisection(revs.commits, &reaches, &all,
394395
bisect_find_all);

compat/obstack.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ __extension__ \
493493
( (h)->temp.tempint = (char *) (obj) - (char *) (h)->chunk, \
494494
((((h)->temp.tempint > 0 \
495495
&& (h)->temp.tempint < (h)->chunk_limit - (char *) (h)->chunk)) \
496-
? (int) ((h)->next_free = (h)->object_base \
496+
? (ptrdiff_t) ((h)->next_free = (h)->object_base \
497497
= (h)->temp.tempint + (char *) (h)->chunk) \
498498
: (((obstack_free) ((h), (h)->temp.tempint + (char *) (h)->chunk), 0), 0)))
499499

compat/terminal.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
#ifndef NO_INTTYPES_H
12
#include <inttypes.h>
3+
#endif
24
#include "git-compat-util.h"
35
#include "run-command.h"
46
#include "compat/terminal.h"

config.mak.uname

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,9 @@ ifeq ($(uname_S),Windows)
400400
compat/win32/dirent.o compat/win32/fscache.o
401401
COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
402402
BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE
403+
# invalidcontinue.obj allows Git's source code to close the same file
404+
# handle twice, or to access the osfhandle of an already-closed stdout
405+
# See https://msdn.microsoft.com/en-us/library/ms235330.aspx
403406
EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib invalidcontinue.obj kernel32.lib ntdll.lib
404407
PTHREAD_LIBS =
405408
lib =

exec_cmd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ char *system_path(const char *path)
1212
#ifdef RUNTIME_PREFIX
1313
static const char *prefix;
1414
#else
15-
static const char *prefix = PREFIX;
15+
static const char *prefix = FALLBACK_RUNTIME_PREFIX;
1616
#endif
1717
struct strbuf d = STRBUF_INIT;
1818

@@ -27,7 +27,7 @@ char *system_path(const char *path)
2727
!(prefix = strip_path_suffix(argv0_path, GIT_EXEC_PATH)) &&
2828
!(prefix = strip_path_suffix(argv0_path, BINDIR)) &&
2929
!(prefix = strip_path_suffix(argv0_path, "git"))) {
30-
prefix = PREFIX;
30+
prefix = FALLBACK_RUNTIME_PREFIX;
3131
trace_printf("RUNTIME_PREFIX requested, "
3232
"but prefix computation failed. "
3333
"Using static fallback '%s'.\n", prefix);

fast-import.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2992,7 +2992,7 @@ static void cat_blob(struct object_entry *oe, unsigned char sha1[20])
29922992

29932993
static void parse_get_mark(const char *p)
29942994
{
2995-
struct object_entry *oe = oe;
2995+
FAKE_INIT(struct object_entry *, oe, NULL);
29962996
char output[42];
29972997

29982998
/* get-mark SP <object> LF */
@@ -3009,7 +3009,7 @@ static void parse_get_mark(const char *p)
30093009

30103010
static void parse_cat_blob(const char *p)
30113011
{
3012-
struct object_entry *oe = oe;
3012+
FAKE_INIT(struct object_entry *, oe, NULL);
30133013
unsigned char sha1[20];
30143014

30153015
/* cat-blob SP <object> LF */

git-compat-util.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,23 @@
5151
#endif
5252
#endif
5353

54+
/*
55+
* Under certain circumstances Git's source code is cleverer than the C
56+
* compiler when the latter warns about some "uninitialized value", e.g. when
57+
* a value is both initialized and used under the same condition.
58+
*
59+
* GCC can be fooled to not spit out this warning by using the construct:
60+
* "int value = value;". Other C compilers are not that easily fooled and would
61+
* require a #pragma (which is not portable, and would litter the source code).
62+
*
63+
* To keep things simple, we only fool GCC, and initialize such values instead
64+
* when compiling with other C compilers.
65+
*/
66+
#ifdef __GNUC__
67+
#define FAKE_INIT(a, b, c) a b = b
68+
#else
69+
#define FAKE_INIT(a, b, c) a b = c
70+
#endif
5471

5572
/*
5673
* BUILD_ASSERT_OR_ZERO - assert a build-time dependency, as an expression.

merge-recursive.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2008,7 +2008,7 @@ int merge_recursive(struct merge_options *o,
20082008
{
20092009
struct commit_list *iter;
20102010
struct commit *merged_common_ancestors;
2011-
struct tree *mrtree = mrtree;
2011+
FAKE_INIT(struct tree *, mrtree, NULL);
20122012
int clean;
20132013

20142014
if (show(o, 4)) {

perl/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ clean:
2222
$(RM) $(makfile).old
2323
$(RM) PM.stamp
2424

25+
ifneq (,$(wildcard PM.stamp))
2526
$(makfile): PM.stamp
27+
endif
2628

2729
ifdef NO_PERL_MAKEMAKER
2830
instdir_SQ = $(subst ','\'',$(prefix)/lib)

read-cache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1904,7 +1904,7 @@ static int ce_write_entry(git_SHA_CTX *c, int fd, struct cache_entry *ce,
19041904
{
19051905
int size;
19061906
struct ondisk_cache_entry *ondisk;
1907-
int saved_namelen = saved_namelen; /* compiler workaround */
1907+
FAKE_INIT(int, saved_namelen, 0);
19081908
char *name;
19091909
int result;
19101910

sideband.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* the remote died unexpectedly. A flush() concludes the stream.
1414
*/
1515

16-
#define PREFIX "remote: "
16+
#define DISPLAY_PREFIX "remote: "
1717

1818
#define ANSI_SUFFIX "\033[K"
1919
#define DUMB_SUFFIX " "
@@ -50,7 +50,7 @@ int recv_sideband(const char *me, int in_stream, int out)
5050
switch (band) {
5151
case 3:
5252
strbuf_addf(&outbuf, "%s%s%s", outbuf.len ? "\n" : "",
53-
PREFIX, buf + 1);
53+
DISPLAY_PREFIX, buf + 1);
5454
retval = SIDEBAND_REMOTE_ERROR;
5555
break;
5656
case 2:
@@ -68,7 +68,7 @@ int recv_sideband(const char *me, int in_stream, int out)
6868
int linelen = brk - b;
6969

7070
if (!outbuf.len)
71-
strbuf_addstr(&outbuf, PREFIX);
71+
strbuf_addstr(&outbuf, DISPLAY_PREFIX);
7272
if (linelen > 0) {
7373
strbuf_addf(&outbuf, "%.*s%s%c",
7474
linelen, b, suffix, *brk);
@@ -82,8 +82,8 @@ int recv_sideband(const char *me, int in_stream, int out)
8282
}
8383

8484
if (*b)
85-
strbuf_addf(&outbuf, "%s%s",
86-
outbuf.len ? "" : PREFIX, b);
85+
strbuf_addf(&outbuf, "%s%s", outbuf.len ?
86+
"" : DISPLAY_PREFIX, b);
8787
break;
8888
case 1:
8989
write_or_die(out, buf + 1, len);

t/t5505-remote.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,7 @@ test_expect_success 'migrate a remote from named file in $GIT_DIR/branches' '
804804
(
805805
cd six &&
806806
git remote rm origin &&
807+
mkdir -p .git/branches &&
807808
echo "$origin_url" >.git/branches/origin &&
808809
git remote rename origin origin &&
809810
test_path_is_missing .git/branches/origin &&
@@ -818,6 +819,7 @@ test_expect_success 'migrate a remote from named file in $GIT_DIR/branches (2)'
818819
(
819820
cd seven &&
820821
git remote rm origin &&
822+
mkdir -p .git/branches &&
821823
echo "quux#foom" > .git/branches/origin &&
822824
git remote rename origin origin &&
823825
test_path_is_missing .git/branches/origin &&

t/t5516-fetch-push.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,7 @@ test_expect_success 'fetch with branches' '
866866
mk_empty testrepo &&
867867
git branch second $the_first_commit &&
868868
git checkout second &&
869+
mkdir -p testrepo/.git/branches &&
869870
echo ".." > testrepo/.git/branches/branch1 &&
870871
(
871872
cd testrepo &&
@@ -879,6 +880,7 @@ test_expect_success 'fetch with branches' '
879880

880881
test_expect_success 'fetch with branches containing #' '
881882
mk_empty testrepo &&
883+
mkdir -p testrepo/.git/branches &&
882884
echo "..#second" > testrepo/.git/branches/branch2 &&
883885
(
884886
cd testrepo &&
@@ -893,6 +895,7 @@ test_expect_success 'fetch with branches containing #' '
893895
test_expect_success 'push with branches' '
894896
mk_empty testrepo &&
895897
git checkout second &&
898+
mkdir -p .git/branches &&
896899
echo "testrepo" > .git/branches/branch1 &&
897900
git push branch1 &&
898901
(
@@ -905,6 +908,7 @@ test_expect_success 'push with branches' '
905908

906909
test_expect_success 'push with branches containing #' '
907910
mk_empty testrepo &&
911+
mkdir -p .git/branches &&
908912
echo "testrepo#branch3" > .git/branches/branch2 &&
909913
git push branch2 &&
910914
(

0 commit comments

Comments
 (0)