Merge 'misc-vs-fixes' into HEAD

This commit is contained in:
Johannes Schindelin
2018-03-23 13:54:24 +01:00
14 changed files with 46 additions and 15 deletions

View File

@@ -2155,7 +2155,7 @@ exec_cmd.sp exec_cmd.s exec_cmd.o: GIT-PREFIX
exec_cmd.sp exec_cmd.s exec_cmd.o: EXTRA_CPPFLAGS = \
'-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \
'-DBINDIR="$(bindir_relative_SQ)"' \
'-DPREFIX="$(prefix_SQ)"'
'-DFALLBACK_RUNTIME_PREFIX="$(prefix_SQ)"'
builtin/init-db.sp builtin/init-db.s builtin/init-db.o: GIT-PREFIX
builtin/init-db.sp builtin/init-db.s builtin/init-db.o: EXTRA_CPPFLAGS = \
@@ -2455,7 +2455,7 @@ bin-wrappers/%: wrap-for-bin.sh
@mkdir -p bin-wrappers
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@@BUILD_DIR@@|$(shell pwd)|' \
-e 's|@@PROG@@|$(patsubst test-%,t/helper/test-%,$(@F))|' < $< > $@ && \
-e 's|@@PROG@@|$(patsubst test-%,t/helper/test-%$(X),$(@F))$(patsubst git%,$(X),$(filter $(@F),$(BINDIR_PROGRAMS_NEED_X)))|' < $< > $@ && \
chmod +x $@
# GNU make supports exporting all variables by "export" without parameters.

View File

@@ -479,7 +479,8 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
mark_edges_uninteresting(&revs, show_edge);
if (bisect_list) {
int reaches = reaches, all = all;
FAKE_INIT(int, reaches, 0);
FAKE_INIT(int, all, 0);
find_bisection(&revs.commits, &reaches, &all, bisect_find_all);

View File

@@ -492,7 +492,7 @@ __extension__ \
( (h)->temp.tempint = (char *) (obj) - (char *) (h)->chunk, \
((((h)->temp.tempint > 0 \
&& (h)->temp.tempint < (h)->chunk_limit - (char *) (h)->chunk)) \
? (int) ((h)->next_free = (h)->object_base \
? (ptrdiff_t) ((h)->next_free = (h)->object_base \
= (h)->temp.tempint + (char *) (h)->chunk) \
: (((obstack_free) ((h), (h)->temp.tempint + (char *) (h)->chunk), 0), 0)))

View File

@@ -1,4 +1,6 @@
#ifndef NO_INTTYPES_H
#include <inttypes.h>
#endif
#include "git-compat-util.h"
#include "run-command.h"
#include "compat/terminal.h"

View File

@@ -392,6 +392,9 @@ ifeq ($(uname_S),Windows)
compat/win32/dirent.o compat/win32/fscache.o
COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE
# invalidcontinue.obj allows Git's source code to close the same file
# handle twice, or to access the osfhandle of an already-closed stdout
# See https://msdn.microsoft.com/en-us/library/ms235330.aspx
EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib invalidcontinue.obj kernel32.lib ntdll.lib
PTHREAD_LIBS =
lib =

View File

@@ -20,7 +20,7 @@ static const char *system_prefix(void)
!(prefix = strip_path_suffix(argv0_path, GIT_EXEC_PATH)) &&
!(prefix = strip_path_suffix(argv0_path, BINDIR)) &&
!(prefix = strip_path_suffix(argv0_path, "git"))) {
prefix = PREFIX;
prefix = FALLBACK_RUNTIME_PREFIX;
trace_printf("RUNTIME_PREFIX requested, "
"but prefix computation failed. "
"Using static fallback '%s'.\n", prefix);
@@ -45,7 +45,7 @@ void git_extract_argv0_path(const char *argv0)
static const char *system_prefix(void)
{
return PREFIX;
return FALLBACK_RUNTIME_PREFIX;
}
void git_extract_argv0_path(const char *argv0)

View File

@@ -3003,7 +3003,7 @@ static void cat_blob(struct object_entry *oe, struct object_id *oid)
static void parse_get_mark(const char *p)
{
struct object_entry *oe = oe;
FAKE_INIT(struct object_entry *, oe, NULL);
char output[GIT_MAX_HEXSZ + 2];
/* get-mark SP <object> LF */
@@ -3020,7 +3020,7 @@ static void parse_get_mark(const char *p)
static void parse_cat_blob(const char *p)
{
struct object_entry *oe = oe;
FAKE_INIT(struct object_entry *, oe, NULL);
struct object_id oid;
/* cat-blob SP <object> LF */

View File

@@ -51,6 +51,23 @@
#endif
#endif
/*
* Under certain circumstances Git's source code is cleverer than the C
* compiler when the latter warns about some "uninitialized value", e.g. when
* a value is both initialized and used under the same condition.
*
* GCC can be fooled to not spit out this warning by using the construct:
* "int value = value;". Other C compilers are not that easily fooled and would
* require a #pragma (which is not portable, and would litter the source code).
*
* To keep things simple, we only fool GCC, and initialize such values instead
* when compiling with other C compilers.
*/
#ifdef __GNUC__
#define FAKE_INIT(a, b, c) a b = b
#else
#define FAKE_INIT(a, b, c) a b = c
#endif
/*
* BUILD_ASSERT_OR_ZERO - assert a build-time dependency, as an expression.

View File

@@ -2070,7 +2070,7 @@ int merge_recursive(struct merge_options *o,
{
struct commit_list *iter;
struct commit *merged_common_ancestors;
struct tree *mrtree = mrtree;
FAKE_INIT(struct tree *, mrtree, NULL);
int clean;
if (show(o, 4)) {

View File

@@ -22,7 +22,9 @@ clean:
$(RM) $(makfile).old
$(RM) PM.stamp
ifneq (,$(wildcard PM.stamp))
$(makfile): PM.stamp
endif
ifdef NO_PERL_MAKEMAKER
instdir_SQ = $(subst ','\'',$(prefix)/lib)

View File

@@ -2104,7 +2104,7 @@ static int ce_write_entry(git_SHA_CTX *c, int fd, struct cache_entry *ce,
struct strbuf *previous_name, struct ondisk_cache_entry *ondisk)
{
int size;
int saved_namelen = saved_namelen; /* compiler workaround */
FAKE_INIT(int, saved_namelen, 0);
int result;
static unsigned char padding[8] = { 0x00 };

View File

@@ -13,7 +13,7 @@
* the remote died unexpectedly. A flush() concludes the stream.
*/
#define PREFIX "remote: "
#define DISPLAY_PREFIX "remote: "
#define ANSI_SUFFIX "\033[K"
#define DUMB_SUFFIX " "
@@ -49,7 +49,7 @@ int recv_sideband(const char *me, int in_stream, int out)
switch (band) {
case 3:
strbuf_addf(&outbuf, "%s%s%s", outbuf.len ? "\n" : "",
PREFIX, buf + 1);
DISPLAY_PREFIX, buf + 1);
retval = SIDEBAND_REMOTE_ERROR;
break;
case 2:
@@ -67,7 +67,7 @@ int recv_sideband(const char *me, int in_stream, int out)
int linelen = brk - b;
if (!outbuf.len)
strbuf_addstr(&outbuf, PREFIX);
strbuf_addstr(&outbuf, DISPLAY_PREFIX);
if (linelen > 0) {
strbuf_addf(&outbuf, "%.*s%s%c",
linelen, b, suffix, *brk);
@@ -81,8 +81,8 @@ int recv_sideband(const char *me, int in_stream, int out)
}
if (*b)
strbuf_addf(&outbuf, "%s%s",
outbuf.len ? "" : PREFIX, b);
strbuf_addf(&outbuf, "%s%s", outbuf.len ?
"" : DISPLAY_PREFIX, b);
break;
case 1:
write_or_die(out, buf + 1, len);

View File

@@ -830,6 +830,7 @@ test_expect_success 'migrate a remote from named file in $GIT_DIR/branches' '
(
cd six &&
git remote rm origin &&
mkdir -p .git/branches &&
echo "$origin_url" >.git/branches/origin &&
git remote rename origin origin &&
test_path_is_missing .git/branches/origin &&
@@ -844,6 +845,7 @@ test_expect_success 'migrate a remote from named file in $GIT_DIR/branches (2)'
(
cd seven &&
git remote rm origin &&
mkdir -p .git/branches &&
echo "quux#foom" > .git/branches/origin &&
git remote rename origin origin &&
test_path_is_missing .git/branches/origin &&

View File

@@ -866,6 +866,7 @@ test_expect_success 'fetch with branches' '
mk_empty testrepo &&
git branch second $the_first_commit &&
git checkout second &&
mkdir -p testrepo/.git/branches &&
echo ".." > testrepo/.git/branches/branch1 &&
(
cd testrepo &&
@@ -879,6 +880,7 @@ test_expect_success 'fetch with branches' '
test_expect_success 'fetch with branches containing #' '
mk_empty testrepo &&
mkdir -p testrepo/.git/branches &&
echo "..#second" > testrepo/.git/branches/branch2 &&
(
cd testrepo &&
@@ -893,6 +895,7 @@ test_expect_success 'fetch with branches containing #' '
test_expect_success 'push with branches' '
mk_empty testrepo &&
git checkout second &&
mkdir -p .git/branches &&
echo "testrepo" > .git/branches/branch1 &&
git push branch1 &&
(
@@ -905,6 +908,7 @@ test_expect_success 'push with branches' '
test_expect_success 'push with branches containing #' '
mk_empty testrepo &&
mkdir -p .git/branches &&
echo "testrepo#branch3" > .git/branches/branch2 &&
git push branch2 &&
(