1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-03 22:28:09 +02:00

Merge branch 'gv/portable'

* gv/portable:
  test-lib: use DIFF definition from GIT-BUILD-OPTIONS
  build: propagate $DIFF to scripts
  Makefile: Tru64 portability fix
  Makefile: HP-UX 10.20 portability fixes
  Makefile: HPUX11 portability fixes
  Makefile: SunOS 5.6 portability fix
  inline declaration does not work on AIX
  Allow disabling "inline"
  Some platforms lack socklen_t type
  Make NO_{INET_NTOP,INET_PTON} configured independently
  Makefile: some platforms do not have hstrerror anywhere
  git-compat-util.h: some platforms with mmap() lack MAP_FAILED definition
  test_cmp: do not use "diff -u" on platforms that lack one
  fixup: do not unconditionally disable "diff -u"
  tests: use "test_cmp", not "diff", when verifying the result
  Do not use "diff" found on PATH while building and installing
  enums: omit trailing comma for portability
  Makefile: -lpthread may still be necessary when libc has only pthread stubs
  Rewrite dynamic structure initializations to runtime assignment
  Makefile: pass CPPFLAGS through to fllow customization

Conflicts:
	Makefile
	wt-status.h
This commit is contained in:
Junio C Hamano 2010-06-21 06:02:44 -07:00
commit 8d676d85f7
65 changed files with 377 additions and 161 deletions

View File

@ -12,7 +12,7 @@ do
then
: did not match
elif test -f "$T/$h" &&
diff -u -I'Last updated [0-9][0-9]-[A-Z][a-z][a-z]-' "$T/$h" "$h"
$DIFF -u -I'Last updated [0-9][0-9]-[A-Z][a-z][a-z]-' "$T/$h" "$h"
then
:; # up to date
else

View File

@ -8,6 +8,12 @@ all::
# Define SANE_TOOL_PATH to a colon-separated list of paths to prepend
# to PATH if your tools in /usr/bin are broken.
#
# Define SOCKLEN_T to a suitable type (such as 'size_t') if your
# system headers do not define a socklen_t type.
#
# Define INLINE to a suitable substitute (such as '__inline' or '') if git
# fails to compile with errors about undefined inline functions or similar.
#
# Define SNPRINTF_RETURNS_BOGUS if your are on a system which snprintf()
# or vsnprintf() return -1 instead of number of characters which would
# have been written to the final string if enough space had been available.
@ -249,7 +255,7 @@ endif
CFLAGS = -g -O2 -Wall
LDFLAGS =
ALL_CFLAGS = $(CFLAGS)
ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
ALL_LDFLAGS = $(LDFLAGS)
STRIP ?= strip
@ -286,11 +292,12 @@ lib = lib
# DESTDIR=
pathsep = :
export prefix bindir sharedir sysconfdir
export prefix bindir sharedir sysconfdir gitwebdir
CC = gcc
AR = ar
RM = rm -f
DIFF = diff
TAR = tar
FIND = find
INSTALL = install
@ -298,6 +305,7 @@ RPMBUILD = rpmbuild
TCL_PATH = tclsh
TCLTK_PATH = wish
PTHREAD_LIBS = -lpthread
PTHREAD_CFLAGS =
export TCL_PATH TCLTK_PATH
@ -741,6 +749,13 @@ EXTLIBS =
# because maintaining the nesting to match is a pain. If
# we had "elif" things would have been much nicer...
ifeq ($(uname_S),OSF1)
# Need this for u_short definitions et al
BASIC_CFLAGS += -D_OSF_SOURCE
SOCKLEN_T = int
NO_STRTOULL = YesPlease
NO_NSEC = YesPlease
endif
ifeq ($(uname_S),Linux)
NO_STRLCPY = YesPlease
NO_MKSTEMPS = YesPlease
@ -815,6 +830,18 @@ ifeq ($(uname_S),SunOS)
NO_MKDTEMP = YesPlease
NO_MKSTEMPS = YesPlease
NO_REGEX = YesPlease
ifeq ($(uname_R),5.6)
SOCKLEN_T = int
NO_HSTRERROR = YesPlease
NO_IPV6 = YesPlease
NO_SOCKADDR_STORAGE = YesPlease
NO_UNSETENV = YesPlease
NO_SETENV = YesPlease
NO_STRLCPY = YesPlease
NO_C99_FORMAT = YesPlease
NO_STRTOUMAX = YesPlease
GIT_TEST_CMP = cmp
endif
ifeq ($(uname_R),5.7)
NEEDS_RESOLV = YesPlease
NO_IPV6 = YesPlease
@ -824,18 +851,21 @@ ifeq ($(uname_S),SunOS)
NO_STRLCPY = YesPlease
NO_C99_FORMAT = YesPlease
NO_STRTOUMAX = YesPlease
GIT_TEST_CMP = cmp
endif
ifeq ($(uname_R),5.8)
NO_UNSETENV = YesPlease
NO_SETENV = YesPlease
NO_C99_FORMAT = YesPlease
NO_STRTOUMAX = YesPlease
GIT_TEST_CMP = cmp
endif
ifeq ($(uname_R),5.9)
NO_UNSETENV = YesPlease
NO_SETENV = YesPlease
NO_C99_FORMAT = YesPlease
NO_STRTOUMAX = YesPlease
GIT_TEST_CMP = cmp
endif
INSTALL = /usr/ucb/install
TAR = gtar
@ -913,7 +943,13 @@ ifeq ($(uname_S),AIX)
BASIC_CFLAGS += -D_LARGE_FILES
ifeq ($(shell expr "$(uname_V)" : '[1234]'),1)
NO_PTHREADS = YesPlease
else
PTHREAD_LIBS = -lpthread
endif
ifeq ($(shell expr "$(uname_V).$(uname_R)" : '5\.1'),3)
INLINE=''
endif
GIT_TEST_CMP = cmp
endif
ifeq ($(uname_S),GNU)
# GNU/Hurd
@ -958,6 +994,7 @@ ifeq ($(uname_S),IRIX64)
NEEDS_LIBGEN = YesPlease
endif
ifeq ($(uname_S),HP-UX)
INLINE = __inline
NO_IPV6=YesPlease
NO_SETENV=YesPlease
NO_STRCASESTR=YesPlease
@ -969,6 +1006,20 @@ ifeq ($(uname_S),HP-UX)
NO_HSTRERROR = YesPlease
NO_SYS_SELECT_H = YesPlease
SNPRINTF_RETURNS_BOGUS = YesPlease
NO_NSEC = YesPlease
ifeq ($(uname_R),B.11.00)
NO_INET_NTOP = YesPlease
NO_INET_PTON = YesPlease
endif
ifeq ($(uname_R),B.10.20)
# Override HP-UX 11.x setting:
INLINE =
SOCKLEN_T = size_t
NO_PREAD = YesPlease
NO_INET_NTOP = YesPlease
NO_INET_PTON = YesPlease
endif
GIT_TEST_CMP = cmp
endif
ifeq ($(uname_S),Windows)
GIT_VERSION := $(GIT_VERSION).MSVC
@ -1094,6 +1145,14 @@ else
BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
endif
ifneq (,$(INLINE))
BASIC_CFLAGS += -Dinline=$(INLINE)
endif
ifneq (,$(SOCKLEN_T))
BASIC_CFLAGS += -Dsocklen_t=$(SOCKLEN_T)
endif
ifeq ($(uname_S),Darwin)
ifndef NO_FINK
ifeq ($(shell test -d /sw/lib && echo y),y)
@ -1365,6 +1424,7 @@ endif
ifdef NO_PTHREADS
BASIC_CFLAGS += -DNO_PTHREADS
else
BASIC_CFLAGS += $(PTHREAD_CFLAGS)
EXTLIBS += $(PTHREAD_LIBS)
LIB_OBJS += thread-utils.o
endif
@ -1389,6 +1449,10 @@ ifdef USE_NED_ALLOCATOR
COMPAT_OBJS += compat/nedmalloc/nedmalloc.o
endif
ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
export GIT_TEST_CMP_USE_COPIED_CONTEXT
endif
ifeq ($(TCLTK_PATH),)
NO_TCLTK=NoThanks
endif
@ -1451,6 +1515,7 @@ SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
PYTHON_PATH_SQ = $(subst ','\'',$(PYTHON_PATH))
TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH))
DIFF_SQ = $(subst ','\'',$(DIFF))
LIBS = $(GITLIBS) $(EXTLIBS)
@ -1477,7 +1542,7 @@ endif
ALL_CFLAGS += $(BASIC_CFLAGS)
ALL_LDFLAGS += $(BASIC_LDFLAGS)
export TAR INSTALL DESTDIR SHELL_PATH
export DIFF TAR INSTALL DESTDIR SHELL_PATH
### Build rules
@ -1539,6 +1604,7 @@ define cmd_munge_script
$(RM) $@ $@+ && \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
-e 's|@@DIFF@@|$(DIFF_SQ)|' \
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
-e 's/@@NO_CURL@@/$(NO_CURL)/g' \
-e $(BROKEN_PATH_FIX) \
@ -1884,11 +1950,18 @@ GIT-CFLAGS: FORCE
GIT-BUILD-OPTIONS: FORCE
@echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@
@echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@
@echo DIFF=\''$(subst ','\'',$(subst ','\'',$(DIFF)))'\' >>$@
@echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@
@echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@
@echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@
@echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@
@echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@
ifdef GIT_TEST_CMP
@echo GIT_TEST_CMP=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_CMP)))'\' >>$@
endif
ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
@echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@
endif
### Detect Tck/Tk interpreter path changes
ifndef NO_TCLTK
@ -1983,7 +2056,7 @@ install: all
$(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
ifndef NO_PERL
$(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install
$(MAKE) -C gitweb gitwebdir=$(gitwebdir_SQ) install
$(MAKE) -C gitweb install
endif
ifndef NO_PYTHON
$(MAKE) -C git_remote_helpers prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install

40
aclocal.m4 vendored Normal file
View File

@ -0,0 +1,40 @@
dnl Check for socklen_t: historically on BSD it is an int, and in
dnl POSIX 1g it is a type of its own, but some platforms use different
dnl types for the argument to getsockopt, getpeername, etc. So we
dnl have to test to find something that will work.
AC_DEFUN([TYPE_SOCKLEN_T],
[
AC_CHECK_TYPE([socklen_t], ,[
AC_MSG_CHECKING([for socklen_t equivalent])
AC_CACHE_VAL([git_cv_socklen_t_equiv],
[
# Systems have either "struct sockaddr *" or
# "void *" as the second argument to getpeername
git_cv_socklen_t_equiv=
for arg2 in "struct sockaddr" void; do
for t in int size_t unsigned long "unsigned long"; do
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>
int getpeername (int, $arg2 *, $t *);
],[
$t len;
getpeername(0,0,&len);
],[
git_cv_socklen_t_equiv="$t"
break 2
])
done
done
if test "x$git_cv_socklen_t_equiv" = x; then
AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
fi
])
AC_MSG_RESULT($git_cv_socklen_t_equiv)
AC_DEFINE_UNQUOTED(socklen_t, $git_cv_socklen_t_equiv,
[type to use in place of socklen_t if not defined])],
[#include <sys/types.h>
#include <sys/socket.h>])
])

2
attr.h
View File

@ -34,7 +34,7 @@ int git_checkattr(const char *path, int, struct git_attr_check *);
enum git_attr_direction {
GIT_ATTR_CHECKIN,
GIT_ATTR_CHECKOUT,
GIT_ATTR_INDEX,
GIT_ATTR_INDEX
};
void git_attr_set_direction(enum git_attr_direction, struct index_state *);

View File

@ -261,12 +261,14 @@ static int edit_patch(int argc, const char **argv, const char *prefix)
{
char *file = xstrdup(git_path("ADD_EDIT.patch"));
const char *apply_argv[] = { "apply", "--recount", "--cached",
file, NULL };
NULL, NULL };
struct child_process child;
struct rev_info rev;
int out;
struct stat st;
apply_argv[3] = file;
git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
if (read_cache() < 0)

View File

@ -56,7 +56,7 @@ static enum ws_error_action {
nowarn_ws_error,
warn_on_ws_error,
die_on_ws_error,
correct_ws_error,
correct_ws_error
} ws_error_action = warn_on_ws_error;
static int whitespace_error;
static int squelch_whitespace_errors = 5;
@ -64,7 +64,7 @@ static int applied_after_fixing_ws;
static enum ws_ignore {
ignore_ws_none,
ignore_ws_change,
ignore_ws_change
} ws_ignore_action = ignore_ws_none;

View File

@ -733,10 +733,11 @@ static int pass_blame_to_parent(struct scoreboard *sb,
{
int last_in_target;
mmfile_t file_p, file_o;
struct blame_chunk_cb_data d = { sb, target, parent, 0, 0 };
struct blame_chunk_cb_data d;
xpparam_t xpp;
xdemitconf_t xecfg;
memset(&d, 0, sizeof(d));
d.sb = sb; d.target = target; d.parent = parent;
last_in_target = find_last_in_target(sb, target);
if (last_in_target < 0)
return 1; /* nothing remains for this target */
@ -875,10 +876,11 @@ static void find_copy_in_blob(struct scoreboard *sb,
const char *cp;
int cnt;
mmfile_t file_o;
struct handle_split_cb_data d = { sb, ent, parent, split, 0, 0 };
struct handle_split_cb_data d;
xpparam_t xpp;
xdemitconf_t xecfg;
memset(&d, 0, sizeof(d));
d.sb = sb; d.ent = ent; d.parent = parent; d.split = split;
/*
* Prepare mmfile that contains only the lines in ent.
*/

View File

@ -43,13 +43,13 @@ enum color_branch {
BRANCH_COLOR_PLAIN = 1,
BRANCH_COLOR_REMOTE = 2,
BRANCH_COLOR_LOCAL = 3,
BRANCH_COLOR_CURRENT = 4,
BRANCH_COLOR_CURRENT = 4
};
static enum merge_filter {
NO_FILTER = 0,
SHOW_NOT_MERGED,
SHOW_MERGED,
SHOW_MERGED
} merge_filter;
static unsigned char merge_filter_ref[20];

View File

@ -118,7 +118,9 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name)
/* custom pretty-print here */
if (type == OBJ_TREE) {
const char *ls_args[3] = {"ls-tree", obj_name, NULL};
const char *ls_args[3] = { NULL };
ls_args[0] = "ls-tree";
ls_args[1] = obj_name;
return cmd_ls_tree(2, ls_args, NULL);
}

View File

@ -636,7 +636,8 @@ static int check_tracking_name(const char *refname, const unsigned char *sha1,
static const char *unique_tracking_name(const char *name)
{
struct tracking_name_data cb_data = { name, NULL, 1 };
struct tracking_name_data cb_data = { NULL, NULL, 1 };
cb_data.name = name;
for_each_ref(check_tracking_name, &cb_data);
if (cb_data.unique)
return cb_data.remote;

View File

@ -57,7 +57,7 @@ static struct lock_file false_lock; /* used only for partial commits */
static enum {
COMMIT_AS_IS = 1,
COMMIT_NORMAL,
COMMIT_PARTIAL,
COMMIT_PARTIAL
} commit_style;
static const char *logfile, *force_author;
@ -78,7 +78,7 @@ static char *untracked_files_arg, *force_date;
static enum {
CLEANUP_SPACE,
CLEANUP_NONE,
CLEANUP_ALL,
CLEANUP_ALL
} cleanup_mode;
static char *cleanup_arg;
@ -91,7 +91,7 @@ static int null_termination;
static enum {
STATUS_FORMAT_LONG,
STATUS_FORMAT_SHORT,
STATUS_FORMAT_PORCELAIN,
STATUS_FORMAT_PORCELAIN
} status_format = STATUS_FORMAT_LONG;
static int status_show_branch;
@ -732,7 +732,8 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
if (use_editor) {
char index[PATH_MAX];
const char *env[2] = { index, NULL };
const char *env[2] = { NULL };
env[0] = index;
snprintf(index, sizeof(index), "GIT_INDEX_FILE=%s", index_file);
if (launch_editor(git_path(commit_editmsg), NULL, env)) {
fprintf(stderr,

View File

@ -574,9 +574,10 @@ static void find_non_local_tags(struct transport *transport,
{
struct string_list existing_refs = { NULL, 0, 0, 0 };
struct string_list remote_refs = { NULL, 0, 0, 0 };
struct tag_data data = {head, tail};
struct tag_data data;
const struct ref *ref;
struct string_list_item *item = NULL;
data.head = head; data.tail = tail;
for_each_ref(add_existing, &existing_refs);
for (ref = transport_get_remote_refs(transport); ref; ref = ref->next) {
@ -778,7 +779,8 @@ static int get_remote_group(const char *key, const char *value, void *priv)
static int add_remote_or_group(const char *name, struct string_list *list)
{
int prev_nr = list->nr;
struct remote_group_data g = { name, list };
struct remote_group_data g;
g.name = name; g.list = list;
git_config(get_remote_group, &g);
if (list->nr == prev_nr) {

View File

@ -26,7 +26,7 @@ enum help_format {
HELP_FORMAT_NONE,
HELP_FORMAT_MAN,
HELP_FORMAT_INFO,
HELP_FORMAT_WEB,
HELP_FORMAT_WEB
};
static int show_all = 0;

View File

@ -17,10 +17,10 @@ static struct strbuf name = STRBUF_INIT;
static struct strbuf email = STRBUF_INIT;
static enum {
TE_DONTCARE, TE_QP, TE_BASE64,
TE_DONTCARE, TE_QP, TE_BASE64
} transfer_encoding;
static enum {
TYPE_TEXT, TYPE_OTHER,
TYPE_TEXT, TYPE_OTHER
} message_type;
static struct strbuf charset = STRBUF_INIT;

View File

@ -17,7 +17,7 @@ enum deny_action {
DENY_UNCONFIGURED,
DENY_IGNORE,
DENY_WARN,
DENY_REFUSE,
DENY_REFUSE
};
static int deny_deletes;

View File

@ -348,7 +348,7 @@ struct push_info {
PUSH_STATUS_UPTODATE,
PUSH_STATUS_FASTFORWARD,
PUSH_STATUS_OUTOFDATE,
PUSH_STATUS_NOTQUERIED,
PUSH_STATUS_NOTQUERIED
} status;
};
@ -736,11 +736,14 @@ static int rm(int argc, const char **argv)
struct known_remotes known_remotes = { NULL, NULL };
struct string_list branches = { NULL, 0, 0, 1 };
struct string_list skipped = { NULL, 0, 0, 1 };
struct branches_for_remote cb_data = {
NULL, &branches, &skipped, &known_remotes
};
struct branches_for_remote cb_data;
int i, result;
memset(&cb_data, 0, sizeof(cb_data));
cb_data.branches = &branches;
cb_data.skipped = &skipped;
cb_data.keep = &known_remotes;
if (argc != 2)
usage_with_options(builtin_remote_rm_usage, options);

16
cache.h
View File

@ -361,7 +361,7 @@ enum object_type {
OBJ_OFS_DELTA = 6,
OBJ_REF_DELTA = 7,
OBJ_ANY,
OBJ_MAX,
OBJ_MAX
};
static inline enum object_type object_type(unsigned int mode)
@ -556,7 +556,7 @@ extern int core_apply_sparse_checkout;
enum safe_crlf {
SAFE_CRLF_FALSE = 0,
SAFE_CRLF_FAIL = 1,
SAFE_CRLF_WARN = 2,
SAFE_CRLF_WARN = 2
};
extern enum safe_crlf safe_crlf;
@ -567,21 +567,21 @@ enum branch_track {
BRANCH_TRACK_REMOTE,
BRANCH_TRACK_ALWAYS,
BRANCH_TRACK_EXPLICIT,
BRANCH_TRACK_OVERRIDE,
BRANCH_TRACK_OVERRIDE
};
enum rebase_setup_type {
AUTOREBASE_NEVER = 0,
AUTOREBASE_LOCAL,
AUTOREBASE_REMOTE,
AUTOREBASE_ALWAYS,
AUTOREBASE_ALWAYS
};
enum push_default_type {
PUSH_DEFAULT_NOTHING = 0,
PUSH_DEFAULT_MATCHING,
PUSH_DEFAULT_TRACKING,
PUSH_DEFAULT_CURRENT,
PUSH_DEFAULT_CURRENT
};
extern enum branch_track git_branch_track;
@ -590,7 +590,7 @@ extern enum push_default_type push_default;
enum object_creation_mode {
OBJECT_CREATION_USES_HARDLINKS = 0,
OBJECT_CREATION_USES_RENAMES = 1,
OBJECT_CREATION_USES_RENAMES = 1
};
extern enum object_creation_mode object_creation_mode;
@ -670,7 +670,7 @@ enum sharedrepo {
OLD_PERM_GROUP = 1,
OLD_PERM_EVERYBODY = 2,
PERM_GROUP = 0660,
PERM_EVERYBODY = 0664,
PERM_EVERYBODY = 0664
};
int git_config_perm(const char *var, const char *value);
int set_shared_perm(const char *path, int mode);
@ -882,7 +882,7 @@ struct ref {
REF_STATUS_REJECT_NODELETE,
REF_STATUS_UPTODATE,
REF_STATUS_REMOTE_REJECT,
REF_STATUS_EXPECTING_REPORT,
REF_STATUS_EXPECTING_REPORT
} status;
char *remote_status;
struct ref *peer_ref; /* when renaming */

View File

@ -60,7 +60,7 @@ enum cmit_fmt {
CMIT_FMT_EMAIL,
CMIT_FMT_USERFORMAT,
CMIT_FMT_UNSPECIFIED,
CMIT_FMT_UNSPECIFIED
};
struct pretty_print_context

View File

@ -3,10 +3,12 @@
CC = @CC@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
CC_LD_DYNPATH = @CC_LD_DYNPATH@
AR = @AR@
TAR = @TAR@
DIFF = @DIFF@
#INSTALL = @INSTALL@ # needs install-sh or install.sh in sources
TCLTK_PATH = @TCLTK_PATH@
@ -42,6 +44,7 @@ NO_D_TYPE_IN_DIRENT=@NO_D_TYPE_IN_DIRENT@
NO_SOCKADDR_STORAGE=@NO_SOCKADDR_STORAGE@
NO_IPV6=@NO_IPV6@
NO_C99_FORMAT=@NO_C99_FORMAT@
NO_HSTRERROR=@NO_HSTRERROR@
NO_STRCASESTR=@NO_STRCASESTR@
NO_MEMMEM=@NO_MEMMEM@
NO_STRLCPY=@NO_STRLCPY@
@ -51,10 +54,15 @@ NO_SETENV=@NO_SETENV@
NO_UNSETENV=@NO_UNSETENV@
NO_MKDTEMP=@NO_MKDTEMP@
NO_MKSTEMPS=@NO_MKSTEMPS@
NO_INET_NTOP=@NO_INET_NTOP@
NO_INET_PTON=@NO_INET_PTON@
NO_ICONV=@NO_ICONV@
OLD_ICONV=@OLD_ICONV@
NO_DEFLATE_BOUND=@NO_DEFLATE_BOUND@
INLINE=@INLINE@
SOCKLEN_T=@SOCKLEN_T@
FREAD_READS_DIRECTORIES=@FREAD_READS_DIRECTORIES@
SNPRINTF_RETURNS_BOGUS=@SNPRINTF_RETURNS_BOGUS@
NO_PTHREADS=@NO_PTHREADS@
PTHREAD_CFLAGS=@PTHREAD_CFLAGS@
PTHREAD_LIBS=@PTHREAD_LIBS@

View File

@ -327,6 +327,12 @@ GIT_PARSE_WITH(tcltk))
AC_MSG_NOTICE([CHECKS for programs])
#
AC_PROG_CC([cc gcc])
AC_C_INLINE
case $ac_cv_c_inline in
inline | yes | no) ;;
*) AC_SUBST([INLINE], [$ac_cv_c_inline]) ;;
esac
# which switch to pass runtime path to dynamic libraries to the linker
AC_CACHE_CHECK([if linker supports -R], git_cv_ld_dashr, [
SAVE_LDFLAGS="${LDFLAGS}"
@ -362,6 +368,7 @@ fi
#AC_PROG_INSTALL # needs install-sh or install.sh in sources
AC_CHECK_TOOLS(AR, [gar ar], :)
AC_CHECK_PROGS(TAR, [gtar tar])
AC_CHECK_PROGS(DIFF, [gnudiff gdiff diff])
# TCLTK_PATH will be set to some value if we want Tcl/Tk
# or will be empty otherwise.
if test -z "$NO_TCLTK"; then
@ -544,13 +551,47 @@ AC_SUBST(NEEDS_SOCKET)
test -n "$NEEDS_SOCKET" && LIBS="$LIBS -lsocket"
#
# Define NEEDS_RESOLV if linking with -lnsl and/or -lsocket is not enough.
# Notably on Solaris hstrerror resides in libresolv and on Solaris 7
# inet_ntop and inet_pton additionally reside there.
AC_CHECK_LIB([c], [hstrerror],
[NEEDS_RESOLV=],
[NEEDS_RESOLV=YesPlease])
# The next few tests will define NEEDS_RESOLV if linking with
# libresolv provides some of the functions we would normally get
# from libc.
NEEDS_RESOLV=
AC_SUBST(NEEDS_RESOLV)
#
# Define NO_INET_NTOP if linking with -lresolv is not enough.
# Solaris 2.7 in particular hos inet_ntop in -lresolv.
NO_INET_NTOP=
AC_SUBST(NO_INET_NTOP)
AC_CHECK_FUNC([inet_ntop],
[],
[AC_CHECK_LIB([resolv], [inet_ntop],
[NEEDS_RESOLV=YesPlease],
[NO_INET_NTOP=YesPlease])
])
#
# Define NO_INET_PTON if linking with -lresolv is not enough.
# Solaris 2.7 in particular hos inet_pton in -lresolv.
NO_INET_PTON=
AC_SUBST(NO_INET_PTON)
AC_CHECK_FUNC([inet_pton],
[],
[AC_CHECK_LIB([resolv], [inet_pton],
[NEEDS_RESOLV=YesPlease],
[NO_INET_PTON=YesPlease])
])
#
# Define NO_HSTRERROR if linking with -lresolv is not enough.
# Solaris 2.6 in particular has no hstrerror, even in -lresolv.
NO_HSTRERROR=
AC_CHECK_FUNC([hstrerror],
[],
[AC_CHECK_LIB([resolv], [hstrerror],
[NEEDS_RESOLV=YesPlease],
[NO_HSTRERROR=YesPlease])
])
AC_SUBST(NO_HSTRERROR)
#
# If any of the above tests determined that -lresolv is needed at
# build-time, also set it here for remaining configure-time checks.
test -n "$NEEDS_RESOLV" && LIBS="$LIBS -lresolv"
AC_CHECK_LIB([c], [basename],
@ -598,6 +639,12 @@ AC_SUBST(OLD_ICONV)
## Checks for typedefs, structures, and compiler characteristics.
AC_MSG_NOTICE([CHECKS for typedefs, structures, and compiler characteristics])
#
TYPE_SOCKLEN_T
case $ac_cv_type_socklen_t in
yes) ;;
*) AC_SUBST([SOCKLEN_T], [$git_cv_socklen_t_equiv]) ;;
esac
# Define NO_D_INO_IN_DIRENT if you don't have d_ino in your struct dirent.
AC_CHECK_MEMBER(struct dirent.d_ino,
[NO_D_INO_IN_DIRENT=],
@ -808,7 +855,11 @@ AC_DEFUN([PTHREADTEST_SRC], [
int main(void)
{
pthread_mutex_t test_mutex;
return (0);
int retcode = 0;
retcode |= pthread_mutex_init(&test_mutex,(void *)0);
retcode |= pthread_mutex_lock(&test_mutex);
retcode |= pthread_mutex_unlock(&test_mutex);
return retcode;
}
])
@ -825,7 +876,8 @@ if test -n "$USER_NOPTHREAD"; then
# handle these separately since PTHREAD_CFLAGS could be '-lpthreads
# -D_REENTRANT' or some such.
elif test -z "$PTHREAD_CFLAGS"; then
for opt in -pthread -lpthread; do
threads_found=no
for opt in -mt -pthread -lpthread; do
old_CFLAGS="$CFLAGS"
CFLAGS="$opt $CFLAGS"
AC_MSG_CHECKING([Checking for POSIX Threads with '$opt'])
@ -833,11 +885,18 @@ elif test -z "$PTHREAD_CFLAGS"; then
[AC_MSG_RESULT([yes])
NO_PTHREADS=
PTHREAD_LIBS="$opt"
PTHREAD_CFLAGS="$opt"
threads_found=yes
break
],
[AC_MSG_RESULT([no])])
CFLAGS="$old_CFLAGS"
done
if test $threads_found != yes; then
AC_CHECK_LIB([pthread], [pthread_create],
[PTHREAD_LIBS="-lpthread"],
[NO_PTHREADS=UnfortunatelyYes])
fi
else
old_CFLAGS="$CFLAGS"
CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
@ -854,6 +913,7 @@ fi
CFLAGS="$old_CFLAGS"
AC_SUBST(PTHREAD_CFLAGS)
AC_SUBST(PTHREAD_LIBS)
AC_SUBST(NO_PTHREADS)

View File

@ -132,7 +132,7 @@ int path_match(const char *path, int nr, char **match)
enum protocol {
PROTO_LOCAL = 1,
PROTO_SSH,
PROTO_GIT,
PROTO_GIT
};
static enum protocol get_protocol(const char *name)

View File

@ -249,7 +249,9 @@ static int filter_buffer(int in, int out, void *data)
struct child_process child_process;
struct filter_params *params = (struct filter_params *)data;
int write_err, status;
const char *argv[] = { params->cmd, NULL };
const char *argv[] = { NULL, NULL };
argv[0] = params->cmd;
memset(&child_process, 0, sizeof(child_process));
child_process.argv = argv;

View File

@ -10,7 +10,7 @@ enum {
A = GIT_ALPHA,
D = GIT_DIGIT,
G = GIT_GLOB_SPECIAL, /* *, ?, [, \\ */
R = GIT_REGEX_SPECIAL, /* $, (, ), +, ., ^, {, | */
R = GIT_REGEX_SPECIAL /* $, (, ), +, ., ^, {, | */
};
unsigned char sane_ctype[256] = {

View File

@ -141,15 +141,14 @@ static char *path_ok(char *directory)
}
else if (interpolated_path && saw_extended_args) {
struct strbuf expanded_path = STRBUF_INIT;
struct strbuf_expand_dict_entry dict[] = {
{ "H", hostname },
{ "CH", canon_hostname },
{ "IP", ip_address },
{ "P", tcp_port },
{ "D", directory },
{ NULL }
};
struct strbuf_expand_dict_entry dict[6];
dict[0].placeholder = "H"; dict[0].value = hostname;
dict[1].placeholder = "CH"; dict[1].value = canon_hostname;
dict[2].placeholder = "IP"; dict[2].value = ip_address;
dict[3].placeholder = "P"; dict[3].value = tcp_port;
dict[4].placeholder = "D"; dict[4].value = directory;
dict[5].placeholder = NULL; dict[5].value = NULL;
if (*dir != '/') {
/* Allow only absolute */
logerror("'%s': Non-absolute path denied (interpolated-path active)", dir);
@ -343,7 +342,9 @@ static int upload_pack(void)
{
/* Timeout as string */
char timeout_buf[64];
const char *argv[] = { "upload-pack", "--strict", timeout_buf, ".", NULL };
const char *argv[] = { "upload-pack", "--strict", NULL, ".", NULL };
argv[2] = timeout_buf;
snprintf(timeout_buf, sizeof timeout_buf, "--timeout=%u", timeout);
return run_service_command(argv);

2
diff.h
View File

@ -146,7 +146,7 @@ enum color_diff {
DIFF_FILE_NEW = 5,
DIFF_COMMIT = 6,
DIFF_WHITESPACE = 7,
DIFF_FUNCINFO = 8,
DIFF_FUNCINFO = 8
};
const char *diff_get_color(int diff_use_color, enum color_diff ix);
#define diff_get_color_opt(o, ix) \

6
dir.c
View File

@ -465,7 +465,7 @@ static struct dir_entry *dir_add_ignored(struct dir_struct *dir, const char *pat
enum exist_status {
index_nonexistent = 0,
index_directory,
index_gitdir,
index_gitdir
};
/*
@ -533,7 +533,7 @@ static enum exist_status directory_exists_in_index(const char *dirname, int len)
enum directory_treatment {
show_directory,
ignore_directory,
recurse_into_directory,
recurse_into_directory
};
static enum directory_treatment treat_directory(struct dir_struct *dir,
@ -684,7 +684,7 @@ static int get_dtype(struct dirent *de, const char *path, int len)
enum path_treatment {
path_ignored,
path_handled,
path_recurse,
path_recurse
};
static enum path_treatment treat_one_path(struct dir_struct *dir,

View File

@ -267,7 +267,7 @@ struct hash_list
typedef enum {
WHENSPEC_RAW = 1,
WHENSPEC_RFC2822,
WHENSPEC_NOW,
WHENSPEC_NOW
} whenspec_type;
struct recent_command

View File

@ -224,7 +224,6 @@ static inline const char *skip_prefix(const char *str, const char *prefix)
#define PROT_READ 1
#define PROT_WRITE 2
#define MAP_PRIVATE 1
#define MAP_FAILED ((void*)-1)
#endif
#define mmap git_mmap
@ -253,6 +252,10 @@ extern int git_munmap(void *start, size_t length);
#endif /* NO_MMAP */
#ifndef MAP_FAILED
#define MAP_FAILED ((void *)-1)
#endif
#ifdef NO_ST_BLOCKS_IN_STRUCT_STAT
#define on_disk_bytes(st) ((st).st_size)
#else

View File

@ -107,7 +107,7 @@ case "${1:-.}${2:-.}${3:-.}" in
# remove lines that are unique to ours.
orig=`git-unpack-file $2`
sz0=`wc -c <"$orig"`
diff -u -La/$orig -Lb/$orig $orig $src2 | git apply --no-add
@@DIFF@@ -u -La/$orig -Lb/$orig $orig $src2 | git apply --no-add
sz1=`wc -c <"$orig"`
# If we do not have enough common material, it is not

8
grep.h
View File

@ -10,17 +10,17 @@ enum grep_pat_token {
GREP_OPEN_PAREN,
GREP_CLOSE_PAREN,
GREP_NOT,
GREP_OR,
GREP_OR
};
enum grep_context {
GREP_CONTEXT_HEAD,
GREP_CONTEXT_BODY,
GREP_CONTEXT_BODY
};
enum grep_header_field {
GREP_HEADER_AUTHOR = 0,
GREP_HEADER_COMMITTER,
GREP_HEADER_COMMITTER
};
struct grep_pat {
@ -41,7 +41,7 @@ enum grep_expr_node {
GREP_NODE_ATOM,
GREP_NODE_NOT,
GREP_NODE_AND,
GREP_NODE_OR,
GREP_NODE_OR
};
struct grep_expr {

View File

@ -105,7 +105,7 @@ enum transfer_state {
RUN_PUT,
RUN_MOVE,
ABORTED,
COMPLETE,
COMPLETE
};
struct transfer_request

View File

@ -15,7 +15,7 @@ enum object_request_state {
WAITING,
ABORTED,
ACTIVE,
COMPLETE,
COMPLETE
};
struct object_request

View File

@ -230,7 +230,7 @@ enum CAPABILITY {
LITERALPLUS,
NAMESPACE,
STARTTLS,
AUTH_CRAM_MD5,
AUTH_CRAM_MD5
};
static const char *cap_list[] = {

View File

@ -139,17 +139,17 @@ static int ll_ext_merge(const struct ll_merge_driver *fn,
{
char temp[4][50];
struct strbuf cmd = STRBUF_INIT;
struct strbuf_expand_dict_entry dict[] = {
{ "O", temp[0] },
{ "A", temp[1] },
{ "B", temp[2] },
{ "L", temp[3] },
{ NULL }
};
struct strbuf_expand_dict_entry dict[5];
const char *args[] = { NULL, NULL };
int status, fd, i;
struct stat st;
dict[0].placeholder = "O"; dict[0].value = temp[0];
dict[1].placeholder = "A"; dict[1].value = temp[1];
dict[2].placeholder = "B"; dict[2].value = temp[2];
dict[3].placeholder = "L"; dict[3].value = temp[3];
dict[4].placeholder = NULL; dict[4].value = NULL;
if (fn->cmdline == NULL)
die("custom merge driver %s lacks command line.", fn->name);

View File

@ -10,7 +10,7 @@ struct merge_options {
enum {
MERGE_RECURSIVE_NORMAL = 0,
MERGE_RECURSIVE_OURS,
MERGE_RECURSIVE_THEIRS,
MERGE_RECURSIVE_THEIRS
} recursive_variant;
const char *subtree_shift;
unsigned buffer_output : 1;

View File

@ -25,7 +25,7 @@ enum parse_opt_flags {
PARSE_OPT_STOP_AT_NON_OPTION = 2,
PARSE_OPT_KEEP_ARGV0 = 4,
PARSE_OPT_KEEP_UNKNOWN = 8,
PARSE_OPT_NO_INTERNAL_HELP = 16,
PARSE_OPT_NO_INTERNAL_HELP = 16
};
enum parse_opt_option_flags {
@ -36,7 +36,7 @@ enum parse_opt_option_flags {
PARSE_OPT_LASTARG_DEFAULT = 16,
PARSE_OPT_NODASH = 32,
PARSE_OPT_LITERAL_ARGHELP = 64,
PARSE_OPT_NEGHELP = 128,
PARSE_OPT_NEGHELP = 128
};
struct option;
@ -160,7 +160,7 @@ extern NORETURN void usage_msg_opt(const char *msg,
enum {
PARSE_OPT_HELP = -1,
PARSE_OPT_DONE,
PARSE_OPT_UNKNOWN,
PARSE_OPT_UNKNOWN
};
/*

View File

@ -941,7 +941,7 @@ static size_t format_commit_item(struct strbuf *sb, const char *placeholder,
enum {
NO_MAGIC,
ADD_LF_BEFORE_NON_EMPTY,
DEL_LF_BEFORE_EMPTY,
DEL_LF_BEFORE_EMPTY
} magic = NO_MAGIC;
switch (placeholder[0]) {

6
refs.c
View File

@ -314,7 +314,11 @@ static int warn_if_dangling_symref(const char *refname, const unsigned char *sha
void warn_dangling_symref(FILE *fp, const char *msg_fmt, const char *refname)
{
struct warn_if_dangling_data data = { fp, refname, msg_fmt };
struct warn_if_dangling_data data;
data.fp = fp;
data.refname = refname;
data.msg_fmt = msg_fmt;
for_each_rawref(warn_if_dangling_symref, &data);
}

View File

@ -659,10 +659,9 @@ static struct refspec *parse_refspec_internal(int nr_refspec, const char **refsp
int valid_fetch_refspec(const char *fetch_refspec_str)
{
const char *fetch_refspec[] = { fetch_refspec_str };
struct refspec *refspec;
refspec = parse_refspec_internal(1, fetch_refspec, 1, 1);
refspec = parse_refspec_internal(1, &fetch_refspec_str, 1, 1);
free_refspecs(refspec, 1);
return !!refspec;
}

View File

@ -145,7 +145,7 @@ int branch_merge_matches(struct branch *, int n, const char *);
enum match_refs_flags {
MATCH_REFS_NONE = 0,
MATCH_REFS_ALL = (1 << 0),
MATCH_REFS_MIRROR = (1 << 1),
MATCH_REFS_MIRROR = (1 << 1)
};
/* Reporting of tracking info */

View File

@ -153,7 +153,7 @@ static int handle_path(unsigned char *sha1, struct rerere_io *io, int marker_siz
git_SHA_CTX ctx;
int hunk_no = 0;
enum {
RR_CONTEXT = 0, RR_SIDE_1, RR_SIDE_2, RR_ORIGINAL,
RR_CONTEXT = 0, RR_SIDE_1, RR_SIDE_2, RR_ORIGINAL
} hunk = RR_CONTEXT;
struct strbuf one = STRBUF_INIT, two = STRBUF_INIT;
struct strbuf buf = STRBUF_INIT;

View File

@ -1781,7 +1781,7 @@ int prepare_revision_walk(struct rev_info *revs)
enum rewrite_result {
rewrite_one_ok,
rewrite_one_noparents,
rewrite_one_error,
rewrite_one_error
};
static enum rewrite_result rewrite_one(struct rev_info *revs, struct commit **pp)

View File

@ -3,6 +3,7 @@
# Copyright (c) 2005 Junio C Hamano
#
-include ../config.mak.autogen
-include ../config.mak
#GIT_TEST_OPTS=--verbose --debug

View File

@ -91,7 +91,7 @@ check_output()
shift 1
if eval "$*" | entag > $_name.actual
then
diff $_name.expected $_name.actual
test_cmp $_name.expected $_name.actual
else
return 1;
fi

View File

@ -301,7 +301,7 @@ $expectfilter >expected <<\EOF
EOF
test_expect_success \
'validate git diff-files output for a know cache/work tree state.' \
'git diff-files >current && diff >/dev/null -b current expected'
'git diff-files >current && test_cmp current expected >/dev/null'
test_expect_success \
'git update-index --refresh should succeed.' \

View File

@ -43,7 +43,7 @@ test_expect_success \
git branch -l d/e/f &&
test -f .git/refs/heads/d/e/f &&
test -f .git/logs/refs/heads/d/e/f &&
diff expect .git/logs/refs/heads/d/e/f'
test_cmp expect .git/logs/refs/heads/d/e/f'
test_expect_success \
'git branch -d d/e/f should delete a branch and a log' \
@ -222,7 +222,7 @@ test_expect_success \
git checkout -b g/h/i -l master &&
test -f .git/refs/heads/g/h/i &&
test -f .git/logs/refs/heads/g/h/i &&
diff expect .git/logs/refs/heads/g/h/i'
test_cmp expect .git/logs/refs/heads/g/h/i'
test_expect_success 'checkout -b makes reflog by default' '
git checkout master &&

View File

@ -28,7 +28,7 @@ test_expect_success \
SHA1=`cat .git/refs/heads/a` &&
echo "$SHA1 refs/heads/a" >expect &&
git show-ref a >result &&
diff expect result'
test_cmp expect result'
test_expect_success \
'see if a branch still exists when packed' \
@ -37,7 +37,7 @@ test_expect_success \
rm -f .git/refs/heads/b &&
echo "$SHA1 refs/heads/b" >expect &&
git show-ref b >result &&
diff expect result'
test_cmp expect result'
test_expect_success 'git branch c/d should barf if branch c exists' '
git branch c &&
@ -52,7 +52,7 @@ test_expect_success \
git pack-refs --all --prune &&
echo "$SHA1 refs/heads/e" >expect &&
git show-ref e >result &&
diff expect result'
test_cmp expect result'
test_expect_success 'see if git pack-refs --prune remove ref files' '
git branch f &&
@ -109,7 +109,7 @@ test_expect_success 'pack, prune and repack' '
git show-ref >all-of-them &&
git pack-refs &&
git show-ref >again &&
diff all-of-them again
test_cmp all-of-them again
'
test_done

View File

@ -81,7 +81,7 @@ test_expect_success 'drop top stash' '
git stash &&
git stash drop &&
git stash list > stashlist2 &&
diff stashlist1 stashlist2 &&
test_cmp stashlist1 stashlist2 &&
git stash apply &&
test 3 = $(cat file) &&
test 1 = $(git show :file) &&

View File

@ -135,7 +135,7 @@ cmp_diff_files_output () {
# filesystem.
sed <"$2" >.test-tmp \
-e '/^:000000 /d;s/'$x40'\( [MCRNDU][0-9]*\) /'$z40'\1 /' &&
diff "$1" .test-tmp
test_cmp "$1" .test-tmp
}
test_expect_success \

View File

@ -44,7 +44,7 @@ test_fix () {
apply_patch --whitespace=fix || return 1
# find touched lines
diff file target | sed -n -e "s/^> //p" >fixed
$DIFF file target | sed -n -e "s/^> //p" >fixed
# the changed lines are all expeced to change
fixed_cnt=$(wc -l <fixed)
@ -85,14 +85,14 @@ test_expect_success setup '
test_expect_success 'whitespace=nowarn, default rule' '
apply_patch --whitespace=nowarn &&
diff file target
test_cmp file target
'
test_expect_success 'whitespace=warn, default rule' '
apply_patch --whitespace=warn &&
diff file target
test_cmp file target
'
@ -108,7 +108,7 @@ test_expect_success 'whitespace=error-all, no rule' '
git config core.whitespace -trailing,-space-before,-indent &&
apply_patch --whitespace=error-all &&
diff file target
test_cmp file target
'
@ -117,7 +117,7 @@ test_expect_success 'whitespace=error-all, no rule (attribute)' '
git config --unset core.whitespace &&
echo "target -whitespace" >.gitattributes &&
apply_patch --whitespace=error-all &&
diff file target
test_cmp file target
'

View File

@ -27,7 +27,7 @@ test_expect_success 'apply same filename with independent changes' '
cp same_fn same_fn2 &&
git reset --hard &&
git apply patch0 &&
diff same_fn same_fn2
test_cmp same_fn same_fn2
'
test_expect_success 'apply same filename with overlapping changes' '
@ -40,7 +40,7 @@ test_expect_success 'apply same filename with overlapping changes' '
cp same_fn same_fn2 &&
git reset --hard &&
git apply patch0 &&
diff same_fn same_fn2
test_cmp same_fn same_fn2
'
test_expect_success 'apply same new filename after rename' '
@ -54,7 +54,7 @@ test_expect_success 'apply same new filename after rename' '
cp new_fn new_fn2 &&
git reset --hard &&
git apply --index patch1 &&
diff new_fn new_fn2
test_cmp new_fn new_fn2
'
test_expect_success 'apply same old filename after rename -- should fail.' '

View File

@ -147,7 +147,7 @@ test_expect_success \
git cat-file $t $object || return 1
done <obj-list
} >current &&
diff expect current'
test_cmp expect current'
test_expect_success \
'use packed deltified (REF_DELTA) objects' \
@ -162,7 +162,7 @@ test_expect_success \
git cat-file $t $object || return 1
done <obj-list
} >current &&
diff expect current'
test_cmp expect current'
test_expect_success \
'use packed deltified (OFS_DELTA) objects' \
@ -177,7 +177,7 @@ test_expect_success \
git cat-file $t $object || return 1
done <obj-list
} >current &&
diff expect current'
test_cmp expect current'
unset GIT_OBJECT_DIRECTORY

View File

@ -71,7 +71,7 @@ test_expect_success "fetch test for-merge" '
echo "$one_in_two "
} >expected &&
cut -f -2 .git/FETCH_HEAD >actual &&
diff expected actual'
test_cmp expected actual'
test_expect_success 'fetch tags when there is no tags' '

View File

@ -26,7 +26,7 @@ cd "$D"
test_expect_success 'checking the results' '
test -f file &&
test -f cloned/file &&
diff file cloned/file
test_cmp file cloned/file
'
test_expect_success 'pulling into void using master:master' '

View File

@ -48,7 +48,7 @@ test_expect_success 'that reference gets used' \
'cd C &&
echo "0 objects, 0 kilobytes" > expected &&
git count-objects > current &&
diff expected current'
test_cmp expected current'
cd "$base_dir"
@ -75,7 +75,7 @@ cd "$base_dir"
test_expect_success 'that reference gets used' \
'cd D && echo "0 objects, 0 kilobytes" > expected &&
git count-objects > current &&
diff expected current'
test_cmp expected current'
cd "$base_dir"
@ -100,7 +100,7 @@ test_expect_success 'that alternate to origin gets used' \
'cd C &&
echo "2 objects" > expected &&
git count-objects | cut -d, -f1 > current &&
diff expected current'
test_cmp expected current'
cd "$base_dir"
@ -116,7 +116,7 @@ test_expect_success 'check objects expected to exist locally' \
'cd D &&
echo "5 objects" > expected &&
git count-objects | cut -d, -f1 > current &&
diff expected current'
test_cmp expected current'
cd "$base_dir"

View File

@ -84,7 +84,7 @@ check () {
git rev-list --parents --pretty=raw $arg |
sed -n -e 's/^commit //p' >test.actual
fi
diff test.expect test.actual
test_cmp test.expect test.actual
}
for type in basic parents parents-raw

View File

@ -280,7 +280,7 @@ test_expect_success 'updated working tree file should prevent the merge' '
echo "BAD: should have complained"
return 1
}
diff M M.saved || {
test_cmp M M.saved || {
echo "BAD: should have left M intact"
return 1
}
@ -301,7 +301,7 @@ test_expect_success 'updated working tree file should prevent the merge' '
echo "BAD: should have complained"
return 1
}
diff M M.saved || {
test_cmp M M.saved || {
echo "BAD: should have left M intact"
return 1
}

View File

@ -60,7 +60,7 @@ do
echo ${HC}file:5:foo_mmap bar mmap baz
} >expected &&
git grep -n -w -e mmap $H >actual &&
diff expected actual
test_cmp expected actual
'
test_expect_success "grep -w $L (w)" '
@ -74,7 +74,7 @@ do
echo ${HC}x:1:x x xx x
} >expected &&
git grep -n -w -e "x xx* x" $H >actual &&
diff expected actual
test_cmp expected actual
'
test_expect_success "grep -w $L (y-1)" '
@ -82,7 +82,7 @@ do
echo ${HC}y:1:y yy
} >expected &&
git grep -n -w -e "^y" $H >actual &&
diff expected actual
test_cmp expected actual
'
test_expect_success "grep -w $L (y-2)" '
@ -93,7 +93,7 @@ do
cat actual
false
else
diff expected actual
test_cmp expected actual
fi
'
@ -105,14 +105,14 @@ do
cat actual
false
else
diff expected actual
test_cmp expected actual
fi
'
test_expect_success "grep $L (t-1)" '
echo "${HC}t/t:1:test" >expected &&
git grep -n -e test $H >actual &&
diff expected actual
test_cmp expected actual
'
test_expect_success "grep $L (t-2)" '
@ -121,7 +121,7 @@ do
cd t &&
git grep -n -e test $H
) >actual &&
diff expected actual
test_cmp expected actual
'
test_expect_success "grep $L (t-3)" '
@ -130,7 +130,7 @@ do
cd t &&
git grep --full-name -n -e test $H
) >actual &&
diff expected actual
test_cmp expected actual
'
test_expect_success "grep -c $L (no /dev/null)" '

View File

@ -38,7 +38,7 @@ test_expect_success setup '
test_commit "$msg" &&
echo "$msg" >expect &&
git show -s --format=%s > actual &&
diff actual expect
test_cmp actual expect
'
@ -85,7 +85,7 @@ do
git --exec-path=. commit --amend &&
git show -s --pretty=oneline |
sed -e "s/^[0-9a-f]* //" >actual &&
diff actual expect
test_cmp actual expect
'
done
@ -107,7 +107,7 @@ do
git --exec-path=. commit --amend &&
git show -s --pretty=oneline |
sed -e "s/^[0-9a-f]* //" >actual &&
diff actual expect
test_cmp actual expect
'
done

View File

@ -63,10 +63,10 @@ test_expect_success \
check_entries B "newfile2.txt/1.1/" &&
check_entries C "newfile3.png/1.1/-kb" &&
check_entries D "newfile4.png/1.1/-kb" &&
diff A/newfile1.txt ../A/newfile1.txt &&
diff B/newfile2.txt ../B/newfile2.txt &&
diff C/newfile3.png ../C/newfile3.png &&
diff D/newfile4.png ../D/newfile4.png
test_cmp A/newfile1.txt ../A/newfile1.txt &&
test_cmp B/newfile2.txt ../B/newfile2.txt &&
test_cmp C/newfile3.png ../C/newfile3.png &&
test_cmp D/newfile4.png ../D/newfile4.png
)'
test_expect_success \
@ -89,10 +89,10 @@ test_expect_success \
check_entries D "newfile4.png/1.2/-kb" &&
check_entries E "newfile5.txt/1.1/" &&
check_entries F "newfile6.png/1.1/-kb" &&
diff A/newfile1.txt ../A/newfile1.txt &&
diff D/newfile4.png ../D/newfile4.png &&
diff E/newfile5.txt ../E/newfile5.txt &&
diff F/newfile6.png ../F/newfile6.png
test_cmp A/newfile1.txt ../A/newfile1.txt &&
test_cmp D/newfile4.png ../D/newfile4.png &&
test_cmp E/newfile5.txt ../E/newfile5.txt &&
test_cmp F/newfile6.png ../F/newfile6.png
)'
# Should fail (but only on the git cvsexportcommit stage)
@ -137,9 +137,9 @@ test_expect_success \
check_entries D "" &&
check_entries E "newfile5.txt/1.1/" &&
check_entries F "newfile6.png/1.1/-kb" &&
diff A/newfile1.txt ../A/newfile1.txt &&
diff E/newfile5.txt ../E/newfile5.txt &&
diff F/newfile6.png ../F/newfile6.png
test_cmp A/newfile1.txt ../A/newfile1.txt &&
test_cmp E/newfile5.txt ../E/newfile5.txt &&
test_cmp F/newfile6.png ../F/newfile6.png
)'
test_expect_success \
@ -155,8 +155,8 @@ test_expect_success \
check_entries D "" &&
check_entries E "newfile5.txt/1.1/" &&
check_entries F "newfile6.png/1.1/-kb" &&
diff E/newfile5.txt ../E/newfile5.txt &&
diff F/newfile6.png ../F/newfile6.png
test_cmp E/newfile5.txt ../E/newfile5.txt &&
test_cmp F/newfile6.png ../F/newfile6.png
)'
test_expect_success \

View File

@ -449,7 +449,7 @@ test_expect_success 'cvs update (-p)' '
rm -f failures &&
for i in merge no-lf empty really-empty; do
GIT_CONFIG="$git_config" cvs update -p "$i" >$i.out
diff $i.out ../$i >>failures 2>&1
test_cmp $i.out ../$i >>failures 2>&1
done &&
test -z "$(cat failures)"
'

View File

@ -75,7 +75,6 @@ export GIT_MERGE_VERBOSITY
export GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME
export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME
export EDITOR
GIT_TEST_CMP=${GIT_TEST_CMP:-diff -u}
# Protect ourselves from common misconfiguration to export
# CDPATH into the environment
@ -740,6 +739,16 @@ export PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR GIT_CONFIG_NOSYSTEM GIT_CONFIG_NOGLOB
. ../GIT-BUILD-OPTIONS
if test -z "$GIT_TEST_CMP"
then
if test -n "$GIT_TEST_CMP_USE_COPIED_CONTEXT"
then
GIT_TEST_CMP="$DIFF -c"
else
GIT_TEST_CMP="$DIFF -u"
fi
fi
GITPERLLIB=$(pwd)/../perl/blib/lib:$(pwd)/../perl/blib/arch/auto/Git
export GITPERLLIB
test -d ../templates/blt || {

View File

@ -279,9 +279,11 @@ static void add_same_unmerged(struct cache_entry *ce,
static int unpack_index_entry(struct cache_entry *ce,
struct unpack_trees_options *o)
{
struct cache_entry *src[5] = { ce, NULL, };
struct cache_entry *src[5] = { NULL };
int ret;
src[0] = ce;
mark_ce_used(ce, o);
if (ce_stage(ce)) {
if (o->skip_unmerged) {

View File

@ -521,17 +521,18 @@ static void wt_status_print_submodule_summary(struct wt_status *s, int uncommitt
struct child_process sm_summary;
char summary_limit[64];
char index[PATH_MAX];
const char *env[] = { index, NULL };
const char *argv[] = {
"submodule",
"summary",
uncommitted ? "--files" : "--cached",
"--for-status",
"--summary-limit",
summary_limit,
uncommitted ? NULL : (s->amend ? "HEAD^" : "HEAD"),
NULL
};
const char *env[] = { NULL, NULL };
const char *argv[8];
env[0] = index;
argv[0] = "submodule";
argv[1] = "summary";
argv[2] = uncommitted ? "--files" : "--cached";
argv[3] = "--for-status";
argv[4] = "--summary-limit";
argv[5] = summary_limit;
argv[6] = uncommitted ? NULL : (s->amend ? "HEAD^" : "HEAD");
argv[7] = NULL;
sprintf(summary_limit, "%d", s->submodule_summary);
snprintf(index, sizeof(index), "GIT_INDEX_FILE=%s", s->index_file);

View File

@ -13,7 +13,7 @@ enum color_wt_status {
WT_STATUS_NOBRANCH,
WT_STATUS_UNMERGED,
WT_STATUS_LOCAL_BRANCH,
WT_STATUS_REMOTE_BRANCH,
WT_STATUS_REMOTE_BRANCH
};
enum untracked_status_type {