git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 00/18] Portability patches for git-1.7.1
@ 2010-05-14  9:31 Gary V. Vaughan
  2010-05-14  9:31 ` [PATCH v5 01/18] Makefile: pass CPPFLAGS through to fllow customization Gary V. Vaughan
                   ` (19 more replies)
  0 siblings, 20 replies; 34+ messages in thread
From: Gary V. Vaughan @ 2010-05-14  9:31 UTC (permalink / raw)
  To: git

Momentum appears to have stalled on this portability patch set, but
I received a lot of great feed back on restructuring and tweaking, the
results of which follow. If there's anything else I can do to help the
adoption of some or all of these patches into upstream please don't
hesitate to ask.  There are no new changes in this v5 patchset, and
the additional 2 patches in the series over the last submission is
purely an artifact of the restructuring based on feedback.

So, as I said before: Here are the portability patches we needed at
TWW to enable git-1.7.1 to compile and run on all of the wide range of
Unix machines we support.  These patches apply to the git-1.7.1
release,  and address all of the feedback from the previous four
times I posted them to this list.

With the exception of a hand-full of test failures outside of Linux
and Solaris8+, git now compiles and passes all tests on the following
architectures:

        Solaris 2.6/SPARC
        Solaris 7/SPARC
        Solaris 8/SPARC
        Solaris 9/SPARC
        Solaris 10/SPARC
        Solaris 10/Intel
        HP-UX 10.20/PA
        HP-UX 11.00/PA
        HP-UX 11.11/PA
        HP-UX 11.23/PA
        HP-UX 11.23/IA
        HP-UX 11.31/PA
        HP-UX 11.31/IA
        AIX 5.1
        AIX 5.2
        AIX 5.3
        AIX 6.1
        Tru64 UNIX 5.1
        IRIX 6.5
        RHEL 3/x86
        RHEL 3/amd64
        RHEL 4/x86
        RHEL 4/amd64
        RHEL 5/x86
        RHEL 5/amd64
        SLES 10/x86
        SLES 10/amd64

Cheers,
-- 
Gary V. Vaughan (gary@thewrittenword.com)

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH v5 01/18] Makefile: pass CPPFLAGS through to fllow customization
  2010-05-14  9:31 [PATCH v5 00/18] Portability patches for git-1.7.1 Gary V. Vaughan
@ 2010-05-14  9:31 ` Gary V. Vaughan
  2010-05-14  9:53   ` Robin H. Johnson
  2010-05-14  9:31 ` [PATCH v5 02/18] Rewrite dynamic structure initializations to runtime assignment Gary V. Vaughan
                   ` (18 subsequent siblings)
  19 siblings, 1 reply; 34+ messages in thread
From: Gary V. Vaughan @ 2010-05-14  9:31 UTC (permalink / raw)
  To: git

[-- Attachment #1: user-cppflags.patch --]
[-- Type: text/plain, Size: 1193 bytes --]

Without this patch there is no straight forward way to pass additional
CPPFLAGS at configure-time.  At TWW, everything non-vendor package is
installed to its own subdirectory, so we need the following to show
the preprocessor where the headers for the libraries we will link
later can be found:

	$SHELL ./configure \
	CPPFLAGS="-I${SB_VAR_CURL_INC}\
	 -I${SB_VAR_LIBEXPAT_INC}\
	 -I${SB_VAR_LIBZ_INC}\
	${CPPFLAGS+ $CPPFLAGS}" <<...>>

Signed-off-by: Gary V. Vaughan <gary@thewrittenword.com>
---
 Makefile      |    2 +-
 config.mak.in |    1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

Index: b/Makefile
===================================================================
--- a/Makefile
+++ b/Makefile
@@ -246,7 +246,7 @@ endif
 
 CFLAGS = -g -O2 -Wall
 LDFLAGS =
-ALL_CFLAGS = $(CFLAGS)
+ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)
 STRIP ?= strip
 
Index: b/config.mak.in
===================================================================
--- a/config.mak.in
+++ b/config.mak.in
@@ -3,6 +3,7 @@
 
 CC = @CC@
 CFLAGS = @CFLAGS@
+CPPFLAGS = @CPPFLAGS@
 LDFLAGS = @LDFLAGS@
 CC_LD_DYNPATH = @CC_LD_DYNPATH@
 AR = @AR@

-- 
Gary V. Vaughan (gary@thewrittenword.com)

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH v5 02/18] Rewrite dynamic structure initializations to runtime assignment
  2010-05-14  9:31 [PATCH v5 00/18] Portability patches for git-1.7.1 Gary V. Vaughan
  2010-05-14  9:31 ` [PATCH v5 01/18] Makefile: pass CPPFLAGS through to fllow customization Gary V. Vaughan
@ 2010-05-14  9:31 ` Gary V. Vaughan
  2010-06-02  4:39   ` Junio C Hamano
  2010-05-14  9:31 ` [PATCH v5 03/18] Makefile: -lpthread may still be necessary when libc has only pthread stubs Gary V. Vaughan
                   ` (17 subsequent siblings)
  19 siblings, 1 reply; 34+ messages in thread
From: Gary V. Vaughan @ 2010-05-14  9:31 UTC (permalink / raw)
  To: git

[-- Attachment #1: const-expr.patch --]
[-- Type: text/plain, Size: 11136 bytes --]

Unfortunately, there are still plenty of production systems with
vendor compilers that choke unless all compound declarations can be
determined statically at compile time, for example hpux10.20 (I can
provide a comprehensive list of our supported platforms that exhibit
this problem if necessary).

This patch simply breaks apart any compound declarations with dynamic
initialisation expressions, and moves the initialisation until after
the last declaration in the same block, in all the places necessary to
have the offending compilers accept the code.

Signed-off-by: Gary V. Vaughan <gary@thewrittenword.com>
---
 builtin/add.c      |    4 +++-
 builtin/blame.c    |   10 ++++++----
 builtin/cat-file.c |    4 +++-
 builtin/checkout.c |    3 ++-
 builtin/commit.c   |    3 ++-
 builtin/fetch.c    |    6 ++++--
 builtin/remote.c   |    9 ++++++---
 convert.c          |    4 +++-
 daemon.c           |   19 ++++++++++---------
 ll-merge.c         |   14 +++++++-------
 refs.c             |    6 +++++-
 remote.c           |    3 +--
 unpack-trees.c     |    4 +++-
 wt-status.c        |   23 ++++++++++++-----------
 14 files changed, 67 insertions(+), 45 deletions(-)

Index: b/convert.c
===================================================================
--- a/convert.c
+++ b/convert.c
@@ -249,7 +249,9 @@ static int filter_buffer(int in, int out
 	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;
Index: b/remote.c
===================================================================
--- a/remote.c
+++ b/remote.c
@@ -657,10 +657,9 @@ static struct refspec *parse_refspec_int
 
 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;
 }
Index: b/unpack-trees.c
===================================================================
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -287,9 +287,11 @@ static void add_same_unmerged(struct cac
 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) {
Index: b/daemon.c
===================================================================
--- a/daemon.c
+++ b/daemon.c
@@ -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);
Index: b/wt-status.c
===================================================================
--- a/wt-status.c
+++ b/wt-status.c
@@ -498,17 +498,18 @@ static void wt_status_print_submodule_su
 	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);
Index: b/ll-merge.c
===================================================================
--- a/ll-merge.c
+++ b/ll-merge.c
@@ -139,17 +139,17 @@ static int ll_ext_merge(const struct ll_
 {
 	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);
 
Index: b/builtin/commit.c
===================================================================
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -717,7 +717,8 @@ static int prepare_to_commit(const char 
 
 	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,
Index: b/builtin/remote.c
===================================================================
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -705,11 +705,14 @@ static int rm(int argc, const char **arg
 	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);
 
Index: b/builtin/blame.c
===================================================================
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -733,10 +733,11 @@ static int pass_blame_to_parent(struct s
 {
 	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 sco
 	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.
 	 */
Index: b/builtin/cat-file.c
===================================================================
--- a/builtin/cat-file.c
+++ b/builtin/cat-file.c
@@ -118,7 +118,9 @@ static int cat_one_file(int opt, const c
 
 		/* 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);
 		}
 
Index: b/refs.c
===================================================================
--- a/refs.c
+++ b/refs.c
@@ -314,7 +314,11 @@ static int warn_if_dangling_symref(const
 
 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);
 }
 
Index: b/builtin/add.c
===================================================================
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -261,12 +261,14 @@ static int edit_patch(int argc, const ch
 {
 	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)
Index: b/builtin/checkout.c
===================================================================
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -609,7 +609,8 @@ static int check_tracking_name(const cha
 
 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;
Index: b/builtin/fetch.c
===================================================================
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -574,9 +574,10 @@ static void find_non_local_tags(struct t
 {
 	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 *
 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) {

-- 
Gary V. Vaughan (gary@thewrittenword.com)

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH v5 03/18] Makefile: -lpthread may still be necessary when libc has only pthread stubs
  2010-05-14  9:31 [PATCH v5 00/18] Portability patches for git-1.7.1 Gary V. Vaughan
  2010-05-14  9:31 ` [PATCH v5 01/18] Makefile: pass CPPFLAGS through to fllow customization Gary V. Vaughan
  2010-05-14  9:31 ` [PATCH v5 02/18] Rewrite dynamic structure initializations to runtime assignment Gary V. Vaughan
@ 2010-05-14  9:31 ` Gary V. Vaughan
  2010-05-14  9:31 ` [PATCH v5 04/18] enums: omit trailing comma for portability Gary V. Vaughan
                   ` (16 subsequent siblings)
  19 siblings, 0 replies; 34+ messages in thread
From: Gary V. Vaughan @ 2010-05-14  9:31 UTC (permalink / raw)
  To: git

[-- Attachment #1: pthread.patch --]
[-- Type: text/plain, Size: 3069 bytes --]

Without this patch, systems that provide stubs for pthread functions
in libc, but which still require libpthread for full the pthread
implementation are not detected correctly.

Also, some systems require -pthread in CFLAGS for each compilation
unit for a successful link of an mt binary, which is also addressed by
this patch.

Signed-off-by: Gary V. Vaughan <gary@thewrittenword.com>
---
 Makefile      |    4 ++++
 config.mak.in |    1 +
 configure.ac  |   17 +++++++++++++++--
 3 files changed, 20 insertions(+), 2 deletions(-)

Index: b/Makefile
===================================================================
--- a/Makefile
+++ b/Makefile
@@ -294,6 +294,7 @@ RPMBUILD = rpmbuild
 TCL_PATH = tclsh
 TCLTK_PATH = wish
 PTHREAD_LIBS = -lpthread
+PTHREAD_CFLAGS =
 
 export TCL_PATH TCLTK_PATH
 
@@ -898,6 +899,8 @@ ifeq ($(uname_S),AIX)
 	BASIC_CFLAGS += -D_LARGE_FILES
 	ifeq ($(shell expr "$(uname_V)" : '[1234]'),1)
 		NO_PTHREADS = YesPlease
+	else
+		PTHREAD_LIBS = -lpthread
 	endif
 endif
 ifeq ($(uname_S),GNU)
@@ -1349,6 +1352,7 @@ endif
 ifdef NO_PTHREADS
 	BASIC_CFLAGS += -DNO_PTHREADS
 else
+	BASIC_CFLAGS += $(PTHREAD_CFLAGS)
 	EXTLIBS += $(PTHREAD_LIBS)
 	LIB_OBJS += thread-utils.o
 endif
Index: b/configure.ac
===================================================================
--- a/configure.ac
+++ b/configure.ac
@@ -802,7 +802,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;
 }
 ])
 
@@ -819,7 +823,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'])
@@ -827,11 +832,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"
@@ -848,6 +860,7 @@ fi
 
 CFLAGS="$old_CFLAGS"
 
+AC_SUBST(PTHREAD_CFLAGS)
 AC_SUBST(PTHREAD_LIBS)
 AC_SUBST(NO_PTHREADS)
 
Index: b/config.mak.in
===================================================================
--- a/config.mak.in
+++ b/config.mak.in
@@ -57,4 +57,5 @@ NO_DEFLATE_BOUND=@NO_DEFLATE_BOUND@
 FREAD_READS_DIRECTORIES=@FREAD_READS_DIRECTORIES@
 SNPRINTF_RETURNS_BOGUS=@SNPRINTF_RETURNS_BOGUS@
 NO_PTHREADS=@NO_PTHREADS@
+PTHREAD_CFLAGS=@PTHREAD_CFLAGS@
 PTHREAD_LIBS=@PTHREAD_LIBS@

-- 
Gary V. Vaughan (gary@thewrittenword.com)

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH v5 04/18] enums: omit trailing comma for portability
  2010-05-14  9:31 [PATCH v5 00/18] Portability patches for git-1.7.1 Gary V. Vaughan
                   ` (2 preceding siblings ...)
  2010-05-14  9:31 ` [PATCH v5 03/18] Makefile: -lpthread may still be necessary when libc has only pthread stubs Gary V. Vaughan
@ 2010-05-14  9:31 ` Gary V. Vaughan
  2010-05-14  9:31 ` [PATCH v5 05/18] Do not use "diff" found on PATH while building and installing Gary V. Vaughan
                   ` (15 subsequent siblings)
  19 siblings, 0 replies; 34+ messages in thread
From: Gary V. Vaughan @ 2010-05-14  9:31 UTC (permalink / raw)
  To: git

[-- Attachment #1: enum-dangling-comma.patch --]
[-- Type: text/plain, Size: 13890 bytes --]

Without this patch at least IBM VisualAge C 5.0 (I have 5.0.2) on AIX
5.1 fails to compile git.

enum style is inconsistent already, with some enums declared on one
line, some over 3 lines with the enum values all on the middle line,
sometimes with 1 enum value per line... and independently of that the
trailing comma is sometimes present and other times absent, often
mixing with/without trailing comma styles in a single file, and
sometimes in consecutive enum declarations.

Clearly, omitting the comma is the more portable style, and this patch
changes all enum declarations to use the portable omitted dangling
comma style consistently.

Signed-off-by: Gary V. Vaughan <gary@thewrittenword.com>
---
 attr.h                 |    2 +-
 builtin/apply.c        |    4 ++--
 builtin/branch.c       |    4 ++--
 builtin/commit.c       |    6 +++---
 builtin/help.c         |    2 +-
 builtin/mailinfo.c     |    4 ++--
 builtin/receive-pack.c |    2 +-
 builtin/remote.c       |    2 +-
 cache.h                |   16 ++++++++--------
 commit.h               |    2 +-
 connect.c              |    2 +-
 ctype.c                |    2 +-
 diff.h                 |    2 +-
 dir.c                  |    6 +++---
 fast-import.c          |    2 +-
 grep.h                 |    8 ++++----
 http-push.c            |    2 +-
 http-walker.c          |    2 +-
 imap-send.c            |    2 +-
 merge-recursive.h      |    2 +-
 parse-options.h        |    6 +++---
 pretty.c               |    2 +-
 remote.h               |    2 +-
 rerere.c               |    2 +-
 revision.c             |    2 +-
 wt-status.h            |    2 +-
 26 files changed, 45 insertions(+), 45 deletions(-)

Index: b/attr.h
===================================================================
--- a/attr.h
+++ b/attr.h
@@ -34,7 +34,7 @@ int git_checkattr(const char *path, int,
 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 *);
 
Index: b/builtin/apply.c
===================================================================
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -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;
 
 
Index: b/builtin/branch.c
===================================================================
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -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];
 
Index: b/builtin/commit.c
===================================================================
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -57,7 +57,7 @@ static struct lock_file false_lock; /* u
 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
 static enum {
 	CLEANUP_SPACE,
 	CLEANUP_NONE,
-	CLEANUP_ALL,
+	CLEANUP_ALL
 } cleanup_mode;
 static char *cleanup_arg;
 
@@ -90,7 +90,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 opt_parse_m(const struct option *opt, const char *arg, int unset)
Index: b/builtin/help.c
===================================================================
--- a/builtin/help.c
+++ b/builtin/help.c
@@ -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;
Index: b/builtin/mailinfo.c
===================================================================
--- a/builtin/mailinfo.c
+++ b/builtin/mailinfo.c
@@ -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;
Index: b/builtin/receive-pack.c
===================================================================
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -16,7 +16,7 @@ enum deny_action {
 	DENY_UNCONFIGURED,
 	DENY_IGNORE,
 	DENY_WARN,
-	DENY_REFUSE,
+	DENY_REFUSE
 };
 
 static int deny_deletes;
Index: b/builtin/remote.c
===================================================================
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -317,7 +317,7 @@ struct push_info {
 		PUSH_STATUS_UPTODATE,
 		PUSH_STATUS_FASTFORWARD,
 		PUSH_STATUS_OUTOFDATE,
-		PUSH_STATUS_NOTQUERIED,
+		PUSH_STATUS_NOTQUERIED
 	} status;
 };
 
Index: b/cache.h
===================================================================
--- a/cache.h
+++ b/cache.h
@@ -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_defau
 
 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);
@@ -880,7 +880,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 */
Index: b/commit.h
===================================================================
--- a/commit.h
+++ b/commit.h
@@ -60,7 +60,7 @@ enum cmit_fmt {
 	CMIT_FMT_EMAIL,
 	CMIT_FMT_USERFORMAT,
 
-	CMIT_FMT_UNSPECIFIED,
+	CMIT_FMT_UNSPECIFIED
 };
 
 struct pretty_print_context
Index: b/connect.c
===================================================================
--- a/connect.c
+++ b/connect.c
@@ -131,7 +131,7 @@ int path_match(const char *path, int nr,
 enum protocol {
 	PROTO_LOCAL = 1,
 	PROTO_SSH,
-	PROTO_GIT,
+	PROTO_GIT
 };
 
 static enum protocol get_protocol(const char *name)
Index: b/ctype.c
===================================================================
--- a/ctype.c
+++ b/ctype.c
@@ -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] = {
Index: b/diff.h
===================================================================
--- a/diff.h
+++ b/diff.h
@@ -133,7 +133,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) \
Index: b/dir.c
===================================================================
--- a/dir.c
+++ b/dir.c
@@ -465,7 +465,7 @@ static struct dir_entry *dir_add_ignored
 enum exist_status {
 	index_nonexistent = 0,
 	index_directory,
-	index_gitdir,
+	index_gitdir
 };
 
 /*
@@ -533,7 +533,7 @@ static enum exist_status directory_exist
 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, 
 enum path_treatment {
 	path_ignored,
 	path_handled,
-	path_recurse,
+	path_recurse
 };
 
 static enum path_treatment treat_one_path(struct dir_struct *dir,
Index: b/fast-import.c
===================================================================
--- a/fast-import.c
+++ b/fast-import.c
@@ -267,7 +267,7 @@ struct hash_list
 typedef enum {
 	WHENSPEC_RAW = 1,
 	WHENSPEC_RFC2822,
-	WHENSPEC_NOW,
+	WHENSPEC_NOW
 } whenspec_type;
 
 struct recent_command
Index: b/grep.h
===================================================================
--- a/grep.h
+++ b/grep.h
@@ -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 {
@@ -40,7 +40,7 @@ enum grep_expr_node {
 	GREP_NODE_ATOM,
 	GREP_NODE_NOT,
 	GREP_NODE_AND,
-	GREP_NODE_OR,
+	GREP_NODE_OR
 };
 
 struct grep_expr {
Index: b/http-push.c
===================================================================
--- a/http-push.c
+++ b/http-push.c
@@ -105,7 +105,7 @@ enum transfer_state {
 	RUN_PUT,
 	RUN_MOVE,
 	ABORTED,
-	COMPLETE,
+	COMPLETE
 };
 
 struct transfer_request
Index: b/http-walker.c
===================================================================
--- a/http-walker.c
+++ b/http-walker.c
@@ -15,7 +15,7 @@ enum object_request_state {
 	WAITING,
 	ABORTED,
 	ACTIVE,
-	COMPLETE,
+	COMPLETE
 };
 
 struct object_request
Index: b/imap-send.c
===================================================================
--- a/imap-send.c
+++ b/imap-send.c
@@ -230,7 +230,7 @@ enum CAPABILITY {
 	LITERALPLUS,
 	NAMESPACE,
 	STARTTLS,
-	AUTH_CRAM_MD5,
+	AUTH_CRAM_MD5
 };
 
 static const char *cap_list[] = {
Index: b/merge-recursive.h
===================================================================
--- a/merge-recursive.h
+++ b/merge-recursive.h
@@ -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;
Index: b/parse-options.h
===================================================================
--- a/parse-options.h
+++ b/parse-options.h
@@ -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
 enum {
 	PARSE_OPT_HELP = -1,
 	PARSE_OPT_DONE,
-	PARSE_OPT_UNKNOWN,
+	PARSE_OPT_UNKNOWN
 };
 
 /*
Index: b/pretty.c
===================================================================
--- a/pretty.c
+++ b/pretty.c
@@ -828,7 +828,7 @@ static size_t format_commit_item(struct 
 	enum {
 		NO_MAGIC,
 		ADD_LF_BEFORE_NON_EMPTY,
-		DEL_LF_BEFORE_EMPTY,
+		DEL_LF_BEFORE_EMPTY
 	} magic = NO_MAGIC;
 
 	switch (placeholder[0]) {
Index: b/remote.h
===================================================================
--- a/remote.h
+++ b/remote.h
@@ -145,7 +145,7 @@ int branch_merge_matches(struct branch *
 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 */
Index: b/rerere.c
===================================================================
--- a/rerere.c
+++ b/rerere.c
@@ -153,7 +153,7 @@ static int handle_path(unsigned char *sh
 	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;
Index: b/revision.c
===================================================================
--- a/revision.c
+++ b/revision.c
@@ -1781,7 +1781,7 @@ int prepare_revision_walk(struct rev_inf
 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)
Index: b/wt-status.h
===================================================================
--- a/wt-status.h
+++ b/wt-status.h
@@ -11,7 +11,7 @@ enum color_wt_status {
 	WT_STATUS_CHANGED,
 	WT_STATUS_UNTRACKED,
 	WT_STATUS_NOBRANCH,
-	WT_STATUS_UNMERGED,
+	WT_STATUS_UNMERGED
 };
 
 enum untracked_status_type {

-- 
Gary V. Vaughan (gary@thewrittenword.com)

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH v5 05/18] Do not use "diff" found on PATH while building and installing
  2010-05-14  9:31 [PATCH v5 00/18] Portability patches for git-1.7.1 Gary V. Vaughan
                   ` (3 preceding siblings ...)
  2010-05-14  9:31 ` [PATCH v5 04/18] enums: omit trailing comma for portability Gary V. Vaughan
@ 2010-05-14  9:31 ` Gary V. Vaughan
  2010-06-02  4:39   ` Junio C Hamano
  2010-05-14  9:31 ` [PATCH v5 06/18] tests: use "test_cmp", not "diff", when verifying the result Gary V. Vaughan
                   ` (14 subsequent siblings)
  19 siblings, 1 reply; 34+ messages in thread
From: Gary V. Vaughan @ 2010-05-14  9:31 UTC (permalink / raw)
  To: git

[-- Attachment #1: diff-export.patch --]
[-- Type: text/plain, Size: 3108 bytes --]

Some of the flags used with the first diff found in PATH cause the
vendor diff to choke.

Signed-off-by: Gary V. Vaughan <gary@thewrittenword.com>
---
 Documentation/install-webdoc.sh |    2 +-
 Makefile                        |    4 +++-
 config.mak.in                   |    1 +
 configure.ac                    |    1 +
 git-merge-one-file.sh           |    2 +-
 5 files changed, 7 insertions(+), 3 deletions(-)

Index: b/Makefile
===================================================================
--- a/Makefile
+++ b/Makefile
@@ -287,6 +287,7 @@ export prefix bindir sharedir sysconfdir
 CC = gcc
 AR = ar
 RM = rm -f
+DIFF = diff
 TAR = tar
 FIND = find
 INSTALL = install
@@ -1460,7 +1461,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
@@ -1877,6 +1878,7 @@ 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 TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@
 	@echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@
 	@echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@
Index: b/configure.ac
===================================================================
--- a/configure.ac
+++ b/configure.ac
@@ -362,6 +362,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
Index: b/Documentation/install-webdoc.sh
===================================================================
--- a/Documentation/install-webdoc.sh
+++ b/Documentation/install-webdoc.sh
@@ -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
Index: b/git-merge-one-file.sh
===================================================================
--- a/git-merge-one-file.sh
+++ b/git-merge-one-file.sh
@@ -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
Index: b/config.mak.in
===================================================================
--- a/config.mak.in
+++ b/config.mak.in
@@ -8,6 +8,7 @@ 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@
 

-- 
Gary V. Vaughan (gary@thewrittenword.com)

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH v5 06/18] tests: use "test_cmp", not "diff", when verifying the result
  2010-05-14  9:31 [PATCH v5 00/18] Portability patches for git-1.7.1 Gary V. Vaughan
                   ` (4 preceding siblings ...)
  2010-05-14  9:31 ` [PATCH v5 05/18] Do not use "diff" found on PATH while building and installing Gary V. Vaughan
@ 2010-05-14  9:31 ` Gary V. Vaughan
  2010-06-02  4:39   ` Junio C Hamano
  2010-05-14  9:31 ` [PATCH v5 07/18] test_cmp: do not use "diff -u" on platforms that lack one Gary V. Vaughan
                   ` (13 subsequent siblings)
  19 siblings, 1 reply; 34+ messages in thread
From: Gary V. Vaughan @ 2010-05-14  9:31 UTC (permalink / raw)
  To: git

[-- Attachment #1: diff-test_cmp.patch --]
[-- Type: text/plain, Size: 16445 bytes --]

In tests, call test_cmp rather than raw diff where possible (i.e. if
the output does not go to a pipe), to allow the use of, say, 'cmp'
when the default 'diff -u' is not compatible with a vendor diff.

When that is not possible, use $DIFF, as set in GIT-BUILD-OPTIONS.

Signed-off-by: Gary V. Vaughan <gary@thewrittenword.com>
---
 t/Makefile                      |    4 ++++
 t/t0000-basic.sh                |    2 +-
 t/t3200-branch.sh               |    4 ++--
 t/t3210-pack-refs.sh            |    8 ++++----
 t/t3903-stash.sh                |    2 +-
 t/t4002-diff-basic.sh           |    2 +-
 t/t4124-apply-ws-rule.sh        |   10 +++++-----
 t/t4127-apply-same-fn.sh        |    6 +++---
 t/t5300-pack-object.sh          |    6 +++---
 t/t5510-fetch.sh                |    2 +-
 t/t5520-pull.sh                 |    2 +-
 t/t5700-clone-reference.sh      |    8 ++++----
 t/t6000lib.sh                   |    2 +-
 t/t6001-rev-list-graft.sh       |    2 +-
 t/t6022-merge-rename.sh         |    4 ++--
 t/t7002-grep.sh                 |   16 ++++++++--------
 t/t7005-editor.sh               |    6 +++---
 t/t9200-git-cvsexportcommit.sh  |   26 +++++++++++++-------------
 t/t9400-git-cvsserver-server.sh |    2 +-
 19 files changed, 59 insertions(+), 55 deletions(-)

Index: b/t/t0000-basic.sh
===================================================================
--- a/t/t0000-basic.sh
+++ b/t/t0000-basic.sh
@@ -280,7 +280,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.' \
Index: b/t/t3200-branch.sh
===================================================================
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -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 'avoid ambiguous track' '
 	git config branch.autosetupmerge true &&
Index: b/t/t3210-pack-refs.sh
===================================================================
--- a/t/t3210-pack-refs.sh
+++ b/t/t3210-pack-refs.sh
@@ -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 rep
 	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
Index: b/t/t4002-diff-basic.sh
===================================================================
--- a/t/t4002-diff-basic.sh
+++ b/t/t4002-diff-basic.sh
@@ -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 \
Index: b/t/t4124-apply-ws-rule.sh
===================================================================
--- a/t/t4124-apply-ws-rule.sh
+++ b/t/t4124-apply-ws-rule.sh
@@ -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-al
 
 	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-al
 	git config --unset core.whitespace &&
 	echo "target -whitespace" >.gitattributes &&
 	apply_patch --whitespace=error-all &&
-	diff file target
+	test_cmp file target
 
 '
 
Index: b/t/t5300-pack-object.sh
===================================================================
--- a/t/t5300-pack-object.sh
+++ b/t/t5300-pack-object.sh
@@ -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
 
Index: b/t/t5510-fetch.sh
===================================================================
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
@@ -71,7 +71,7 @@ test_expect_success "fetch test for-merg
 		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' '
 
Index: b/t/t5520-pull.sh
===================================================================
--- a/t/t5520-pull.sh
+++ b/t/t5520-pull.sh
@@ -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' '
Index: b/t/t5700-clone-reference.sh
===================================================================
--- a/t/t5700-clone-reference.sh
+++ b/t/t5700-clone-reference.sh
@@ -48,7 +48,7 @@ test_expect_success 'that reference gets
 '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 o
 '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 expec
 'cd D &&
 echo "5 objects" > expected &&
 git count-objects | cut -d, -f1 > current &&
-diff expected current'
+test_cmp expected current'
 
 cd "$base_dir"
 
Index: b/t/t6000lib.sh
===================================================================
--- a/t/t6000lib.sh
+++ b/t/t6000lib.sh
@@ -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
Index: b/t/t6001-rev-list-graft.sh
===================================================================
--- a/t/t6001-rev-list-graft.sh
+++ b/t/t6001-rev-list-graft.sh
@@ -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
Index: b/t/t6022-merge-rename.sh
===================================================================
--- a/t/t6022-merge-rename.sh
+++ b/t/t6022-merge-rename.sh
@@ -280,7 +280,7 @@ test_expect_success 'updated working tre
 		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 tre
 		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
 	}
Index: b/t/t7002-grep.sh
===================================================================
--- a/t/t7002-grep.sh
+++ b/t/t7002-grep.sh
@@ -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)" '
Index: b/t/t7005-editor.sh
===================================================================
--- a/t/t7005-editor.sh
+++ b/t/t7005-editor.sh
@@ -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
 
Index: b/t/t9200-git-cvsexportcommit.sh
===================================================================
--- a/t/t9200-git-cvsexportcommit.sh
+++ b/t/t9200-git-cvsexportcommit.sh
@@ -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 \
Index: b/t/t9400-git-cvsserver-server.sh
===================================================================
--- a/t/t9400-git-cvsserver-server.sh
+++ b/t/t9400-git-cvsserver-server.sh
@@ -435,7 +435,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)"
 '
Index: b/t/t3903-stash.sh
===================================================================
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
@@ -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) &&
Index: b/t/t4127-apply-same-fn.sh
===================================================================
--- a/t/t4127-apply-same-fn.sh
+++ b/t/t4127-apply-same-fn.sh
@@ -27,7 +27,7 @@ test_expect_success 'apply same filename
 	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
 	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 file
 	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.' '
Index: b/t/Makefile
===================================================================
--- a/t/Makefile
+++ b/t/Makefile
@@ -6,10 +6,14 @@
 -include ../config.mak
 
 #GIT_TEST_OPTS=--verbose --debug
+GIT_TEST_CMP ?= $(DIFF)
 SHELL_PATH ?= $(SHELL)
 TAR ?= $(TAR)
 RM ?= rm -f
 
+# Make sure test-lib.sh uses make's value of GIT_TEST_CMP
+export GIT_TEST_CMP
+
 # Shell quote;
 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
 

-- 
Gary V. Vaughan (gary@thewrittenword.com)

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH v5 07/18] test_cmp: do not use "diff -u" on platforms that lack one
  2010-05-14  9:31 [PATCH v5 00/18] Portability patches for git-1.7.1 Gary V. Vaughan
                   ` (5 preceding siblings ...)
  2010-05-14  9:31 ` [PATCH v5 06/18] tests: use "test_cmp", not "diff", when verifying the result Gary V. Vaughan
@ 2010-05-14  9:31 ` Gary V. Vaughan
  2010-05-14  9:31 ` [PATCH v5 08/18] git-compat-util.h: some platforms with mmap() lack MAP_FAILED definition Gary V. Vaughan
                   ` (12 subsequent siblings)
  19 siblings, 0 replies; 34+ messages in thread
From: Gary V. Vaughan @ 2010-05-14  9:31 UTC (permalink / raw)
  To: git

[-- Attachment #1: diff-defaults.patch --]
[-- Type: text/plain, Size: 2163 bytes --]

By default the testsuite calls 'diff -u' whenever a file comparison is
called for.  Unfortunately that throws a "diff: unknown option '-u'"
error for most non-GNU diffs.

This patch sets GIT_TEST_CMP to 'cmp' on all the architectures where
that happens.  The previous version of this patch forgot to export
GIT_TEST_CMP from t/Makefile, which is why 'make test' continued to
fail most tests on most architectures - test-lib.sh was falling back
on its default of `diff -u' for GIT_TEST_CMP.  This version of this
patch shows a vast improvement in testsuite results where either GNU
diff is in the path at configure time, or where Makefile knows that
GIT_TEST_CMP=cmp is required.

Signed-off-by: Gary V. Vaughan <gary@thewrittenword.com>
---
 Makefile   |    5 +++++
 t/Makefile |    1 +
 2 files changed, 6 insertions(+)

Index: b/Makefile
===================================================================
--- a/Makefile
+++ b/Makefile
@@ -815,18 +815,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
@@ -903,6 +906,7 @@ ifeq ($(uname_S),AIX)
 	else
 		PTHREAD_LIBS = -lpthread
 	endif
+	GIT_TEST_CMP = cmp
 endif
 ifeq ($(uname_S),GNU)
 	# GNU/Hurd
@@ -957,6 +961,7 @@ ifeq ($(uname_S),HP-UX)
 	NO_HSTRERROR = YesPlease
 	NO_SYS_SELECT_H = YesPlease
 	SNPRINTF_RETURNS_BOGUS = YesPlease
+	GIT_TEST_CMP = cmp
 endif
 ifeq ($(uname_S),Windows)
 	GIT_VERSION := $(GIT_VERSION).MSVC
Index: b/t/Makefile
===================================================================
--- a/t/Makefile
+++ b/t/Makefile
@@ -3,6 +3,7 @@
 # Copyright (c) 2005 Junio C Hamano
 #
 
+-include ../config.mak.autogen
 -include ../config.mak
 
 #GIT_TEST_OPTS=--verbose --debug

-- 
Gary V. Vaughan (gary@thewrittenword.com)

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH v5 08/18] git-compat-util.h: some platforms with mmap() lack MAP_FAILED definition
  2010-05-14  9:31 [PATCH v5 00/18] Portability patches for git-1.7.1 Gary V. Vaughan
                   ` (6 preceding siblings ...)
  2010-05-14  9:31 ` [PATCH v5 07/18] test_cmp: do not use "diff -u" on platforms that lack one Gary V. Vaughan
@ 2010-05-14  9:31 ` Gary V. Vaughan
  2010-05-14  9:31 ` [PATCH v5 09/18] Makefile: some platforms do not have hstrerror anywhere Gary V. Vaughan
                   ` (11 subsequent siblings)
  19 siblings, 0 replies; 34+ messages in thread
From: Gary V. Vaughan @ 2010-05-14  9:31 UTC (permalink / raw)
  To: git

[-- Attachment #1: no-MAP_FAILED.patch --]
[-- Type: text/plain, Size: 815 bytes --]

Some platforms with mmap() lack MAP_FAILED definition.

Signed-off-by: Gary V. Vaughan <gary@thewrittenword.com>
---
 git-compat-util.h |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Index: b/git-compat-util.h
===================================================================
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -217,7 +217,6 @@ static inline const char *skip_prefix(co
 #define PROT_READ 1
 #define PROT_WRITE 2
 #define MAP_PRIVATE 1
-#define MAP_FAILED ((void*)-1)
 #endif
 
 #define mmap git_mmap
@@ -246,6 +245,10 @@ extern int git_munmap(void *start, size_
 
 #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

-- 
Gary V. Vaughan (gary@thewrittenword.com)

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH v5 09/18] Makefile: some platforms do not have hstrerror anywhere
  2010-05-14  9:31 [PATCH v5 00/18] Portability patches for git-1.7.1 Gary V. Vaughan
                   ` (7 preceding siblings ...)
  2010-05-14  9:31 ` [PATCH v5 08/18] git-compat-util.h: some platforms with mmap() lack MAP_FAILED definition Gary V. Vaughan
@ 2010-05-14  9:31 ` Gary V. Vaughan
  2010-05-14  9:31 ` [PATCH v5 10/18] Make NO_{INET_NTOP,INET_PTON} configured independently Gary V. Vaughan
                   ` (10 subsequent siblings)
  19 siblings, 0 replies; 34+ messages in thread
From: Gary V. Vaughan @ 2010-05-14  9:31 UTC (permalink / raw)
  To: git

[-- Attachment #1: no-hstrerror.patch --]
[-- Type: text/plain, Size: 1734 bytes --]

This patch improves the logic of the test for hstrerror, not to
blindly assume that if there is no hstrerror in libc that it must
exist in libresolv.

Signed-off-by: Gary V. Vaughan <gary@thewrittenword.com>
---
 config.mak.in |    1 +
 configure.ac  |   17 ++++++++++++++---
 2 files changed, 15 insertions(+), 3 deletions(-)

Index: b/configure.ac
===================================================================
--- a/configure.ac
+++ b/configure.ac
@@ -546,11 +546,22 @@ test -n "$NEEDS_SOCKET" && LIBS="$LIBS -
 
 #
 # 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],
+# Notably on Solaris 7 inet_ntop and inet_pton additionally reside there.
+AC_CHECK_LIB([c], [inet_ntop],
 [NEEDS_RESOLV=],
 [NEEDS_RESOLV=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)
+
 AC_SUBST(NEEDS_RESOLV)
 test -n "$NEEDS_RESOLV" && LIBS="$LIBS -lresolv"
 
Index: b/config.mak.in
===================================================================
--- a/config.mak.in
+++ b/config.mak.in
@@ -43,6 +43,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@

-- 
Gary V. Vaughan (gary@thewrittenword.com)

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH v5 10/18] Make NO_{INET_NTOP,INET_PTON} configured independently
  2010-05-14  9:31 [PATCH v5 00/18] Portability patches for git-1.7.1 Gary V. Vaughan
                   ` (8 preceding siblings ...)
  2010-05-14  9:31 ` [PATCH v5 09/18] Makefile: some platforms do not have hstrerror anywhere Gary V. Vaughan
@ 2010-05-14  9:31 ` Gary V. Vaughan
  2010-05-14  9:31 ` [PATCH v5 11/18] Some platforms lack socklen_t type Gary V. Vaughan
                   ` (9 subsequent siblings)
  19 siblings, 0 replies; 34+ messages in thread
From: Gary V. Vaughan @ 2010-05-14  9:31 UTC (permalink / raw)
  To: git

[-- Attachment #1: no-inet_ntop.patch --]
[-- Type: text/plain, Size: 2510 bytes --]

Being careful not to overwrite the results of testing for hstrerror in
libresolv, also test whether inet_ntop/inet_pton are available from
that library.

Signed-off-by: Gary V. Vaughan <gary@thewrittenword.com>
---
 config.mak.in |    2 ++
 configure.ac  |   37 ++++++++++++++++++++++++++++++-------
 2 files changed, 32 insertions(+), 7 deletions(-)

Index: b/configure.ac
===================================================================
--- a/configure.ac
+++ b/configure.ac
@@ -545,11 +545,33 @@ 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 7 inet_ntop and inet_pton additionally reside there.
-AC_CHECK_LIB([c], [inet_ntop],
-[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.
@@ -561,8 +583,9 @@ AC_CHECK_FUNC([hstrerror],
 	[NO_HSTRERROR=YesPlease])
 ])
 AC_SUBST(NO_HSTRERROR)
-
-AC_SUBST(NEEDS_RESOLV)
+#
+# 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],
Index: b/config.mak.in
===================================================================
--- a/config.mak.in
+++ b/config.mak.in
@@ -53,6 +53,8 @@ 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@

-- 
Gary V. Vaughan (gary@thewrittenword.com)

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH v5 11/18] Some platforms lack socklen_t type
  2010-05-14  9:31 [PATCH v5 00/18] Portability patches for git-1.7.1 Gary V. Vaughan
                   ` (9 preceding siblings ...)
  2010-05-14  9:31 ` [PATCH v5 10/18] Make NO_{INET_NTOP,INET_PTON} configured independently Gary V. Vaughan
@ 2010-05-14  9:31 ` Gary V. Vaughan
  2010-05-14  9:31 ` [PATCH v5 12/18] Allow disabling "inline" Gary V. Vaughan
                   ` (8 subsequent siblings)
  19 siblings, 0 replies; 34+ messages in thread
From: Gary V. Vaughan @ 2010-05-14  9:31 UTC (permalink / raw)
  To: git

[-- Attachment #1: no-socklen_t.patch --]
[-- Type: text/plain, Size: 3824 bytes --]

Some platforms do not have a socklen_t type declaration.

Signed-off-by: Gary V. Vaughan <gary@thewrittenword.com>
---
 Makefile      |    7 +++++++
 aclocal.m4    |   41 +++++++++++++++++++++++++++++++++++++++++
 config.mak.in |    1 +
 configure.ac  |    6 ++++++
 4 files changed, 55 insertions(+)

Index: b/Makefile
===================================================================
--- a/Makefile
+++ b/Makefile
@@ -8,6 +8,9 @@ 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 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.
@@ -1087,6 +1090,10 @@ else
 BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
 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)
Index: b/configure.ac
===================================================================
--- a/configure.ac
+++ b/configure.ac
@@ -633,6 +633,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=],
Index: b/config.mak.in
===================================================================
--- a/config.mak.in
+++ b/config.mak.in
@@ -58,6 +58,7 @@ NO_INET_PTON=@NO_INET_PTON@
 NO_ICONV=@NO_ICONV@
 OLD_ICONV=@OLD_ICONV@
 NO_DEFLATE_BOUND=@NO_DEFLATE_BOUND@
+SOCKLEN_T=@SOCKLEN_T@
 FREAD_READS_DIRECTORIES=@FREAD_READS_DIRECTORIES@
 SNPRINTF_RETURNS_BOGUS=@SNPRINTF_RETURNS_BOGUS@
 NO_PTHREADS=@NO_PTHREADS@
Index: b/aclocal.m4
===================================================================
--- /dev/null
+++ b/aclocal.m4
@@ -0,0 +1,41 @@
+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>])
+])
+

-- 
Gary V. Vaughan (gary@thewrittenword.com)

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH v5 12/18] Allow disabling "inline"
  2010-05-14  9:31 [PATCH v5 00/18] Portability patches for git-1.7.1 Gary V. Vaughan
                   ` (10 preceding siblings ...)
  2010-05-14  9:31 ` [PATCH v5 11/18] Some platforms lack socklen_t type Gary V. Vaughan
@ 2010-05-14  9:31 ` Gary V. Vaughan
  2010-05-14  9:31 ` [PATCH v5 13/18] inline declaration does not work on AIX Gary V. Vaughan
                   ` (7 subsequent siblings)
  19 siblings, 0 replies; 34+ messages in thread
From: Gary V. Vaughan @ 2010-05-14  9:31 UTC (permalink / raw)
  To: git

[-- Attachment #1: no-inline.patch --]
[-- Type: text/plain, Size: 2212 bytes --]

Compiler support for inline is sometimes buggy, and occasionally
missing entirely.  This patch adds a test for inline support, and
redefines the keyword with the preprocessor if necessary at compile
time.

Signed-off-by: Gary V. Vaughan <gary@thewrittenword.com>
---
 Makefile      |    7 +++++++
 config.mak.in |    1 +
 configure.ac  |    6 ++++++
 3 files changed, 14 insertions(+)

Index: b/Makefile
===================================================================
--- a/Makefile
+++ b/Makefile
@@ -11,6 +11,9 @@ all::
 # 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.
@@ -1090,6 +1093,10 @@ 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
Index: b/configure.ac
===================================================================
--- a/configure.ac
+++ b/configure.ac
@@ -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}"
Index: b/config.mak.in
===================================================================
--- a/config.mak.in
+++ b/config.mak.in
@@ -58,6 +58,7 @@ 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@

-- 
Gary V. Vaughan (gary@thewrittenword.com)

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH v5 13/18] inline declaration does not work on AIX
  2010-05-14  9:31 [PATCH v5 00/18] Portability patches for git-1.7.1 Gary V. Vaughan
                   ` (11 preceding siblings ...)
  2010-05-14  9:31 ` [PATCH v5 12/18] Allow disabling "inline" Gary V. Vaughan
@ 2010-05-14  9:31 ` Gary V. Vaughan
  2010-05-14  9:31 ` [PATCH v5 14/18] Makefile: SunOS 5.6 portability fix Gary V. Vaughan
                   ` (6 subsequent siblings)
  19 siblings, 0 replies; 34+ messages in thread
From: Gary V. Vaughan @ 2010-05-14  9:31 UTC (permalink / raw)
  To: git

[-- Attachment #1: host-AIX.patch --]
[-- Type: text/plain, Size: 534 bytes --]

Define away inline declaration on AIX.

Signed-off-by: Gary V. Vaughan <gary@thewrittenword.com>
---
 Makefile |    3 +++
 1 file changed, 3 insertions(+)

Index: b/Makefile
===================================================================
--- a/Makefile
+++ b/Makefile
@@ -912,6 +912,9 @@ ifeq ($(uname_S),AIX)
 	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)

-- 
Gary V. Vaughan (gary@thewrittenword.com)

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH v5 14/18] Makefile: SunOS 5.6 portability fix
  2010-05-14  9:31 [PATCH v5 00/18] Portability patches for git-1.7.1 Gary V. Vaughan
                   ` (12 preceding siblings ...)
  2010-05-14  9:31 ` [PATCH v5 13/18] inline declaration does not work on AIX Gary V. Vaughan
@ 2010-05-14  9:31 ` Gary V. Vaughan
  2010-05-14  9:31 ` [PATCH v5 15/18] git-compat-util.h: Irix 6.5 defines sgi but not __sgi Gary V. Vaughan
                   ` (5 subsequent siblings)
  19 siblings, 0 replies; 34+ messages in thread
From: Gary V. Vaughan @ 2010-05-14  9:31 UTC (permalink / raw)
  To: git

[-- Attachment #1: host-SunOS56.patch --]
[-- Type: text/plain, Size: 949 bytes --]

Although configure takes care of most of this, set some default values
for Solaris 2.6 (aka SunOS-5.6) to ensure git compiles even when
configure is not used to build it.

Signed-off-by: Gary V. Vaughan <gary@thewrittenword.com>
---
 Makefile |   12 ++++++++++++
 1 file changed, 12 insertions(+)

Index: b/Makefile
===================================================================
--- a/Makefile
+++ b/Makefile
@@ -812,6 +812,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

-- 
Gary V. Vaughan (gary@thewrittenword.com)

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH v5 15/18] git-compat-util.h: Irix 6.5 defines sgi but not __sgi.
  2010-05-14  9:31 [PATCH v5 00/18] Portability patches for git-1.7.1 Gary V. Vaughan
                   ` (13 preceding siblings ...)
  2010-05-14  9:31 ` [PATCH v5 14/18] Makefile: SunOS 5.6 portability fix Gary V. Vaughan
@ 2010-05-14  9:31 ` Gary V. Vaughan
  2010-06-02  1:55   ` [PATCH] git-compat-util.h: use apparently more common __sgi macro to detect SGI IRIX Brandon Casey
  2010-05-14  9:31 ` [PATCH v5 16/18] Makefile: HPUX11 portability fixes Gary V. Vaughan
                   ` (4 subsequent siblings)
  19 siblings, 1 reply; 34+ messages in thread
From: Gary V. Vaughan @ 2010-05-14  9:31 UTC (permalink / raw)
  To: git

[-- Attachment #1: host-IRIX.patch --]
[-- Type: text/plain, Size: 851 bytes --]

Irix 6.5 does not define 'sgi', but does define '__sgi'.

Signed-off-by: Gary V. Vaughan <gary@thewrittenword.com>
---
 git-compat-util.h |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: b/git-compat-util.h
===================================================================
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -56,7 +56,8 @@
 # define _XOPEN_SOURCE 500
 # endif
 #elif !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__USLC__) && \
-      !defined(_M_UNIX) && !defined(sgi) && !defined(__DragonFly__)
+      !defined(_M_UNIX) && !defined(sgi) && !defined(__sgi) && \
+      !defined(__DragonFly__)
 #define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500, OpenBSD needs 600 for S_ISLNK() */
 #define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */
 #endif

-- 
Gary V. Vaughan (gary@thewrittenword.com)

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH v5 16/18] Makefile: HPUX11 portability fixes.
  2010-05-14  9:31 [PATCH v5 00/18] Portability patches for git-1.7.1 Gary V. Vaughan
                   ` (14 preceding siblings ...)
  2010-05-14  9:31 ` [PATCH v5 15/18] git-compat-util.h: Irix 6.5 defines sgi but not __sgi Gary V. Vaughan
@ 2010-05-14  9:31 ` Gary V. Vaughan
  2010-05-14  9:31 ` [PATCH v5 17/18] Makefile: HP-UX 10.20 " Gary V. Vaughan
                   ` (3 subsequent siblings)
  19 siblings, 0 replies; 34+ messages in thread
From: Gary V. Vaughan @ 2010-05-14  9:31 UTC (permalink / raw)
  To: git

[-- Attachment #1: host-HPUX11.patch --]
[-- Type: text/plain, Size: 927 bytes --]

There is no nanosecond field on HPUX, the inline keyword is
spelled "__inline", and there are no inet_ntop/inet_pton definitions
on HP-UX 11.00

Signed-off-by: Gary V. Vaughan <gary@thewrittenword.com>
---
 Makefile |    6 ++++++
 1 file changed, 6 insertions(+)

Index: b/Makefile
===================================================================
--- a/Makefile
+++ b/Makefile
@@ -971,6 +971,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
@@ -982,6 +983,11 @@ 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
 	GIT_TEST_CMP = cmp
 endif
 ifeq ($(uname_S),Windows)

-- 
Gary V. Vaughan (gary@thewrittenword.com)

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH v5 17/18] Makefile: HP-UX 10.20 portability fixes.
  2010-05-14  9:31 [PATCH v5 00/18] Portability patches for git-1.7.1 Gary V. Vaughan
                   ` (15 preceding siblings ...)
  2010-05-14  9:31 ` [PATCH v5 16/18] Makefile: HPUX11 portability fixes Gary V. Vaughan
@ 2010-05-14  9:31 ` Gary V. Vaughan
  2010-05-14  9:31 ` [PATCH v5 18/18] Makefile: Tru64 portability fix Gary V. Vaughan
                   ` (2 subsequent siblings)
  19 siblings, 0 replies; 34+ messages in thread
From: Gary V. Vaughan @ 2010-05-14  9:31 UTC (permalink / raw)
  To: git

[-- Attachment #1: host-HPUX10.patch --]
[-- Type: text/plain, Size: 749 bytes --]

HP-UX 10.20 has no pread definition, the inline keyword doesn't work,
and has no inet_ntop/inet_pton definitions.

Signed-off-by: Gary V. Vaughan <gary@thewrittenword.com>
---
 Makefile |    8 ++++++++
 1 file changed, 8 insertions(+)

Index: b/Makefile
===================================================================
--- a/Makefile
+++ b/Makefile
@@ -988,6 +988,14 @@ ifeq ($(uname_S),HP-UX)
 		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)

-- 
Gary V. Vaughan (gary@thewrittenword.com)

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH v5 18/18] Makefile: Tru64 portability fix
  2010-05-14  9:31 [PATCH v5 00/18] Portability patches for git-1.7.1 Gary V. Vaughan
                   ` (16 preceding siblings ...)
  2010-05-14  9:31 ` [PATCH v5 17/18] Makefile: HP-UX 10.20 " Gary V. Vaughan
@ 2010-05-14  9:31 ` Gary V. Vaughan
  2010-05-26  5:56 ` [PATCH v5 00/18] Portability patches for git-1.7.1 Gary V. Vaughan
  2010-06-07 15:45 ` Gary V. Vaughan
  19 siblings, 0 replies; 34+ messages in thread
From: Gary V. Vaughan @ 2010-05-14  9:31 UTC (permalink / raw)
  To: git

[-- Attachment #1: host-OSF1.patch --]
[-- Type: text/plain, Size: 763 bytes --]

Add defaults for Tru64 Unix.  Without this patch I cannot compile
git on Tru64 5.1.

Signed-off-by: Gary V. Vaughan <gary@thewrittenword.com>
---
 Makefile |    7 +++++++
 1 file changed, 7 insertions(+)

Index: b/Makefile
===================================================================
--- a/Makefile
+++ b/Makefile
@@ -740,6 +740,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

-- 
Gary V. Vaughan (gary@thewrittenword.com)

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v5 01/18] Makefile: pass CPPFLAGS through to fllow customization
  2010-05-14  9:31 ` [PATCH v5 01/18] Makefile: pass CPPFLAGS through to fllow customization Gary V. Vaughan
@ 2010-05-14  9:53   ` Robin H. Johnson
  2010-05-14 10:58     ` Gary V. Vaughan
  0 siblings, 1 reply; 34+ messages in thread
From: Robin H. Johnson @ 2010-05-14  9:53 UTC (permalink / raw)
  To: Git Mailing List

On Fri, May 14, 2010 at 09:31:32AM +0000, Gary V. Vaughan wrote:
> Without this patch there is no straight forward way to pass additional
> CPPFLAGS at configure-time.  At TWW, everything non-vendor package is
> installed to its own subdirectory, so we need the following to show
> the preprocessor where the headers for the libraries we will link
> later can be found:
As a point of comparision, this is what we use in Gentoo, to allow us to
override many of the variables:
sed -i \
    -e 's:^\(CFLAGS =\).*$:\1 $(OPTCFLAGS) -Wall:' \
    -e 's:^\(LDFLAGS =\).*$:\1 $(OPTLDFLAGS):' \
    -e 's:^\(CC = \).*$:\1$(OPTCC):' \
    -e 's:^\(AR = \).*$:\1$(OPTAR):' \
    Makefile || die "sed failed"

Which would be equivilent to changing the Makefile to have:
CFLAGS = $(OPTCFLAGS) -Wall
LDFLAGS = $(OPTLDFLAGS)
CC = $(OPTCC)
AR = $(OPTAR)

Thereafter, we pass in the relevant values for those variables.

CPPFLAGS is reserved for flags destined for ONLY the preprocessor, and we don't
want to introduce for that reason.

-- 
Robin Hugh Johnson
Gentoo Linux: Developer, Trustee & Infrastructure Lead
E-Mail     : robbat2@gentoo.org
GnuPG FP   : 11AC BA4F 4778 E3F6 E4ED  F38E B27B 944E 3488 4E85

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v5 01/18] Makefile: pass CPPFLAGS through to fllow customization
  2010-05-14  9:53   ` Robin H. Johnson
@ 2010-05-14 10:58     ` Gary V. Vaughan
  2010-05-14 11:04       ` Robin H. Johnson
  0 siblings, 1 reply; 34+ messages in thread
From: Gary V. Vaughan @ 2010-05-14 10:58 UTC (permalink / raw)
  To: Robin H. Johnson; +Cc: Git Mailing List

Hi Robin,

On Fri, May 14, 2010 at 09:53:30AM +0000, Robin H. Johnson wrote:
> On Fri, May 14, 2010 at 09:31:32AM +0000, Gary V. Vaughan wrote:
> > Without this patch there is no straight forward way to pass additional
> > CPPFLAGS at configure-time.  At TWW, everything non-vendor package is
> > installed to its own subdirectory, so we need the following to show
> > the preprocessor where the headers for the libraries we will link
> > later can be found:
> As a point of comparision, this is what we use in Gentoo, to allow us to
> override many of the variables:
> sed -i \
>     -e 's:^\(CFLAGS =\).*$:\1 $(OPTCFLAGS) -Wall:' \
>     -e 's:^\(LDFLAGS =\).*$:\1 $(OPTLDFLAGS):' \
>     -e 's:^\(CC = \).*$:\1$(OPTCC):' \
>     -e 's:^\(AR = \).*$:\1$(OPTAR):' \
>     Makefile || die "sed failed"
> 
> Which would be equivilent to changing the Makefile to have:
> CFLAGS = $(OPTCFLAGS) -Wall
> LDFLAGS = $(OPTLDFLAGS)
> CC = $(OPTCC)
> AR = $(OPTAR)
> 
> Thereafter, we pass in the relevant values for those variables.
> 
> CPPFLAGS is reserved for flags destined for ONLY the preprocessor, and we don't
> want to introduce for that reason.

Letting the user pass preprocessor flags to the preprocessor with
CPPFLAGS at build and/or configure time is a *very* standard feature.
Why would you want to stop a person who builds git from using it?

As a matter of fact, Automake even jumps through hoops with
AM_CPPFLAGS to make sure that the package maintainer doesn't
accidentally trample over the package builder's CPPFLAGS settings - I
can't think of a scenario where the person who writes the build system
for a package knows more about what CPPFLAGS the person who builds it
will need that the person doing the actual building.

I'm pretty sure I'm missing the point though, since letting the
package builder choose their own CPPFLAGS has been at the core of
building Unix packages for as long as I can remember...

Cheers,
-- 
Gary V. Vaughan (gary@thewrittenword.com)

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v5 01/18] Makefile: pass CPPFLAGS through to fllow customization
  2010-05-14 10:58     ` Gary V. Vaughan
@ 2010-05-14 11:04       ` Robin H. Johnson
  2010-05-14 12:01         ` Gary V. Vaughan
  0 siblings, 1 reply; 34+ messages in thread
From: Robin H. Johnson @ 2010-05-14 11:04 UTC (permalink / raw)
  To: Git Mailing List

On Fri, May 14, 2010 at 10:58:32AM +0000, Gary V. Vaughan wrote:
> As a matter of fact, Automake even jumps through hoops with
> AM_CPPFLAGS to make sure that the package maintainer doesn't
> accidentally trample over the package builder's CPPFLAGS settings - I
> can't think of a scenario where the person who writes the build system
> for a package knows more about what CPPFLAGS the person who builds it
> will need that the person doing the actual building.
AM_CFLAGS != AM_CPPFLAGS. My concern was the mixing of them.

IIRC the correct direction was that all CPPFLAGS should be valid CFLAGS,
but not all valid CFLAGS are valid CPPFLAGS (depending on your cpp, they
might be passed to other layers).

> I'm pretty sure I'm missing the point though, since letting the
> package builder choose their own CPPFLAGS has been at the core of
> building Unix packages for as long as I can remember...
As a middle ground:
CFLAGS = $(OPTCFLAGS) -Wall
CPPFLAGS = $(OPTCPPFLAGS)
LDFLAGS = $(OPTLDFLAGS)
CC = $(OPTCC)
AR = $(OPTAR)

(and pass them suitably to the various binaries).

-- 
Robin Hugh Johnson
Gentoo Linux: Developer, Trustee & Infrastructure Lead
E-Mail     : robbat2@gentoo.org
GnuPG FP   : 11AC BA4F 4778 E3F6 E4ED  F38E B27B 944E 3488 4E85

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v5 01/18] Makefile: pass CPPFLAGS through to fllow customization
  2010-05-14 11:04       ` Robin H. Johnson
@ 2010-05-14 12:01         ` Gary V. Vaughan
  0 siblings, 0 replies; 34+ messages in thread
From: Gary V. Vaughan @ 2010-05-14 12:01 UTC (permalink / raw)
  To: Robin H. Johnson; +Cc: Git Mailing List

Hi Robin,

On Fri, May 14, 2010 at 11:04:59AM +0000, Robin H. Johnson wrote:
> On Fri, May 14, 2010 at 10:58:32AM +0000, Gary V. Vaughan wrote:
> > As a matter of fact, Automake even jumps through hoops with
> > AM_CPPFLAGS to make sure that the package maintainer doesn't
> > accidentally trample over the package builder's CPPFLAGS settings - I
> > can't think of a scenario where the person who writes the build system
> > for a package knows more about what CPPFLAGS the person who builds it
> > will need that the person doing the actual building.
> AM_CFLAGS != AM_CPPFLAGS. My concern was the mixing of them.

While I agree that mixing up AM_CFLAGS and AM_CPPFLAGS, or even
AM_CXXFLAGS and AM_CFLAGS is likely to break your build, that's no
reason to deprecate the user's CPPFLAGS setting!

> As a middle ground:
> CFLAGS = $(OPTCFLAGS) -Wall
> CPPFLAGS = $(OPTCPPFLAGS)
> LDFLAGS = $(OPTLDFLAGS)
> CC = $(OPTCC)
> AR = $(OPTAR)

Okay, I think we are mostly in agreement here.  In all the packages we
build here at TWW, we let the user use CFLAGS, CPPFLAGS, LDFLAGS etc,
and to preserve that we'll jump through some Automake-like hoops so
that the build system doesn't overwrite them at build time.

You actually propose the same separation, except that you want the
package builder to use the OPTCFLAGS, OPTCPPFLAGS, OPTLDFLAGS etc so
that the build system can use CFLAGS et al.  I don't think this
buys you anything but confusion when anyone used to building on Unix
over the last 20 or 30 years tries to pass flags into the build using
the tried and tested mechanism (CFLAGS, CPPFLAGS et al) to no effect.

Git already follows the tried and tested mechanism, but forgot to
honor the user's CPPFLAGS setting, which is what this patch is trying
to address.

Cheers,
-- 
Gary V. Vaughan (gary@thewrittenword.com)

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v5 00/18] Portability patches for git-1.7.1
  2010-05-14  9:31 [PATCH v5 00/18] Portability patches for git-1.7.1 Gary V. Vaughan
                   ` (17 preceding siblings ...)
  2010-05-14  9:31 ` [PATCH v5 18/18] Makefile: Tru64 portability fix Gary V. Vaughan
@ 2010-05-26  5:56 ` Gary V. Vaughan
  2010-06-07 15:45 ` Gary V. Vaughan
  19 siblings, 0 replies; 34+ messages in thread
From: Gary V. Vaughan @ 2010-05-26  5:56 UTC (permalink / raw)
  To: git

On Fri, May 14, 2010 at 09:31:31AM +0000, Gary V. Vaughan wrote:
> Momentum appears to have stalled on this portability patch set, but
> I received a lot of great feed back on restructuring and tweaking, the
> results of which follow. If there's anything else I can do to help the
> adoption of some or all of these patches into upstream please don't
> hesitate to ask.  There are no new changes in this v5 patchset, and
> the additional 2 patches in the series over the last submission is
> purely an artifact of the restructuring based on feedback.

Ping?

Anything I can do to help oil the wheels that process git patch
contributions?

Cheers,
-- 
Gary V. Vaughan (gary@thewrittenword.com)

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH] git-compat-util.h: use apparently more common __sgi macro to detect SGI IRIX
  2010-05-14  9:31 ` [PATCH v5 15/18] git-compat-util.h: Irix 6.5 defines sgi but not __sgi Gary V. Vaughan
@ 2010-06-02  1:55   ` Brandon Casey
  2010-06-02  8:43     ` Gary V. Vaughan
  2010-06-02  9:56     ` Tor Arntsen
  0 siblings, 2 replies; 34+ messages in thread
From: Brandon Casey @ 2010-06-02  1:55 UTC (permalink / raw)
  To: gitster; +Cc: git, drafnel, Gary V. Vaughan, Gary V. Vaughan

From: Gary V. Vaughan <git@mlists.thewrittenword.com>

IRIX 6.5.26m does not define the 'sgi' macro, but it does define an '__sgi'
macro.  Since later IRIX versions (6.5.29m) define both macros, and since
an underscore prefixed macro is preferred anyway, use '__sgi' to detect
compilation on SGI IRIX.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
---


Hi Gary,

Here's a resubmit of your patch with an updated commit message.  Since the
__sgi macro seems to be more common than the sgi macro, I modified your
patch to check for only the __sgi macro.  I know Junio suggested checking
for both macros, but I'm the one that Junio was talking about when he made
his comments, and __sgi works for me.

It's such a simple little patch, but still I removed your signed-off-by line
since I modified the patch, and I am not you.  Please do reply to this message
with a signed-off-by if you sign off on the patch.  Junio will add it to the
patch when he applies the it.

-brandon


 git-compat-util.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/git-compat-util.h b/git-compat-util.h
index edf352d..c0198dd 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -56,7 +56,7 @@
 # define _XOPEN_SOURCE 500
 # endif
 #elif !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__USLC__) && \
-      !defined(_M_UNIX) && !defined(sgi) && !defined(__DragonFly__)
+      !defined(_M_UNIX) && !defined(__sgi) && !defined(__DragonFly__)
 #define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500, OpenBSD needs 600 for S_ISLNK() */
 #define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */
 #endif
-- 
1.6.6.2

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* Re: [PATCH v5 02/18] Rewrite dynamic structure initializations to runtime assignment
  2010-05-14  9:31 ` [PATCH v5 02/18] Rewrite dynamic structure initializations to runtime assignment Gary V. Vaughan
@ 2010-06-02  4:39   ` Junio C Hamano
  0 siblings, 0 replies; 34+ messages in thread
From: Junio C Hamano @ 2010-06-02  4:39 UTC (permalink / raw)
  To: Gary V. Vaughan; +Cc: git

This one is really unfortunate, not just because it adds quite a lot of
noise, but because anybody touching the codebase in the future needs to be
aware of the limitation we are imposing on us.  The same comment applies
to 04/18 (enum without trailing comma) but the level of annoyance is much
lower there and I would say it is at an acceptable level.

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v5 05/18] Do not use "diff" found on PATH while building and installing
  2010-05-14  9:31 ` [PATCH v5 05/18] Do not use "diff" found on PATH while building and installing Gary V. Vaughan
@ 2010-06-02  4:39   ` Junio C Hamano
  0 siblings, 0 replies; 34+ messages in thread
From: Junio C Hamano @ 2010-06-02  4:39 UTC (permalink / raw)
  To: Gary V. Vaughan; +Cc: git

"Gary V. Vaughan" <git@mlists.thewrittenword.com> writes:

> Index: b/Documentation/install-webdoc.sh
> ===================================================================
> --- a/Documentation/install-webdoc.sh
> +++ b/Documentation/install-webdoc.sh
> @@ -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"

Do we or do we not want to quote "$DIFF"?  iow, how well do we deal with $IFS
whitespace in the path?

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v5 06/18] tests: use "test_cmp", not "diff", when verifying the result
  2010-05-14  9:31 ` [PATCH v5 06/18] tests: use "test_cmp", not "diff", when verifying the result Gary V. Vaughan
@ 2010-06-02  4:39   ` Junio C Hamano
  0 siblings, 0 replies; 34+ messages in thread
From: Junio C Hamano @ 2010-06-02  4:39 UTC (permalink / raw)
  To: Gary V. Vaughan; +Cc: git

"Gary V. Vaughan" <git@mlists.thewrittenword.com> writes:

> In tests, call test_cmp rather than raw diff where possible (i.e. if
> the output does not go to a pipe), to allow the use of, say, 'cmp'
> when the default 'diff -u' is not compatible with a vendor diff.
>
> When that is not possible, use $DIFF, as set in GIT-BUILD-OPTIONS.

Both are very worthy goal.

> Index: b/t/t0000-basic.sh
> ===================================================================
> --- a/t/t0000-basic.sh
> +++ b/t/t0000-basic.sh
> @@ -280,7 +280,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'

... and I think we could lose >/dev/null redirection once we rewrite these
using test_cmp, but that can be a separate patch.

> Index: b/t/Makefile
> ===================================================================
> --- a/t/Makefile
> +++ b/t/Makefile
> @@ -6,10 +6,14 @@
>  -include ../config.mak
>  
>  #GIT_TEST_OPTS=--verbose --debug
> +GIT_TEST_CMP ?= $(DIFF)
>  SHELL_PATH ?= $(SHELL)
>  TAR ?= $(TAR)
>  RM ?= rm -f
>  
> +# Make sure test-lib.sh uses make's value of GIT_TEST_CMP
> +export GIT_TEST_CMP
> +
>  # Shell quote;
>  SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))

But isn't this a regression?  When GIT_TEST_CMP is not defined, we used to

    GIT_TEST_CMP=${GIT_TEST_CMP:-diff -u}

which in turn is used like this:

    test_cmp() {
            $GIT_TEST_CMP "$@"
    }

so people would get a more readable "diff -u" output when GIT_TEST_CMP is
not defined and exported.  With your patch we would lose -u everywhere,
no?

Also even if your vendor diff lacks unified context format, I would
presume that it would support good old copied context format with -c, and
it would give us a better readability.

How about doing something like this on top of your patch?

Your 7/18 will instead be setting "GIT_TEST_CMP_USE_COPIED_CONTEXT =
YesPlease" for (hopefully) most of the targets whose native "diff" knows
copied context format, and others will set GIT_TEST_CMP to cmp, perhaps?

---
 Makefile      |    4 ++++
 t/Makefile    |    4 ----
 t/test-lib.sh |   11 ++++++++++-
 3 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 668dbc9..c8cc9e2 100644
--- a/Makefile
+++ b/Makefile
@@ -1374,6 +1374,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
diff --git a/t/Makefile b/t/Makefile
index 93a6475..25c559b 100644
--- a/t/Makefile
+++ b/t/Makefile
@@ -6,14 +6,10 @@
 -include ../config.mak
 
 #GIT_TEST_OPTS=--verbose --debug
-GIT_TEST_CMP ?= $(DIFF)
 SHELL_PATH ?= $(SHELL)
 TAR ?= $(TAR)
 RM ?= rm -f
 
-# Make sure test-lib.sh uses make's value of GIT_TEST_CMP
-export GIT_TEST_CMP
-
 # Shell quote;
 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
 
diff --git a/t/test-lib.sh b/t/test-lib.sh
index c582964..a290011 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -63,7 +63,16 @@ 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}
+
+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
 
 # Protect ourselves from common misconfiguration to export
 # CDPATH into the environment

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* Re: [PATCH] git-compat-util.h: use apparently more common __sgi macro to detect SGI IRIX
  2010-06-02  1:55   ` [PATCH] git-compat-util.h: use apparently more common __sgi macro to detect SGI IRIX Brandon Casey
@ 2010-06-02  8:43     ` Gary V. Vaughan
  2010-06-02  9:56     ` Tor Arntsen
  1 sibling, 0 replies; 34+ messages in thread
From: Gary V. Vaughan @ 2010-06-02  8:43 UTC (permalink / raw)
  To: Brandon Casey; +Cc: gitster, git, drafnel

Hi Brandon,

On Tue, Jun 01, 2010 at 08:55:36PM -0500, Brandon Casey wrote:
> From: Gary V. Vaughan <git@mlists.thewrittenword.com>
> 
> IRIX 6.5.26m does not define the 'sgi' macro, but it does define an '__sgi'
> macro.  Since later IRIX versions (6.5.29m) define both macros, and since
> an underscore prefixed macro is preferred anyway, use '__sgi' to detect
> compilation on SGI IRIX.
> 
> Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>

Signed-off-by: Gary V. Vaughan <gary@thewrittenword.com>

> Here's a resubmit of your patch with an updated commit message.  Since the
> __sgi macro seems to be more common than the sgi macro, I modified your
> patch to check for only the __sgi macro.  I know Junio suggested checking
> for both macros, but I'm the one that Junio was talking about when he made
> his comments, and __sgi works for me.

Sure, that's fine.  I only need the __sgi part for git to compile
correctly on my IRIX machines, so if you feel that the non-underscore
flavour is superfluous then I won't miss it! ;)

> It's such a simple little patch, but still I removed your signed-off-by line
> since I modified the patch, and I am not you.  Please do reply to this message
> with a signed-off-by if you sign off on the patch.  Junio will add it to the
> patch when he applies the it.

Done.

Cheers,
-- 
Gary V. Vaughan (gary@thewrittenword.com)

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH] git-compat-util.h: use apparently more common __sgi macro  to detect SGI IRIX
  2010-06-02  1:55   ` [PATCH] git-compat-util.h: use apparently more common __sgi macro to detect SGI IRIX Brandon Casey
  2010-06-02  8:43     ` Gary V. Vaughan
@ 2010-06-02  9:56     ` Tor Arntsen
  1 sibling, 0 replies; 34+ messages in thread
From: Tor Arntsen @ 2010-06-02  9:56 UTC (permalink / raw)
  To: Brandon Casey; +Cc: gitster, git, drafnel, Gary V. Vaughan, Gary V. Vaughan

On Wed, Jun 2, 2010 at 03:55, Brandon Casey <casey@nrlssc.navy.mil> wrote:
> From: Gary V. Vaughan <git@mlists.thewrittenword.com>
>
> IRIX 6.5.26m does not define the 'sgi' macro, but it does define an '__sgi'
> macro.  Since later IRIX versions (6.5.29m) define both macros, and since
> an underscore prefixed macro is preferred anyway, use '__sgi' to detect
> compilation on SGI IRIX.

Yes, __sgi is the one to use. It's been there on all the SGI systems
I've used, at least back to IRIX 5.3 (I don't recall for sure about
4.0.5 but my guess is yes). 'sgi' is often there too, also on IRIX 6.2
(with the old MIPS compiler), but on both 6.2 and 6.5 it goes away if
you use certain other options, e.g. -ansi. __sgi, on the other hand,
is always there - it doesn't depend on any other compiler options.

-Tor

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v5 00/18] Portability patches for git-1.7.1
  2010-05-14  9:31 [PATCH v5 00/18] Portability patches for git-1.7.1 Gary V. Vaughan
                   ` (18 preceding siblings ...)
  2010-05-26  5:56 ` [PATCH v5 00/18] Portability patches for git-1.7.1 Gary V. Vaughan
@ 2010-06-07 15:45 ` Gary V. Vaughan
  2010-06-07 18:07   ` Junio C Hamano
  19 siblings, 1 reply; 34+ messages in thread
From: Gary V. Vaughan @ 2010-06-07 15:45 UTC (permalink / raw)
  To: git

Just bumping this thread so that it doesn't fall off the radar.

Is there anything I can do to help reviewers or committers accept
or reject the patches in this set?

Cheers,
    Gary

On Fri, May 14, 2010 at 09:31:31AM +0000, Gary V. Vaughan wrote:
> Momentum appears to have stalled on this portability patch set, but
> I received a lot of great feed back on restructuring and tweaking, the
> results of which follow. If there's anything else I can do to help the
> adoption of some or all of these patches into upstream please don't
> hesitate to ask.  There are no new changes in this v5 patchset, and
> the additional 2 patches in the series over the last submission is
> purely an artifact of the restructuring based on feedback.
> 
> So, as I said before: Here are the portability patches we needed at
> TWW to enable git-1.7.1 to compile and run on all of the wide range of
> Unix machines we support.  These patches apply to the git-1.7.1
> release,  and address all of the feedback from the previous four
> times I posted them to this list.
> 
> With the exception of a hand-full of test failures outside of Linux
> and Solaris8+, git now compiles and passes all tests on the following
> architectures:
> 
>         Solaris 2.6/SPARC
>         Solaris 7/SPARC
>         Solaris 8/SPARC
>         Solaris 9/SPARC
>         Solaris 10/SPARC
>         Solaris 10/Intel
>         HP-UX 10.20/PA
>         HP-UX 11.00/PA
>         HP-UX 11.11/PA
>         HP-UX 11.23/PA
>         HP-UX 11.23/IA
>         HP-UX 11.31/PA
>         HP-UX 11.31/IA
>         AIX 5.1
>         AIX 5.2
>         AIX 5.3
>         AIX 6.1
>         Tru64 UNIX 5.1
>         IRIX 6.5
>         RHEL 3/x86
>         RHEL 3/amd64
>         RHEL 4/x86
>         RHEL 4/amd64
>         RHEL 5/x86
>         RHEL 5/amd64
>         SLES 10/x86
>         SLES 10/amd64
> 
> Cheers,
> -- 
> Gary V. Vaughan (gary@thewrittenword.com)
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

-- 
Gary V. Vaughan (gary@thewrittenword.com)

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v5 00/18] Portability patches for git-1.7.1
  2010-06-07 15:45 ` Gary V. Vaughan
@ 2010-06-07 18:07   ` Junio C Hamano
  2010-06-09  9:37     ` Tor Arntsen
  0 siblings, 1 reply; 34+ messages in thread
From: Junio C Hamano @ 2010-06-07 18:07 UTC (permalink / raw)
  To: Gary V. Vaughan; +Cc: git

"Gary V. Vaughan" <git@mlists.thewrittenword.com> writes:

> Just bumping this thread so that it doesn't fall off the radar.
>
> Is there anything I can do to help reviewers or committers accept
> or reject the patches in this set?

Isn't the series already cooking in 'next'?

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v5 00/18] Portability patches for git-1.7.1
  2010-06-07 18:07   ` Junio C Hamano
@ 2010-06-09  9:37     ` Tor Arntsen
  2010-06-11  4:30       ` Junio C Hamano
  0 siblings, 1 reply; 34+ messages in thread
From: Tor Arntsen @ 2010-06-09  9:37 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Gary V. Vaughan, git

On Mon, Jun 7, 2010 at 20:07, Junio C Hamano <gitster@pobox.com> wrote:
> "Gary V. Vaughan" <git@mlists.thewrittenword.com> writes:
>
>> Just bumping this thread so that it doesn't fall off the radar.
>>
>> Is there anything I can do to help reviewers or committers accept
>> or reject the patches in this set?
>
> Isn't the series already cooking in 'next'?

Talking about 'next' and this patch set, I have a patch that goes on
top of Gary's patch to the Makefile, to make Tru64 compile also
without ./configure (i.e. just 'make'). Should I post it here as a
diff to 'next', or is it better to wait until the cooking patches are
in mainline and take it from there? (My patch may still need some
discussion and tweaking w.r.t. what's enabled/disabled by default).

-Tor

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v5 00/18] Portability patches for git-1.7.1
  2010-06-09  9:37     ` Tor Arntsen
@ 2010-06-11  4:30       ` Junio C Hamano
  0 siblings, 0 replies; 34+ messages in thread
From: Junio C Hamano @ 2010-06-11  4:30 UTC (permalink / raw)
  To: Tor Arntsen; +Cc: Gary V. Vaughan, git

Tor Arntsen <tor@spacetec.no> writes:

> Talking about 'next' and this patch set, I have a patch that goes on
> top of Gary's patch to the Makefile, to make Tru64 compile also
> without ./configure (i.e. just 'make'). Should I post it here as a
> diff to 'next', or is it better to wait until the cooking patches are
> in mainline and take it from there? (My patch may still need some
> discussion and tweaking w.r.t. what's enabled/disabled by default).

It sounds like that your change would depend on Gary's patch (rather, if
it is done independently, it could cause unnecessary conflicts).  As the
gv/portable topic is now fully part of 'next', I think the easiest would
be to base your topic directly on top of it, iow, on top of 09ce4bb
(build: propagate $DIFF to scripts, 2010-06-05).

^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2010-06-11  4:30 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-14  9:31 [PATCH v5 00/18] Portability patches for git-1.7.1 Gary V. Vaughan
2010-05-14  9:31 ` [PATCH v5 01/18] Makefile: pass CPPFLAGS through to fllow customization Gary V. Vaughan
2010-05-14  9:53   ` Robin H. Johnson
2010-05-14 10:58     ` Gary V. Vaughan
2010-05-14 11:04       ` Robin H. Johnson
2010-05-14 12:01         ` Gary V. Vaughan
2010-05-14  9:31 ` [PATCH v5 02/18] Rewrite dynamic structure initializations to runtime assignment Gary V. Vaughan
2010-06-02  4:39   ` Junio C Hamano
2010-05-14  9:31 ` [PATCH v5 03/18] Makefile: -lpthread may still be necessary when libc has only pthread stubs Gary V. Vaughan
2010-05-14  9:31 ` [PATCH v5 04/18] enums: omit trailing comma for portability Gary V. Vaughan
2010-05-14  9:31 ` [PATCH v5 05/18] Do not use "diff" found on PATH while building and installing Gary V. Vaughan
2010-06-02  4:39   ` Junio C Hamano
2010-05-14  9:31 ` [PATCH v5 06/18] tests: use "test_cmp", not "diff", when verifying the result Gary V. Vaughan
2010-06-02  4:39   ` Junio C Hamano
2010-05-14  9:31 ` [PATCH v5 07/18] test_cmp: do not use "diff -u" on platforms that lack one Gary V. Vaughan
2010-05-14  9:31 ` [PATCH v5 08/18] git-compat-util.h: some platforms with mmap() lack MAP_FAILED definition Gary V. Vaughan
2010-05-14  9:31 ` [PATCH v5 09/18] Makefile: some platforms do not have hstrerror anywhere Gary V. Vaughan
2010-05-14  9:31 ` [PATCH v5 10/18] Make NO_{INET_NTOP,INET_PTON} configured independently Gary V. Vaughan
2010-05-14  9:31 ` [PATCH v5 11/18] Some platforms lack socklen_t type Gary V. Vaughan
2010-05-14  9:31 ` [PATCH v5 12/18] Allow disabling "inline" Gary V. Vaughan
2010-05-14  9:31 ` [PATCH v5 13/18] inline declaration does not work on AIX Gary V. Vaughan
2010-05-14  9:31 ` [PATCH v5 14/18] Makefile: SunOS 5.6 portability fix Gary V. Vaughan
2010-05-14  9:31 ` [PATCH v5 15/18] git-compat-util.h: Irix 6.5 defines sgi but not __sgi Gary V. Vaughan
2010-06-02  1:55   ` [PATCH] git-compat-util.h: use apparently more common __sgi macro to detect SGI IRIX Brandon Casey
2010-06-02  8:43     ` Gary V. Vaughan
2010-06-02  9:56     ` Tor Arntsen
2010-05-14  9:31 ` [PATCH v5 16/18] Makefile: HPUX11 portability fixes Gary V. Vaughan
2010-05-14  9:31 ` [PATCH v5 17/18] Makefile: HP-UX 10.20 " Gary V. Vaughan
2010-05-14  9:31 ` [PATCH v5 18/18] Makefile: Tru64 portability fix Gary V. Vaughan
2010-05-26  5:56 ` [PATCH v5 00/18] Portability patches for git-1.7.1 Gary V. Vaughan
2010-06-07 15:45 ` Gary V. Vaughan
2010-06-07 18:07   ` Junio C Hamano
2010-06-09  9:37     ` Tor Arntsen
2010-06-11  4:30       ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).