Portability patches for git-1.7.1
Subsystems (2)
v5 cover Portability patches for git-1.7.1
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/amd64Cheers,
Signature · 1 line
Gary V. Vaughan ([email protected])
PATCH v5 1/18 Makefile: pass CPPFLAGS through to fllow customization
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}" <<...>>--- Makefile | 2 +- config.mak.in | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
Makefile +1 -1
@@ -246,7 +246,7 @@ endif CFLAGS = -g -O2 -Wall LDFLAGS = -ALL_CFLAGS = $(CFLAGS) +ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS) ALL_LDFLAGS = $(LDFLAGS) STRIP ?= strip
config.mak.in +1 -0
@@ -3,6 +3,7 @@ CC = @CC@ CFLAGS = @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ CC_LD_DYNPATH = @CC_LD_DYNPATH@ AR = @AR@
Signature · 1 line
Gary V. Vaughan ([email protected])
Re: [PATCH v5 01/18] Makefile: pass CPPFLAGS through to fllow customization
Quoted 5 lines · Gary V. Vaughan
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.
Signature · 4 lines
Robin Hugh Johnson Gentoo Linux: Developer, Trustee & Infrastructure Lead E-Mail : [email protected] GnuPG FP : 11AC BA4F 4778 E3F6 E4ED F38E B27B 944E 3488 4E85
Re: [PATCH v5 01/18] Makefile: pass CPPFLAGS through to fllow customization
Hi Robin,
Quoted 21 lines · Robin H. Johnson
Quoted 5 lines · Gary V. Vaughan
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
Makefileto have:
CFLAGS = $(OPTCFLAGS) -Wall
LDFLAGS = $(OPTLDFLAGS)
CC = $(OPTCC)
AR = $(OPTAR)
Quoted 4 lines
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,
Signature · 1 line
Gary V. Vaughan ([email protected])
Re: [PATCH v5 01/18] Makefile: pass CPPFLAGS through to fllow customization
Quoted 6 lines · Gary V. Vaughan
As a matter of fact, Automake even jumps through hoops with
AM_CPPFLAGSto 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).
Quoted 3 lines
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).
Signature · 4 lines
Robin Hugh Johnson Gentoo Linux: Developer, Trustee & Infrastructure Lead E-Mail : [email protected] GnuPG FP : 11AC BA4F 4778 E3F6 E4ED F38E B27B 944E 3488 4E85
Re: [PATCH v5 01/18] Makefile: pass CPPFLAGS through to fllow customization
Hi Robin,
Quoted 8 lines · Robin H. Johnson
Quoted 6 lines · Gary V. Vaughan
As a matter of fact, Automake even jumps through hoops with
AM_CPPFLAGSto 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!
Quoted 6 lines
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,
Signature · 1 line
Gary V. Vaughan ([email protected])
PATCH v5 2/18 Rewrite dynamic structure initializations to runtime assignment
In reply to Gary V. VaughanUnfortunately, 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.
--- 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(-)
convert.c +3 -1
@@ -249,7 +249,9 @@ static int filter_buffer(int in, int outstruct 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;
remote.c +1 -2
@@ -657,10 +657,9 @@ static struct refspec *parse_refspec_intint 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; }
unpack-trees.c +3 -1
@@ -287,9 +287,11 @@ static void add_same_unmerged(struct cacstatic 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) {
daemon.c +10 -9
@@ -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);
wt-status.c +12 -11
@@ -498,17 +498,18 @@ static void wt_status_print_submodule_sustruct 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);
ll-merge.c +7 -7
@@ -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);
builtin/commit.c +2 -1
@@ -717,7 +717,8 @@ static int prepare_to_commit(const charif (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,
builtin/remote.c +6 -3
@@ -705,11 +705,14 @@ static int rm(int argc, const char **argstruct 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);
builtin/blame.c +6 -4
@@ -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 scoconst 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. */
builtin/cat-file.c +3 -1
@@ -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 ); }
refs.c +5 -1
@@ -314,7 +314,11 @@ static int warn_if_dangling_symref(constvoid 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); }
builtin/add.c +3 -1
@@ -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 )
builtin/checkout.c +2 -1
@@ -609,7 +609,8 @@ static int check_tracking_name(const chastatic 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;
builtin/fetch.c +4 -2
@@ -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) {
Signature · 1 line
Gary V. Vaughan ([email protected])
PATCH v5 3/18 Makefile: -lpthread may still be necessary when libc has only pthread stubs
In reply to Gary V. VaughanWithout 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.
--- Makefile | 4 ++++ config.mak.in | 1 + configure.ac | 17 +++++++++++++++-- 3 files changed, 20 insertions(+), 2 deletions(-)
Makefile +4 -0
@@ -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
configure.ac +15 -2
@@ -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)
config.mak.in +1 -0
@@ -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@
Signature · 1 line
Gary V. Vaughan ([email protected])
PATCH v5 4/18 enums: omit trailing comma for portability
In reply to Gary V. VaughanWithout 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.
--- 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(-)
attr.h +1 -1
@@ -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 *);
builtin/apply.c +2 -2
@@ -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;
builtin/branch.c +2 -2
@@ -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 ];
builtin/commit.c +3 -3
@@ -57,7 +57,7 @@ static struct lock_file false_lock; /* ustatic 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, *forcestatic 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)
builtin/help.c +1 -1
@@ -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 ;
builtin/mailinfo.c +2 -2
@@ -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 ;
builtin/receive-pack.c +1 -1
@@ -16,7 +16,7 @@ enum deny_action {DENY_UNCONFIGURED ,DENY_IGNORE ,DENY_WARN , - DENY_REFUSE, + DENY_REFUSE };static int deny_deletes;
builtin/remote.c +1 -1
@@ -317,7 +317,7 @@ struct push_info {PUSH_STATUS_UPTODATE ,PUSH_STATUS_FASTFORWARD ,PUSH_STATUS_OUTOFDATE , -PUSH_STATUS_NOTQUERIED , + PUSH_STATUS_NOTQUERIED } status; };
cache.h +8 -8
@@ -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_defauenum 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 */
commit.h +1 -1
@@ -60,7 +60,7 @@ enum cmit_fmt {CMIT_FMT_EMAIL ,CMIT_FMT_USERFORMAT , - CMIT_FMT_UNSPECIFIED, + CMIT_FMT_UNSPECIFIED };struct pretty_print_context
connect.c +1 -1
@@ -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)
ctype.c +1 -1
@@ -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] = {
diff.h +1 -1
@@ -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) \
dir.c +3 -3
@@ -465,7 +465,7 @@ static struct dir_entry *dir_add_ignoredenum exist_status { index_nonexistent =0 , index_directory, - index_gitdir, + index_gitdir };/*
@@ -533,7 +533,7 @@ static enum exist_status directory_existenum 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,
fast-import.c +1 -1
@@ -267,7 +267,7 @@ struct hash_listtypedef enum {WHENSPEC_RAW =1 ,WHENSPEC_RFC2822 , -WHENSPEC_NOW , +WHENSPEC_NOW }whenspec_type ;struct recent_command
grep.h +4 -4
@@ -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 {
http-push.c +1 -1
@@ -105,7 +105,7 @@ enum transfer_state {RUN_PUT ,RUN_MOVE ,ABORTED , - COMPLETE, + COMPLETE };struct transfer_request
http-walker.c +1 -1
@@ -15,7 +15,7 @@ enum object_request_state {WAITING ,ABORTED ,ACTIVE , - COMPLETE, + COMPLETE };struct object_request
imap-send.c +1 -1
@@ -230,7 +230,7 @@ enum CAPABILITY {LITERALPLUS ,NAMESPACE ,STARTTLS , - AUTH_CRAM_MD5, +AUTH_CRAM_MD5 }; static const char *cap_list[] = {
merge-recursive.h +1 -1
@@ -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;
parse-options.h +3 -3
@@ -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(constenum {PARSE_OPT_HELP =-1 ,PARSE_OPT_DONE , -PARSE_OPT_UNKNOWN , +PARSE_OPT_UNKNOWN };/*
pretty.c +1 -1
@@ -828,7 +828,7 @@ static size_t format_commit_item(structenum {NO_MAGIC ,ADD_LF_BEFORE_NON_EMPTY , -DEL_LF_BEFORE_EMPTY , +DEL_LF_BEFORE_EMPTY } magic =NO_MAGIC ;switch (placeholder[0 ]) {
remote.h +1 -1
@@ -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 */
rerere.c +1 -1
@@ -153,7 +153,7 @@ static int handle_path(unsigned char *shgit_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 ;
revision.c +1 -1
@@ -1781,7 +1781,7 @@ int prepare_revision_walk(struct rev_infenum 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)
wt-status.h +1 -1
@@ -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 {
Signature · 1 line
Gary V. Vaughan ([email protected])
PATCH v5 5/18 Do not use "diff" found on PATH while building and installing
In reply to Gary V. VaughanSome of the flags used with the first diff found in PATH cause the vendor diff to choke.
--- 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(-)
Makefile +3 -1
@@ -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)))'\' >>$@
configure.ac +1 -0
@@ -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
Documentation/install-webdoc.sh +1 -1
@@ -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
git-merge-one-file.sh +1 -1
@@ -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
config.mak.in +1 -0
@@ -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@
Signature · 1 line
Gary V. Vaughan ([email protected])
PATCH v5 6/18 tests: use "test_cmp", not "diff", when verifying the result
In reply to Gary V. VaughanIn 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.
--- 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(-)
t/t0000-basic.sh +1 -1
@@ -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.' \
t/t3200-branch.sh +2 -2
@@ -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 &&
t/t3210-pack-refs.sh +4 -4
@@ -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
t/t4002-diff-basic.sh +1 -1
@@ -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 \
t/t4124-apply-ws-rule.sh +5 -5
@@ -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 '
t/t5300-pack-object.sh +3 -3
@@ -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
t/t5510-fetch.sh +1 -1
@@ -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' '
t/t5520-pull.sh +1 -1
@@ -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' '
t/t5700-clone-reference.sh +4 -4
@@ -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"
t/t6000lib.sh +1 -1
@@ -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
t/t6001-rev-list-graft.sh +1 -1
@@ -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
t/t6022-merge-rename.sh +2 -2
@@ -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 }
t/t7002-grep.sh +8 -8
@@ -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)" '
t/t7005-editor.sh +3 -3
@@ -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
t/t9200-git-cvsexportcommit.sh +13 -13
@@ -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 \
t/t9400-git-cvsserver-server.sh +1 -1
@@ -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)" '
t/t3903-stash.sh +1 -1
@@ -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) &&
t/t4127-apply-same-fn.sh +3 -3
@@ -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.' '
t/Makefile +4 -0
@@ -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))
Signature · 1 line
Gary V. Vaughan ([email protected])
PATCH v5 7/18 test_cmp: do not use "diff -u" on platforms that lack one
In reply to Gary V. VaughanBy 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.
--- Makefile | 5 +++++ t/Makefile | 1 + 2 files changed, 6 insertions(+)
Makefile +5 -0
@@ -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
t/Makefile +1 -0
@@ -3,6 +3,7 @@ # Copyright (c) 2005 Junio C Hamano # +-include ../config.mak.autogen -include ../config.mak #GIT_TEST_OPTS=--verbose --debug
Signature · 1 line
Gary V. Vaughan ([email protected])
PATCH v5 8/18 git-compat-util.h: some platforms with mmap() lack MAP_FAILED definition
In reply to Gary V. VaughanSome platforms with mmap() lack MAP_FAILED definition.
--- git-compat-util.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
git-compat-util.h +4 -1
@@ -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
Signature · 1 line
Gary V. Vaughan ([email protected])
PATCH v5 9/18 Makefile: some platforms do not have hstrerror anywhere
In reply to Gary V. VaughanThis 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.
--- config.mak.in | 1 + configure.ac | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-)
configure.ac +14 -3
@@ -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"
config.mak.in +1 -0
@@ -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@
Signature · 1 line
Gary V. Vaughan ([email protected])
PATCH v5 10/18 Make NO_{INET_NTOP,INET_PTON} configured independently
In reply to Gary V. VaughanBeing careful not to overwrite the results of testing for hstrerror in libresolv, also test whether inet_ntop/inet_pton are available from that library.
--- config.mak.in | 2 ++ configure.ac | 37 ++++++++++++++++++++++++++++++------- 2 files changed, 32 insertions(+), 7 deletions(-)
configure.ac +30 -7
@@ -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],
config.mak.in +2 -0
@@ -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@
Signature · 1 line
Gary V. Vaughan ([email protected])
PATCH v5 11/18 Some platforms lack socklen_t type
In reply to Gary V. VaughanSome platforms do not have a socklen_t type declaration.
--- Makefile | 7 +++++++ aclocal.m4 | 41 +++++++++++++++++++++++++++++++++++++++++ config.mak.in | 1 + configure.ac | 6 ++++++ 4 files changed, 55 insertions(+)
Makefile +7 -0
@@ -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)
configure.ac +6 -0
@@ -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=],
config.mak.in +1 -0
@@ -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@
aclocal.m4 new file +41 -0
41 lines not on this page · raw message
Signature · 1 line
Gary V. Vaughan ([email protected])
PATCH v5 12/18 Allow disabling "inline"
In reply to Gary V. VaughanCompiler 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.
--- Makefile | 7 +++++++ config.mak.in | 1 + configure.ac | 6 ++++++ 3 files changed, 14 insertions(+)
Makefile +7 -0
@@ -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
configure.ac +6 -0
@@ -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}"
config.mak.in +1 -0
@@ -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@
Signature · 1 line
Gary V. Vaughan ([email protected])
PATCH v5 13/18 inline declaration does not work on AIX
In reply to Gary V. VaughanDefine away inline declaration on AIX.
--- Makefile | 3 +++ 1 file changed, 3 insertions(+)
Makefile +3 -0
@@ -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)
Signature · 1 line
Gary V. Vaughan ([email protected])
PATCH v5 14/18 Makefile: SunOS 5.6 portability fix
In reply to Gary V. VaughanAlthough 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.
--- Makefile | 12 ++++++++++++ 1 file changed, 12 insertions(+)
Makefile +12 -0
@@ -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
Signature · 1 line
Gary V. Vaughan ([email protected])
PATCH v5 15/18 git-compat-util.h: Irix 6.5 defines sgi but not __sgi.
In reply to Gary V. VaughanIrix 6.5 does not define 'sgi', but does define '__sgi'.
--- git-compat-util.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
git-compat-util.h +2 -1
@@ -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
Signature · 1 line
Gary V. Vaughan ([email protected])
PATCH v5 16/18 Makefile: HPUX11 portability fixes.
In reply to Gary V. VaughanThere 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
--- Makefile | 6 ++++++ 1 file changed, 6 insertions(+)
Makefile +6 -0
@@ -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)
Signature · 1 line
Gary V. Vaughan ([email protected])
PATCH v5 17/18 Makefile: HP-UX 10.20 portability fixes.
In reply to Gary V. VaughanHP-UX 10.20 has no pread definition, the inline keyword doesn't work, and has no inet_ntop/inet_pton definitions.
--- Makefile | 8 ++++++++ 1 file changed, 8 insertions(+)
Makefile +8 -0
@@ -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)
Signature · 1 line
Gary V. Vaughan ([email protected])
PATCH v5 18/18 Makefile: Tru64 portability fix
In reply to Gary V. VaughanAdd defaults for Tru64 Unix. Without this patch I cannot compile git on Tru64 5.1.
--- Makefile | 7 +++++++ 1 file changed, 7 insertions(+)
Makefile +7 -0
@@ -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
Signature · 1 line
Gary V. Vaughan ([email protected])
Quoted 7 lines · Gary V. Vaughan
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,
Signature · 1 line
Gary V. Vaughan ([email protected])
Re: [PATCH v5 02/18] Rewrite dynamic structure initializations to runtime assignment
In reply to Gary V. VaughanThis 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.
Re: [PATCH v5 05/18] Do not use "diff" found on PATH while building and installing
In reply to Gary V. VaughanDocumentation/install-webdoc.sh do · line 15
Quoted 10 lines · Gary V. Vaughan
Index:
b/Documentation/install-webdoc.sh
===================================================================Documentation/install-webdoc.sh +1
-1@@ -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?
Re: [PATCH v5 06/18] tests: use "test_cmp", not "diff", when verifying the result
In reply to Gary V. VaughanQuoted 5 lines · Gary V. Vaughan
In tests, call
test_cmprather 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.
t/t0000-basic.sh $expectfilter >expected <<\EOF · line 283
Quoted 10 lines
Index:
b/t/t0000-basic.sh
===================================================================t/t0000-basic.sh +1
-1@@ -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.
Quoted 8 lines
Index: b/t/Makefile
===================================================================t/Makefile +0
-0@@ -6,10 +6,14 @@ -include ../config.mak #GIT_TEST_OPTS=--verbose --debug
t/Makefile line 18
Quoted 10 lines
t/Makefile +4
-0+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(-)
Makefile +4 -0
@@ -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
t/Makefile +0 -4
@@ -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))
t/test-lib.sh +10 -1
@@ -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
PATCH 1/1 git-compat-util.h: use apparently more common __sgi macro to detect SGI IRIX
In reply to Gary V. VaughanFrom: Gary V. Vaughan <[email protected]>
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.
---
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(-)
git-compat-util.h +1 -1
@@ -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
Signature · 1 line
1.6.6.2
Re: [PATCH] git-compat-util.h: use apparently more common __sgi macro to detect SGI IRIX
Hi Brandon,
Quoted 8 lines · Brandon Casey
From: Gary V. Vaughan <[email protected]>
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 <[email protected]>
Quoted 5 lines
Here's a resubmit of your patch with an updated commit message. Since the
__sgimacro seems to be more common than the sgi macro, I modified your patch to check for only the__sgimacro. I know Junio suggested checking for both macros, but I'm the one that Junio was talking about when he made his comments, and__sgiworks 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! ;)
Quoted 4 lines
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,
Signature · 1 line
Gary V. Vaughan ([email protected])
Re: [PATCH] git-compat-util.h: use apparently more common __sgi macro to detect SGI IRIX
In reply to Brandon CaseyQuoted 6 lines · Brandon Casey
From: Gary V. Vaughan <[email protected]>
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
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
Quoted 54 lines · Gary V. Vaughan
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/amd64Cheers,
Signature · 5 lines
Gary V. Vaughan ([email protected]) -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 1 line
Gary V. Vaughan ([email protected])
Quoted 4 lines · Gary V. Vaughan
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'?
Quoted 8 lines · Junio C Hamano
Quoted 4 lines · Gary V. Vaughan
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
Quoted 6 lines · Tor Arntsen
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).