Re: [PATCH] Documentation: remove unnecessary backslashes

2016-01-20 Thread Matt Kraai
Hi,

On Wed, Jan 20, 2016 at 01:24:21PM -0500, Jeff King wrote:
> On Wed, Jan 20, 2016 at 09:21:37AM -0800, Matt Kraai wrote:
> > -'@\{\}', e.g. 'master@\{yesterday\}', 'HEAD@\{5 minutes 
> > ago\}'::
> > +'@{}', e.g. 'master@\{yesterday\}', 'HEAD@{5 minutes ago}'::
> 
> I see you didn't tweak the middle one here, because it _does_ look like
> an attribute. Does asciidoctor actually remove the backslashes there?

Yes, asciidoctor appears to remove the backslashes in some cases but
not others.  I removed the backslashes from the source if it did not
remove them.  I verified that the asciidoc output isn't affected.

> > -'@\{\}', e.g. 'master@\{1\}'::
> > +'@{}', e.g. 'master@\{1\}'::
> 
> Ditto here for "1". IMHO asciidoctor's behavior is somewhat crazy, as it
> means you have to know arcane quoting rules to get correct output (you
> cannot just err on the side of quoting). But it's probably still worth
> working around.

I couldn't find any documentation of asciidoctor's behavior.  I didn't
try figuring the behavior out from asciidoctor's source code.

-- 
Matt   https://ftbfs.org/~kraai/
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Documentation: remove unnecessary backslashes

2016-01-20 Thread Matt Kraai
From: Matthew Kraai 

asciidoctor does not remove backslashes used to escape curly brackets from
the HTML output if the contents of the curly brackets are empty or contain
at least a <, -, or space.  asciidoc does not require the backslashes in
these cases, so just remove them.

Signed-off-by: Matthew Kraai 
Reported-by: Philip Oakley 
---
 Documentation/revisions.txt | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/Documentation/revisions.txt b/Documentation/revisions.txt
index d85e303..fa4bdb2 100644
--- a/Documentation/revisions.txt
+++ b/Documentation/revisions.txt
@@ -61,11 +61,11 @@ some output processing may assume ref names in UTF-8.
 '@'::
   '@' alone is a shortcut for 'HEAD'.
 
-'@\{\}', e.g. 'master@\{yesterday\}', 'HEAD@\{5 minutes ago\}'::
+'@{}', e.g. 'master@\{yesterday\}', 'HEAD@{5 minutes ago}'::
   A ref followed by the suffix '@' with a date specification
   enclosed in a brace
-  pair (e.g. '\{yesterday\}', '\{1 month 2 weeks 3 days 1 hour 1
-  second ago\}' or '\{1979-02-26 18:30:00\}') specifies the value
+  pair (e.g. '\{yesterday\}', '{1 month 2 weeks 3 days 1 hour 1
+  second ago}' or '{1979-02-26 18:30:00}') specifies the value
   of the ref at a prior point in time.  This suffix may only be
   used immediately following a ref name and the ref must have an
   existing log ('$GIT_DIR/logs/'). Note that this looks up the state
@@ -73,7 +73,7 @@ some output processing may assume ref names in UTF-8.
   'master' branch last week. If you want to look at commits made during
   certain times, see '--since' and '--until'.
 
-'@\{\}', e.g. 'master@\{1\}'::
+'@{}', e.g. 'master@\{1\}'::
   A ref followed by the suffix '@' with an ordinal specification
   enclosed in a brace pair (e.g. '\{1\}', '\{15\}') specifies
   the n-th prior value of that ref.  For example 'master@\{1\}'
@@ -82,13 +82,13 @@ some output processing may assume ref names in UTF-8.
   immediately following a ref name and the ref must have an existing
   log ('$GIT_DIR/logs/').
 
-'@\{\}', e.g. '@\{1\}'::
+'@{}', e.g. '@\{1\}'::
   You can use the '@' construct with an empty ref part to get at a
   reflog entry of the current branch. For example, if you are on
   branch 'blabla' then '@\{1\}' means the same as 'blabla@\{1\}'.
 
-'@\{-\}', e.g. '@\{-1\}'::
-  The construct '@\{-\}' means the th branch/commit checked out
+'@{-}', e.g. '@{-1}'::
+  The construct '@{-}' means the th branch/commit checked out
   before the current one.
 
 '@\{upstream\}', e.g. 'master@\{upstream\}', '@\{u\}'::
@@ -139,7 +139,7 @@ from one location and push to another. In a non-triangular 
workflow,
   '{caret}1{caret}1{caret}1'.  See below for an illustration of
   the usage of this form.
 
-'{caret}\{\}', e.g. 'v0.99.8{caret}\{commit\}'::
+'{caret}{}', e.g. 'v0.99.8{caret}\{commit\}'::
   A suffix '{caret}' followed by an object type name enclosed in
   brace pair means dereference the object at '' recursively until
   an object of type '' is found or the object cannot be
@@ -159,13 +159,13 @@ it does not have to be dereferenced even once to get to 
an object.
 'rev{caret}\{tag\}' can be used to ensure that 'rev' identifies an
 existing tag object.
 
-'{caret}\{\}', e.g. 'v0.99.8{caret}\{\}'::
+'{caret}{}', e.g. 'v0.99.8{caret}{}'::
   A suffix '{caret}' followed by an empty brace pair
   means the object could be a tag,
   and dereference the tag recursively until a non-tag object is
   found.
 
-'{caret}\{/\}', e.g. 'HEAD^{/fix nasty bug}'::
+'{caret}{/}', e.g. 'HEAD^{/fix nasty bug}'::
   A suffix '{caret}' to a revision parameter, followed by a brace
   pair that contains a text led by a slash,
   is the same as the ':/fix nasty bug' syntax below except that
-- 
2.7.0.windows.1

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] remote-http: use argv-array

2013-07-09 Thread Matt Kraai
Jeff King p...@peff.net writes:
 On Tue, Jul 09, 2013 at 08:05:19AM +0200, Bert Wesarg wrote:
   +   argv_array_pushl(args, send-pack, --stateless-rpc,
--helper-status);
  
  missing NULL sentinel. GCC has the 'sentinel' [1] attribute to catch
  such errors. Or use macro magic:
  
  void argv_array_pushl_(struct argv_array *array, ...);
  #define argv_array_pushl(array, ...) argv_array_pushl_(array,
__VA_ARGS__, NULL)
 
 Nice catch. We cannot use variadic macros, because we support pre-C99
 compilers that do not have them. But the sentinel attribute is a good
 idea. Here's a patch.

This attribute could also be used for
builtin/revert.c:verify_opt_compatible,
builtin/revert.c:verify_opt_mutually_compatible, exec_cmd.h:execl_git_cmd,
and run-command.h:run_hook.

-- 
Matt


--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Improve QNX support in GIT

2013-02-26 Thread Matt Kraai
Hi Mike,

Mike Gorchak wrote:
 diff --git a/config.mak.uname b/config.mak.uname
 index 8743a6d..2d42ffe 100644
 --- a/config.mak.uname
 +++ b/config.mak.uname
 @@ -527,14 +527,21 @@ ifeq ($(uname_S),QNX)
   HAVE_STRINGS_H = YesPlease
   NEEDS_SOCKET = YesPlease
   NO_FNMATCH_CASEFOLD = YesPlease
 - NO_GETPAGESIZE = YesPlease
   NO_ICONV = YesPlease
   NO_MEMMEM = YesPlease
 - NO_MKDTEMP = YesPlease
 - NO_MKSTEMPS = YesPlease
   NO_NSEC = YesPlease
 - NO_PTHREADS = YesPlease
   NO_R_TO_GCC_LINKER = YesPlease
 - NO_STRCASESTR = YesPlease
   NO_STRLCPY = YesPlease
 + # All QNX 6.x versions have pthread functions in libc
 + # and getpagesize. Leave mkstemps/mkdtemp/strcasestr for
 + # autodetection.
 + ifeq ($(shell expr $(uname_R) : '6\.[0-9]\.[0-9]'),5)
 + PTHREAD_LIBS = 
 + else
 + NO_PTHREADS = YesPlease
 + NO_GETPAGESIZE = YesPlease
 + NO_STRCASESTR = YesPlease
 + NO_MKSTEMPS = YesPlease
 + NO_MKDTEMP = YesPlease
 + endif
  endif

Is there a point to the version checking?  I don't know that anyone
has tried to build Git on QNX 4, so adding a case for it seems
misleading.

I didn't realize that QNX 6.3.2 provided getpagesize.  Its header
files don't provide a prototype, so when I saw the warning, I assumed
it wasn't available.  Since NO_GETPAGESIZE is only used by QNX, if
it's OK to reintroduce the warning, NO_GETPAGESIZE might as well be
removed entirely.

I don't think it's a good idea to just enable thread support.  On QNX,
once a process creates a thread, fork stops working.  This breaks
commands that create threads and then try to run other programs, such
as git fetch with an https remote.  If threads are enabled, I think
that the uses of fork need to be audited and, if they can be called
after a thread is created, fixed.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Improve QNX support in GIT

2013-02-26 Thread Matt Kraai
Hi,

Please include me in the Cc field, since I'm not subscribed to the
list.

Mike Gorchak wrote:
 Do you have a testcase for this (without using git codebase)? I wrote
 numerous resource managers since QNX 6.0 using threads and fork()s for
 daemonization in different order and never experienced a problems.
 There can be issues with pipes in case of external command run.

I just created the following one:


#include pthread.h
#include stdio.h
#include string.h
#include errno.h
#include sys/types.h
#include process.h

static void *
start_routine (void *arg)
{
  return NULL;
}

int
main (int argc, char **argv)
{
  int err;

  if ((err = pthread_create (NULL, NULL, start_routine, NULL)))
{
  fprintf (stderr, foo: pthread_create failed: %s\n, strerror (errno));
  return 1;
}

  if (fork () == -1)
{
  fprintf (stderr, foo: fork failed: %s\n, strerror (errno));
  return 1;
}

  return 0;
}


When I compile and run it on either QNX 6.3.2 or QNX 6.5.0, it
produces the following output:

 foo: fork failed: Function not implemented

If I remove the call to pthread_create, it doesn't output anything and
exits successfully.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Makefile: don't run rm without any files

2013-02-13 Thread Matt Kraai
On Wed, Feb 13, 2013 at 08:51:45AM -0800, Junio C Hamano wrote:
 Matt Kraai kr...@ftbfs.org writes:
 
  From: Matt Kraai matt.kr...@amo.abbott.com
 
  rm -f -r fails on QNX when not passed any files to remove.
 
 I do not think it is limited to QNX.
 
  the clean target, since dep_dirs is empty.
 
 And dep_dirs being empty under some circumstance shouldn't be
 limited to QNX, either.
 
 I think your change does no harm, may be a good change if dep_dirs
 goes empty, but the justification is lacking.  What caused your
 dep_dirs to become empty in the first place?
 
 I am scratching my head because I see
 
 OBJECTS := $(LIB_OBJS) $(BUILTIN_OBJS) $(PROGRAM_OBJS) $(TEST_OBJS) \
   $(XDIFF_OBJS) \
   $(VCSSVN_OBJS) \
   git.o
 dep_dirs := $(addsuffix .depend,$(sort $(dir $(OBJECTS

I don't set COMPUTE_HEADER_DEPENDENCIES, so it defaults to auto.
The automatic detection determines that the compiler doesn't support
it, so it's then set to no.  CHECK_HEADER_DEPENDENCIES isn't set
either, so about 20 lines below the dep_dirs assignment you quoted,
dep_dirs is cleared:

 ifneq ($(COMPUTE_HEADER_DEPENDENCIES),yes)
 ifndef CHECK_HEADER_DEPENDENCIES
 dep_dirs =
 ...

Should I submit an updated patch with a different commit message?
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Include xmlparse.h instead of expat.h on QNX

2013-02-11 Thread Matt Kraai
On Mon, Feb 11, 2013 at 04:06:21PM -0500, Jeff King wrote:
 On Mon, Feb 11, 2013 at 12:59:55PM -0800, Matt Kraai wrote:
 
  From: Matt Kraai matt.kr...@amo.abbott.com
  
  QNX 6.3.2 through 6.5.0 include Expat 1.1, which provides xmlparse.h
  instead of expat.h, so include the former on QNX systems.
 
 So it is not just QNX, but rather older versions of expat?

Yes, Expat 1.1 and 1.2 provide xmlparse.h, whereas 1.95.0 and later
provide expat.h.

  diff --git a/http-push.c b/http-push.c
  index 9923441..55c575e 100644
  --- a/http-push.c
  +++ b/http-push.c
  @@ -11,7 +11,11 @@
   #include list-objects.h
   #include sigchain.h
   
  +#ifndef __QNX__
   #include expat.h
  +#else
  +#include xmlparse.h
  +#endif
 
 If that is the case, should this #ifdef look for EXPAT_NEEDS_XMLPARSE_H,
 and that macro triggered externally? Either in the QNX section of the
 Makefile, or potentially by an autoconf macro?

I'll submit another patch shortly that does so, defining the variable
in the QNX section of config.mak.uname.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Include xmlparse.h instead of expat.h on QNX

2013-02-11 Thread Matt Kraai
On Mon, Feb 11, 2013 at 01:34:52PM -0800, Junio C Hamano wrote:
 Two points and a possibly irrelevant half:
 
  - If a fix is platform specific (i.e. tempts to use #ifdef
PLATFORM_NAME), we would prefer to see a patch that that is
isolated to platform-specific compatibility layer, which would
involve:
 
. add compat/qnx/expat.h file that #include xmlparse.h
. to Makefile, add -Icompat/qnx/ to CFLAGS
 
  - Is this really a fix for a problem specific to QNX?  It looks
like this is for any platform with expat 1, no?

It should apply to anyone trying to build with expat 1.1 or 1.2, but
not with 1.95.0 or later.

  - What happens to people with QNX older than 6.3.2 or newer than
6.5.0 (assuming they will eventually start shipping expat 2) with
your patch?

Git will fail to build http-push.c.  I don't know if QNX will ever
update expat, though.  expat 1.95.0 was released in 2000, expat 2.0.0
was released in 2006, and QNX 6.5.0 was released in 2010.

 Assuming that this change is about building with expat1, it would
 probably be better to do something like this instead, I would think.

expat 1.95.0 through 1.95.8 used expat.h; should I still use
EXPAT_VERSION = 1 to signify that it should use xmlparse.h, use
EXPAT_NEEDS_XMLPARSE_H as Jeff suggested, or something else entirely?
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Allow building with xmlparse.h

2013-02-11 Thread Matt Kraai
From: Matt Kraai matt.kr...@amo.abbott.com

expat 1.1 and 1.2 provide xmlparse.h instead of expat.h.  Include the
former on systems that define the EXPAT_NEEDS_XMLPARSE_H variable and
define that variable on QNX systems, which ship with expat 1.1.

Signed-off-by: Matt Kraai matt.kr...@amo.abbott.com
---
 Makefile | 6 ++
 config.mak.uname | 1 +
 http-push.c  | 4 
 3 files changed, 11 insertions(+)

diff --git a/Makefile b/Makefile
index 5a2e02d..720fc18 100644
--- a/Makefile
+++ b/Makefile
@@ -43,6 +43,9 @@ all::
 # Define EXPATDIR=/foo/bar if your expat header and library files are in
 # /foo/bar/include and /foo/bar/lib directories.
 #
+# Define EXPAT_NEEDS_XMLPARSE_H if you have an old version of expat (e.g.,
+# 1.1 or 1.2) that provides xmlparse.h instead of expat.h.
+#
 # Define NO_GETTEXT if you don't want Git output to be translated.
 # A translated Git requires GNU libintl or another gettext implementation,
 # plus libintl-perl at runtime.
@@ -1089,6 +1092,9 @@ else
else
EXPAT_LIBEXPAT = -lexpat
endif
+   ifdef EXPAT_NEEDS_XMLPARSE_H
+   BASIC_CFLAGS += -DEXPAT_NEEDS_XMLPARSE_H
+   endif
endif
 endif
 
diff --git a/config.mak.uname b/config.mak.uname
index bea34f0..8743a6d 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -523,6 +523,7 @@ endif
 endif
 ifeq ($(uname_S),QNX)
COMPAT_CFLAGS += -DSA_RESTART=0
+   EXPAT_NEEDS_XMLPARSE_H = YesPlease
HAVE_STRINGS_H = YesPlease
NEEDS_SOCKET = YesPlease
NO_FNMATCH_CASEFOLD = YesPlease
diff --git a/http-push.c b/http-push.c
index 9923441..7202e2d 100644
--- a/http-push.c
+++ b/http-push.c
@@ -11,7 +11,11 @@
 #include list-objects.h
 #include sigchain.h
 
+#ifndef EXPAT_NEEDS_XMLPARSE_H
 #include expat.h
+#else
+#include xmlparse.h
+#endif
 
 static const char http_push_usage[] =
 git http-push [--all] [--dry-run] [--force] [--verbose] remote 
[head...]\n;
-- 
1.8.1.2.547.g7ce9def

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Allow building with xmlparse.h

2013-02-11 Thread Matt Kraai
From: Matt Kraai matt.kr...@amo.abbott.com

expat 1.1 and 1.2 provide xmlparse.h instead of expat.h.  Include the
former on systems that define the EXPAT_NEEDS_XMLPARSE_H variable and
define that variable on QNX systems, which ship with expat 1.1.

Signed-off-by: Matt Kraai matt.kr...@amo.abbott.com
---
 Makefile | 6 ++
 config.mak.uname | 1 +
 http-push.c  | 4 
 3 files changed, 11 insertions(+)

I've changed #ifndef to #ifdef and changed the order of the branches
in http-push.c.  If you'd also like me to rename the variable (e.g.,
to NEEDS_XMLPARSE_H), please let me know.

diff --git a/Makefile b/Makefile
index 5a2e02d..720fc18 100644
--- a/Makefile
+++ b/Makefile
@@ -43,6 +43,9 @@ all::
 # Define EXPATDIR=/foo/bar if your expat header and library files are in
 # /foo/bar/include and /foo/bar/lib directories.
 #
+# Define EXPAT_NEEDS_XMLPARSE_H if you have an old version of expat (e.g.,
+# 1.1 or 1.2) that provides xmlparse.h instead of expat.h.
+#
 # Define NO_GETTEXT if you don't want Git output to be translated.
 # A translated Git requires GNU libintl or another gettext implementation,
 # plus libintl-perl at runtime.
@@ -1089,6 +1092,9 @@ else
else
EXPAT_LIBEXPAT = -lexpat
endif
+   ifdef EXPAT_NEEDS_XMLPARSE_H
+   BASIC_CFLAGS += -DEXPAT_NEEDS_XMLPARSE_H
+   endif
endif
 endif
 
diff --git a/config.mak.uname b/config.mak.uname
index bea34f0..8743a6d 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -523,6 +523,7 @@ endif
 endif
 ifeq ($(uname_S),QNX)
COMPAT_CFLAGS += -DSA_RESTART=0
+   EXPAT_NEEDS_XMLPARSE_H = YesPlease
HAVE_STRINGS_H = YesPlease
NEEDS_SOCKET = YesPlease
NO_FNMATCH_CASEFOLD = YesPlease
diff --git a/http-push.c b/http-push.c
index 9923441..9fa47a7 100644
--- a/http-push.c
+++ b/http-push.c
@@ -11,7 +11,11 @@
 #include list-objects.h
 #include sigchain.h
 
+#ifdef EXPAT_NEEDS_XMLPARSE_H
+#include xmlparse.h
+#else
 #include expat.h
+#endif
 
 static const char http_push_usage[] =
 git http-push [--all] [--dry-run] [--force] [--verbose] remote 
[head...]\n;
-- 
1.8.1.2.547.g7ce9def

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Use __VA_ARGS__ for all of error's arguments

2013-02-08 Thread Matt Kraai
From: Matt Kraai matt.kr...@amo.abbott.com

QNX 6.3.2 uses GCC 2.95.3 by default, and GCC 2.95.3 doesn't remove the
comma if the error macro's variable argument is left out.

Instead of testing for a sufficiently recent version of GCC, make
__VA_ARGS__ match all of the arguments.

Signed-off-by: Matt Kraai matt.kr...@amo.abbott.com
---
 git-compat-util.h | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/git-compat-util.h b/git-compat-util.h
index cc2abee..b7eaaa9 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -305,13 +305,13 @@ extern void warning(const char *err, ...) 
__attribute__((format (printf, 1, 2)))
 
 /*
  * Let callers be aware of the constant return value; this can help
- * gcc with -Wuninitialized analysis. We have to restrict this trick to
- * gcc, though, because of the variadic macro and the magic ## comma pasting
- * behavior. But since we're only trying to help gcc, anyway, it's OK; other
- * compilers will fall back to using the function as usual.
+ * gcc with -Wuninitialized analysis. We restrict this trick to gcc, though,
+ * because some compilers may not support variadic macros. Since we're only
+ * trying to help gcc, anyway, it's OK; other compilers will fall back to
+ * using the function as usual.
  */
 #if defined(__GNUC__)  ! defined(__clang__)
-#define error(fmt, ...) (error((fmt), ##__VA_ARGS__), -1)
+#define error(...) (error(__VA_ARGS__), -1)
 #endif
 
 extern void set_die_routine(NORETURN_PTR void (*routine)(const char *err, 
va_list params));
-- 
1.8.1.2.546.g90a97a4

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Use __VA_ARGS__ for all of error's arguments

2013-02-07 Thread Matt Kraai
From: Matt Kraai matt.kr...@amo.abbott.com

QNX 6.3.2 uses GCC 2.95.3 by default, and GCC 2.95.3 doesn't remove the
comma if the error macro's variable argument is left out.

Instead of testing for a sufficiently recent version of GCC, make
__VA_ARGS__ match all of the arguments.  Since this should work on any
C99-compliant compiler, also remove the tests around the macro definition.

Signed-off-by: Matt Kraai matt.kr...@amo.abbott.com
---
 git-compat-util.h | 9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/git-compat-util.h b/git-compat-util.h
index cc2abee..df1681f 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -305,14 +305,9 @@ extern void warning(const char *err, ...) 
__attribute__((format (printf, 1, 2)))
 
 /*
  * Let callers be aware of the constant return value; this can help
- * gcc with -Wuninitialized analysis. We have to restrict this trick to
- * gcc, though, because of the variadic macro and the magic ## comma pasting
- * behavior. But since we're only trying to help gcc, anyway, it's OK; other
- * compilers will fall back to using the function as usual.
+ * gcc with -Wuninitialized analysis.
  */
-#if defined(__GNUC__)  ! defined(__clang__)
-#define error(fmt, ...) (error((fmt), ##__VA_ARGS__), -1)
-#endif
+#define error(...) (error(__VA_ARGS__), -1)
 
 extern void set_die_routine(NORETURN_PTR void (*routine)(const char *err, 
va_list params));
 extern void set_error_routine(void (*routine)(const char *err, va_list 
params));
-- 
1.8.1.GIT

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Use __VA_ARGS__ for all of error's arguments

2013-02-07 Thread Matt Kraai
On Thu, Feb 07, 2013 at 01:05:19PM -0800, Junio C Hamano wrote:
 Matt Kraai kr...@ftbfs.org writes:
 
  -#if defined(__GNUC__)  ! defined(__clang__)
  -#define error(fmt, ...) (error((fmt), ##__VA_ARGS__), -1)
  -#endif
  +#define error(...) (error(__VA_ARGS__), -1)
 
 Before your change, we only define error() macro for GCC variants,
 but with your patch that no longer is the case.  Does every compiler
 that compiles Git correctly today support this style of varargs
 macros?

I don't know and I don't think it's likely I can confirm this.  I'll
submit a new patch that just changes the definition, since I don't
know of any problems other than mine with the current situation.

-- 
Matt
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Use __VA_ARGS__ for all of error's arguments

2013-02-07 Thread Matt Kraai
From: Matt Kraai matt.kr...@amo.abbott.com

QNX 6.3.2 uses GCC 2.95.3 by default, and GCC 2.95.3 doesn't remove the
comma if the error macro's variable argument is left out.

Instead of testing for a sufficiently recent version of GCC, make
__VA_ARGS__ match all of the arguments.

Signed-off-by: Matt Kraai matt.kr...@amo.abbott.com
---
 git-compat-util.h | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/git-compat-util.h b/git-compat-util.h
index cc2abee..2e960a9 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -305,13 +305,10 @@ extern void warning(const char *err, ...) 
__attribute__((format (printf, 1, 2)))
 
 /*
  * Let callers be aware of the constant return value; this can help
- * gcc with -Wuninitialized analysis. We have to restrict this trick to
- * gcc, though, because of the variadic macro and the magic ## comma pasting
- * behavior. But since we're only trying to help gcc, anyway, it's OK; other
- * compilers will fall back to using the function as usual.
+ * gcc with -Wuninitialized analysis.
  */
 #if defined(__GNUC__)  ! defined(__clang__)
-#define error(fmt, ...) (error((fmt), ##__VA_ARGS__), -1)
+#define error(...) (error(__VA_ARGS__), -1)
 #endif
 
 extern void set_die_routine(NORETURN_PTR void (*routine)(const char *err, 
va_list params));
-- 
1.8.1.2.546.gfc9f004

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Use __VA_ARGS__ for all of error's arguments

2013-02-07 Thread Matt Kraai
On Thu, Feb 07, 2013 at 11:24:28PM -0500, Jeff King wrote:
 Should you be dropping most of the comment like this? I would expect it
 to be more like:
 
   We have to restrict this trick to gcc, though, because we do not
   assume all compilers support variadic macros. But since...

I'll submit a new patch with this change tomorrow.

 Other than that, I think it is OK. The compiler will still catch
 error() with no arguments and generate the appropriate diagnostic (in
 fact, it is better, because the error is now passing too few args to a
 function, not to the macro).

Great, thanks for the review.

-- 
Matt
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 07/14] imap-send.c: inline imap_parse_list() in imap_list()

2013-01-15 Thread Matt Kraai
On Tue, Jan 15, 2013 at 09:06:25AM +0100, Michael Haggerty wrote:
 -static struct imap_list *parse_imap_list(struct imap *imap, char **sp)
 +static struct imap_list *parse_list(char **sp)

The commit subject refers to imap_parse_list and imap_list whereas the
code refers to parse_imap_list and parse_list.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] tests: turn on test-lint-shell-syntax by default

2013-01-13 Thread Matt Kraai
On Sun, Jan 13, 2013 at 11:25:57AM +0100, Torsten Bögershausen wrote:
 @@ -16,10 +16,10 @@ sub err {
  
  while () {
   chomp;
 - /^\s*sed\s+-i/ and err 'sed -i is not portable';
 - /^\s*echo\s+-n/ and err 'echo -n is not portable (please use printf)';
 - /^\s*declare\s+/ and err 'arrays/declare not portable';
 - /^\s*[^#]\s*which\s/ and err 'which is not portable (please use type)';
 + /^\s*sed\s+-i\s+\S/ and err 'sed -i is not portable';
 + /^\s*echo\s+-n\s+\S/ and err 'echo -n is not portable (please use 
 printf)';
 + /^\s*declare\s+\S/ and err 'arrays/declare not portable';
 + /^\s*[^#]\s*which\s+[-a-zA-Z0-9]+$/ and err 'which is not portable 
 (please use type)';

The [^#] appears to ensure that there's at least one character
before the which and that it's not a pound sign.  Why is this done?
Why isn't it done for the other commands?
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Support FTP-over-SSL/TLS for regular FTP

2013-01-12 Thread Matt Kraai
On Sat, Jan 12, 2013 at 03:59:52PM +0200, Modestas Vainius wrote:
 @@ -306,6 +311,11 @@ static CURL *get_curl_handle(void)
   if (curl_ftp_no_epsv)
   curl_easy_setopt(result, CURLOPT_FTP_USE_EPSV, 0);
  
 +#ifdef CURLOPT_USE_SSL
 +if (curl_ssl_try)
 + curl_easy_setopt(result, CURLOPT_USE_SSL, CURLUSESSL_TRY);
 +#endif
 +
   if (curl_http_proxy) {
   curl_easy_setopt(result, CURLOPT_PROXY, curl_http_proxy);
   curl_easy_setopt(result, CURLOPT_PROXYAUTH, CURLAUTH_ANY);

It looks like the indentation of the if line you added is messed up.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 03/21] Export parse_pathspec() and convert some get_pathspec() calls

2013-01-11 Thread Matt Kraai
On Fri, Jan 11, 2013 at 06:20:57PM +0700, Nguyễn Thái Ngọc Duy wrote:
 +#define PATHSPEC_FROMTOP(10)

The previous commit introduces a use of this macro in get_pathspec.
Should this be defined by that commit instead?

 @@ -266,9 +266,9 @@ static int pathspec_item_cmp(const void *a_, const void 
 *b_)
   * Given command line arguments and a prefix, convert the input to
   * pathspec. die() if any magic other than ones in magic_mask.
   */
 -static void parse_pathspec(struct pathspec *pathspec,
 -unsigned magic_mask, unsigned flags,
 -const char *prefix, const char **argv)
 +void parse_pathspec(struct pathspec *pathspec,
 + unsigned magic_mask, unsigned flags,

The prototype for this function uses just magic instead of
magic_mask.  Should they be consistent?

-- 
Matt
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 03/19] reset.c: pass pathspec around instead of (prefix, argv) pair

2013-01-09 Thread Matt Kraai
On Wed, Jan 09, 2013 at 12:16:00AM -0800, Martin von Zweigbergk wrote:
 We use the path arguments in two places in reset.c: in
 interactive_reset() and read_from_tree(). Both of these call
 get_pathspec(), so we pass the (prefix, arv) pair to both
  ^^^
argv is misspelled.

-- 
Matt
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 07/19] reset.c: extract function for updating {ORIG,}HEAD

2013-01-09 Thread Matt Kraai
In the summary, {ORIG,} should be {ORIG_,}.

-- 
Matt
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/4] t0024, t5000: use test_lazy_prereq for UNZIP

2013-01-06 Thread Matt Kraai
On Sun, Jan 06, 2013 at 06:49:00PM +0100, René Scharfe wrote:
 This change makes the code smaller and we can put it at the top of
 the script, its rightful place as setup code.

Would it be better to add the setting of GIT_UNZIP and
test_lazy_prereq to test-lib.sh so they aren't duplicated in both
t0024-crlf-archive.sh and t5000-tar-tree.sh, something like the
following (modulo UNZIP/GIT_UNZIP)?

-- 
Matt Kraai
https://ftbfs.org/kraai

diff --git a/t/t0024-crlf-archive.sh b/t/t0024-crlf-archive.sh
index ec6c1b3..084f33c 100755
--- a/t/t0024-crlf-archive.sh
+++ b/t/t0024-crlf-archive.sh
@@ -3,7 +3,6 @@
 test_description='respect crlf in git archive'
 
 . ./test-lib.sh
-UNZIP=${UNZIP:-unzip}
 
 test_expect_success setup '
 
@@ -26,13 +25,6 @@ test_expect_success 'tar archive' '
 
 '
 
-$UNZIP -v /dev/null 21
-if [ $? -eq 127 ]; then
-   say Skipping ZIP test, because unzip was not found
-else
-   test_set_prereq UNZIP
-fi
-
 test_expect_success UNZIP 'zip archive' '
 
git archive --format=zip HEAD test.zip 
diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
index ecf00ed..85b64ae 100755
--- a/t/t5000-tar-tree.sh
+++ b/t/t5000-tar-tree.sh
@@ -25,7 +25,6 @@ commit id embedding:
 '
 
 . ./test-lib.sh
-UNZIP=${UNZIP:-unzip}
 GZIP=${GZIP:-gzip}
 GUNZIP=${GUNZIP:-gzip -d}
 
@@ -201,13 +200,6 @@ test_expect_success \
   test_cmp a/substfile2 g/prefix/a/substfile2
 '
 
-$UNZIP -v /dev/null 21
-if [ $? -eq 127 ]; then
-   say Skipping ZIP tests, because unzip was not found
-else
-   test_set_prereq UNZIP
-fi
-
 test_expect_success \
 'git archive --format=zip' \
 'git archive --format=zip HEAD d.zip'
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 8a12cbb..4ceabad 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -752,6 +752,13 @@ test_lazy_prereq AUTOIDENT '
git var GIT_AUTHOR_IDENT
 '
 
+UNZIP=${UNZIP:-unzip}
+
+test_lazy_prereq UNZIP '
+   $UNZIP -v /dev/null 21
+   test $? -ne 127
+'
+
 # When the tests are run as root, permission tests will report that
 # things are writable when they shouldn't be.
 test -w / || test_set_prereq SANITY
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Add getenv.so for catching invalid getenv() use via LD_PRELOAD

2013-01-05 Thread Matt Kraai
On Sat, Jan 05, 2013 at 03:55:46PM +0700, Nguyễn Thái Ngọc Duy wrote:
  Perhaps this will help the getenv bug hunting (I assume we do the
  hunting on Linux platform only). So far it catches this and is stuck
  at getenv in git_pager().

It seems like a static analysis tool might be able to detect these
problems.  Is there a way to do so using sparse?

 + n = backtrace(buffer, 100);
 + symbols = backtrace_symbols(buffer, n);
 + if (symbols) {
 + for (i = 0;i  n; i++)

s/;i/; i/

-- 
Matt Kraai
https://ftbfs.org/kraai
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Remove duplicate entry in ./Documentation/Makefile

2012-12-19 Thread Matt Kraai
Hi,

Junio C Hamano wrote:
 If not by eyeballing but with some mechanical process, did you spot
 any others?

I found one other unnecessarily duplicated line in the top-level
Makefile:

 LIB_H += xdiff/xdiff.h

by running

 find -name Makefile | xargs grep += | sort | uniq -d

and inspecting the results by hand, but this only checked lines
containing +=.

-- 
Matt Kraai
https://ftbfs.org/kraai
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 0/2] Port to QNX

2012-12-18 Thread Matt Kraai
This series ports Git to QNX.  It differs from the previous version in
that:

 * it's rebased on dm/port, so it narrows the scope of the lock
   variable in builtin/fetch-pack.c instead of fetch-pack.c and uses
   HAVE_STRINGS_H; and
 * it disables use of Pthreads, since fork(2) doesn't work once
   Pthreads are used.

The first test suite failure occurs because getcwd(3) can return paths
containing symbolic links.

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/2] Make lock local to fetch_pack

2012-12-18 Thread Matt Kraai
From: Matt Kraai matt.kr...@amo.abbott.com

lock is only used by fetch_pack, so move it into that function.

Signed-off-by: Matt Kraai matt.kr...@amo.abbott.com
---
 builtin/fetch-pack.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c
index e644398..9bc10b3 100644
--- a/builtin/fetch-pack.c
+++ b/builtin/fetch-pack.c
@@ -875,8 +875,6 @@ static int fetch_pack_config(const char *var, const char 
*value, void *cb)
return git_default_config(var, value, cb);
 }
 
-static struct lock_file lock;
-
 static void fetch_pack_setup(void)
 {
static int did_setup;
@@ -1069,6 +1067,7 @@ struct ref *fetch_pack(struct fetch_pack_args *my_args,
ref_cpy = do_fetch_pack(fd, ref, sought, pack_lockfile);
 
if (args.depth  0) {
+   static struct lock_file lock;
struct cache_time mtime;
struct strbuf sb = STRBUF_INIT;
char *shallow = git_path(shallow);
-- 
1.8.0.2.8.gc42826d.dirty

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 2/2] Port to QNX

2012-12-18 Thread Matt Kraai
From: Matt Kraai matt.kr...@amo.abbott.com

Signed-off-by: Matt Kraai matt.kr...@amo.abbott.com
---
 Makefile  | 21 +
 git-compat-util.h |  6 +-
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 2c1f04f..a39dc83 100644
--- a/Makefile
+++ b/Makefile
@@ -80,6 +80,8 @@ all::
 #
 # Define NO_MEMMEM if you don't have memmem.
 #
+# Define NO_GETPAGESIZE if you don't have getpagesize.
+#
 # Define NO_STRLCPY if you don't have strlcpy.
 #
 # Define NO_STRTOUMAX if you don't have both strtoimax and strtoumax in the
@@ -1446,6 +1448,22 @@ else
NO_CURL = YesPlease
 endif
 endif
+ifeq ($(uname_S),QNX)
+   COMPAT_CFLAGS += -DSA_RESTART=0
+   HAVE_STRINGS_H = YesPlease
+   NEEDS_SOCKET = YesPlease
+   NO_FNMATCH_CASEFOLD = YesPlease
+   NO_GETPAGESIZE = YesPlease
+   NO_ICONV = YesPlease
+   NO_MEMMEM = YesPlease
+   NO_MKDTEMP = YesPlease
+   NO_MKSTEMPS = YesPlease
+   NO_NSEC = YesPlease
+   NO_PTHREADS = YesPlease
+   NO_R_TO_GCC_LINKER = YesPlease
+   NO_STRCASESTR = YesPlease
+   NO_STRLCPY = YesPlease
+endif
 
 -include config.mak.autogen
 -include config.mak
@@ -1863,6 +1881,9 @@ ifdef NO_MEMMEM
COMPAT_CFLAGS += -DNO_MEMMEM
COMPAT_OBJS += compat/memmem.o
 endif
+ifdef NO_GETPAGESIZE
+   COMPAT_CFLAGS += -DNO_GETPAGESIZE
+endif
 ifdef INTERNAL_QSORT
COMPAT_CFLAGS += -DINTERNAL_QSORT
COMPAT_OBJS += compat/qsort.o
diff --git a/git-compat-util.h b/git-compat-util.h
index a88147b..610e6b7 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -75,7 +75,7 @@
 # endif
 #elif !defined(__APPLE__)  !defined(__FreeBSD__)  !defined(__USLC__)  \
   !defined(_M_UNIX)  !defined(__sgi)  !defined(__DragonFly__)  \
-  !defined(__TANDEM)
+  !defined(__TANDEM)  !defined(__QNX__)
 #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
@@ -413,6 +413,10 @@ void *gitmemmem(const void *haystack, size_t haystacklen,
 const void *needle, size_t needlelen);
 #endif
 
+#ifdef NO_GETPAGESIZE
+#define getpagesize() sysconf(_SC_PAGESIZE)
+#endif
+
 #ifdef FREAD_READS_DIRECTORIES
 #ifdef fopen
 #undef fopen
-- 
1.8.0.2.8.gc42826d.dirty

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: What's cooking in git.git (Dec 2012, #04; Sun, 16)

2012-12-17 Thread Matt Kraai
Junio C Hamano wrote:
 It could turn out that we may be able to get rid of sys/param.h
 altogether, but one step at a time.  Inputs from people on minority
 platforms are very much appreciated---does your platform build fine
 when the inclusion of the file is removed from git-compat-util.h?

QNX builds fine when sys/param.h is not included.

-- 
Matt Kraai
https://ftbfs.org/kraai
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/2] Port to QNX

2012-12-15 Thread Matt Kraai
On Sat, Dec 15, 2012 at 10:38:30AM -0800, Junio C Hamano wrote:
 I do not mind queuing this on 'pu' but do you want to see your
 ftbfs.org address in the commit objects, or the other one that you
 are not using to interact with us?

Great!  I'd prefer to use the amo.abbott.com address in the commit
objects, since that's where I did the work.  I'm using this email
address because it doesn't require figuring out how to send proper
emails via Outlook and/or Exchange.

-- 
Matt
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] Port to QNX

2012-12-14 Thread Matt Kraai
From: Matt Kraai matt.kr...@amo.abbott.com

Signed-off-by: Matt Kraai matt.kr...@amo.abbott.com
---
 Makefile  | 19 +++
 git-compat-util.h |  8 ++--
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 736ecd4..ed2539d 100644
--- a/Makefile
+++ b/Makefile
@@ -78,6 +78,8 @@ all::
 #
 # Define NO_MEMMEM if you don't have memmem.
 #
+# Define NO_GETPAGESIZE if you don't have getpagesize.
+#
 # Define NO_STRLCPY if you don't have strlcpy.
 #
 # Define NO_STRTOUMAX if you don't have both strtoimax and strtoumax in the
@@ -1448,6 +1450,20 @@ else
NO_CURL = YesPlease
 endif
 endif
+ifeq ($(uname_S),QNX)
+   COMPAT_CFLAGS += -DSA_RESTART=0
+   NEEDS_SOCKET = YesPlease
+   NO_MKDTEMP = YesPlease
+   NO_MKSTEMPS = YesPlease
+   NO_FNMATCH_CASEFOLD = YesPlease
+   NO_GETPAGESIZE = YesPlease
+   NO_ICONV = YesPlease
+   NO_MEMMEM = YesPlease
+   NO_NSEC = YesPlease
+   NO_STRCASESTR = YesPlease
+   NO_STRLCPY = YesPlease
+   PTHREAD_LIBS =
+endif
 
 -include config.mak.autogen
 -include config.mak
@@ -1859,6 +1875,9 @@ ifdef NO_MEMMEM
COMPAT_CFLAGS += -DNO_MEMMEM
COMPAT_OBJS += compat/memmem.o
 endif
+ifdef NO_GETPAGESIZE
+   COMPAT_CFLAGS += -DNO_GETPAGESIZE
+endif
 ifdef INTERNAL_QSORT
COMPAT_CFLAGS += -DINTERNAL_QSORT
COMPAT_OBJS += compat/qsort.o
diff --git a/git-compat-util.h b/git-compat-util.h
index 2e79b8a..6c588ca 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -75,7 +75,7 @@
 # endif
 #elif !defined(__APPLE__)  !defined(__FreeBSD__)  !defined(__USLC__)  \
   !defined(_M_UNIX)  !defined(__sgi)  !defined(__DragonFly__)  \
-  !defined(__TANDEM)
+  !defined(__TANDEM)  !defined(__QNX__)
 #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
@@ -99,7 +99,7 @@
 #include stdlib.h
 #include stdarg.h
 #include string.h
-#ifdef __TANDEM /* or HAVE_STRINGS_H or !NO_STRINGS_H? */
+#if defined(__TANDEM) || defined(__QNX__) /* or HAVE_STRINGS_H or 
!NO_STRINGS_H? */
 #include strings.h /* for strcasecmp() */
 #endif
 #include errno.h
@@ -411,6 +411,10 @@ void *gitmemmem(const void *haystack, size_t haystacklen,
 const void *needle, size_t needlelen);
 #endif
 
+#ifdef NO_GETPAGESIZE
+#define getpagesize() sysconf(_SC_PAGESIZE)
+#endif
+
 #ifdef FREAD_READS_DIRECTORIES
 #ifdef fopen
 #undef fopen
-- 
1.8.1-rc1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/2] Port to QNX

2012-12-14 Thread Matt Kraai
This series ports Git to QNX.  It builds on both QNX 6.3.2 and QNX
6.5.0.  The test suite does not pass.  Unless the corresponding
software is installed, the following arguments must be passed to Make:

 NO_CURL=1 NO_GETTEXT=1 NO_OPENSSL=1 NO_PERL=1 NO_PYTHON=1 NO_TCLTK=1

  [1/2]: Make lock local to fetch_pack

QNX 6.3.2's unistd.h declares a function named lock, which causes
fetch-pack.c to fail to compile if lock has file-scope.  Since it's
only used in a single function, move it therein.

  [2/2]: Port to QNX
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] Make lock local to fetch_pack

2012-12-14 Thread Matt Kraai
From: Matt Kraai matt.kr...@amo.abbott.com

lock is only used by fetch_pack, so move it into that function.

Signed-off-by: Matt Kraai matt.kr...@amo.abbott.com
---
 fetch-pack.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fetch-pack.c b/fetch-pack.c
index 099ff4d..9d9762d 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -874,8 +874,6 @@ static int fetch_pack_config(const char *var, const char 
*value, void *cb)
return git_default_config(var, value, cb);
 }
 
-static struct lock_file lock;
-
 static void fetch_pack_setup(void)
 {
static int did_setup;
@@ -896,6 +894,7 @@ struct ref *fetch_pack(struct fetch_pack_args *args,
   struct string_list *sought,
   char **pack_lockfile)
 {
+   static struct lock_file lock;
struct stat st;
struct ref *ref_cpy;
 
-- 
1.8.1-rc1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] docs: move submodule section

2012-11-14 Thread Matt Kraai
293ab15e (submodule: teach rm to remove submodules unless they
contain a git directory, 2012-09-26) inserted the Submodules
section between a sentence describing a command and the command.  Move
the Submodules section further down.

Signed-off-by: Matt Kraai kr...@ftbfs.org
---
 Documentation/git-rm.txt |   30 +++---
 1 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/Documentation/git-rm.txt b/Documentation/git-rm.txt
index 882cb11..262436b 100644
--- a/Documentation/git-rm.txt
+++ b/Documentation/git-rm.txt
@@ -107,21 +107,6 @@ as well as modifications of existing paths.
 Typically you would first remove all tracked files from the working
 tree using this command:
 
-Submodules
-~~
-Only submodules using a gitfile (which means they were cloned
-with a git version 1.7.8 or newer) will be removed from the work
-tree, as their repository lives inside the .git directory of the
-superproject. If a submodule (or one of those nested inside it)
-still uses a .git directory, `git rm` will fail - no matter if forced
-or not - to protect the submodule's history.
-
-A submodule is considered up-to-date when the HEAD is the same as
-recorded in the index, no tracked files are modified and no untracked
-files that aren't ignored are present in the submodules work tree.
-Ignored files are deemed expendable and won't stop a submodule's work
-tree from being removed.
-
 
 git ls-files -z | xargs -0 rm -f
 
@@ -149,6 +134,21 @@ use the following command:
 git diff --name-only --diff-filter=D -z | xargs -0 git rm --cached
 
 
+Submodules
+~~
+Only submodules using a gitfile (which means they were cloned
+with a git version 1.7.8 or newer) will be removed from the work
+tree, as their repository lives inside the .git directory of the
+superproject. If a submodule (or one of those nested inside it)
+still uses a .git directory, `git rm` will fail - no matter if forced
+or not - to protect the submodule's history.
+
+A submodule is considered up-to-date when the HEAD is the same as
+recorded in the index, no tracked files are modified and no untracked
+files that aren't ignored are present in the submodules work tree.
+Ignored files are deemed expendable and won't stop a submodule's work
+tree from being removed.
+
 EXAMPLES
 
 `git rm Documentation/\*.txt`::
-- 
1.7.2.5

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] docs: move submodule section

2012-11-14 Thread Matt Kraai
On Wed, Nov 14, 2012 at 10:49:04AM -0800, Matt Kraai wrote:
 293ab15e (submodule: teach rm to remove submodules unless they
 contain a git directory, 2012-09-26) inserted the Submodules
 section between a sentence describing a command and the command.  Move
 the Submodules section further down.
 
 Signed-off-by: Matt Kraai kr...@ftbfs.org

Sorry, I amended the patch to include a Reported-by line but forgot to
reformat it before sending.  It should have included:

 Reported-by: Horst H. von Brand vonbr...@inf.utfsm.cl

-- 
Matt Kraai
https://ftbfs.org/kraai
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/5] t/test-lib-functions.sh: allow to specify the tag name to test_commit

2012-11-14 Thread Matt Kraai
On Wed, Nov 14, 2012 at 05:37:50PM -0800, Brandon Casey wrote:
 -# Both file and contents default to message.
 +# Both file contents and tag default to message.

I think this line would be better as

 # file, contents, and tag all default to message.

since there's now more than two arguments that default to message.

-- 
Matt
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] git-credential-gnome-keyring: Remove die

2012-11-10 Thread Matt Kraai
git-credential-gnome-keyring defines die, but it is unused and
incorrect (it passes a va_list to error, which does not expect one),
so remove it.

Signed-off-by: Matt Kraai kr...@ftbfs.org
---
 .../credential/gnome-keyring/git-credential-gnome-keyring.c  |   10 --
 1 file changed, 10 deletions(-)

diff --git a/contrib/credential/gnome-keyring/git-credential-gnome-keyring.c 
b/contrib/credential/gnome-keyring/git-credential-gnome-keyring.c
index 41f61c5..3eaafba 100644
--- a/contrib/credential/gnome-keyring/git-credential-gnome-keyring.c
+++ b/contrib/credential/gnome-keyring/git-credential-gnome-keyring.c
@@ -104,16 +104,6 @@ static inline void error(const char *fmt, ...)
va_end(ap);
 }
 
-static inline void die(const char *fmt, ...)
-{
-   va_list ap;
-
-   va_start(ap,fmt);
-   error(fmt, ap);
-   va_end(ap);
-   exit(EXIT_FAILURE);
-}
-
 static inline void die_errno(int err)
 {
error(%s, strerror(err));
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] parse_dirstat_params(): use string_list to split comma-separated string

2012-10-31 Thread Matt Kraai
On Wed, Oct 31, 2012 at 10:06:36AM -0400, Jeff King wrote:
 On Tue, Oct 30, 2012 at 06:43:51PM +, Matt Kraai wrote:
 
  Michael Haggerty mhagger at alum.mit.edu writes:
   + if (*params_copy)
  
  params_copy is set to the value returned by xstrdup, which cannot be NULL.
  This check can be removed and if params_string can be NULL, it should be
  checked before being passed to xstrdup.
 
 If you are referring to the last line, isn't it checking whether the
 string is empty, not NULL?

Oops, you're right.  Sorry for misreading that.

-- 
Matt Kraai
https://ftbfs.org/kraai
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] parse_dirstat_params(): use string_list to split comma-separated string

2012-10-30 Thread Matt Kraai
Michael Haggerty mhagger at alum.mit.edu writes:
...
 -static int parse_dirstat_params(struct diff_options *options, const char ...
 +static int parse_dirstat_params(struct diff_options *options, const char ...
   struct strbuf *errmsg)
  {
 - const char *p = params;
 - int p_len, ret = 0;
 + char *params_copy = xstrdup(params_string);
 + struct string_list params = STRING_LIST_INIT_NODUP;
 + int ret = 0;
 + int i;
 
 - while (*p) {
 - p_len = strchrnul(p, ',') - p;
 - if (!memcmp(p, changes, p_len)) {
 + if (*params_copy)

params_copy is set to the value returned by xstrdup, which cannot be NULL.
This check can be removed and if params_string can be NULL, it should be
checked before being passed to xstrdup.

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html