<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/git-compat-util.h, branch v2.5.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.5.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.5.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2015-08-11T21:24:50Z</updated>
<entry>
<title>vreportf: report to arbitrary filehandles</title>
<updated>2015-08-11T21:24:50Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-08-11T18:06:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3b331e92671469614662830402103848a8004b97'/>
<id>urn:sha1:3b331e92671469614662830402103848a8004b97</id>
<content type='text'>
The vreportf function always goes to stderr, but run-command
wants child errors to go to the parent's original stderr. To
solve this, commit a5487dd duplicates the stderr fd and
installs die and error handlers to direct the output
appropriately (which later turned into the vwritef
function). This has two downsides, though:

  - we make multiple calls to write(), which contradicts the
    "write at once" logic from d048a96 (print
    warning/error/fatal messages in one shot, 2007-11-09).

  - the custom handlers basically duplicate the normal
    handlers.  They're only a few lines of code, but we
    should not have to repeat the magic "exit(128)", for
    example.

We can solve the first by using fdopen() on the duplicated
descriptor. We can't pass this to vreportf, but we could
introduce a new vreportf_to to handle it.

However, to fix the second problem, we instead introduce a
new "set_error_handle" function, which lets the normal
vreportf calls output to a handle besides stderr. Thus we
can get rid of our custom handlers entirely, and just ask
the regular handlers to output to our new descriptor.

And as vwritef has no more callers, it can just go away.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'cb/array-size'</title>
<updated>2015-06-25T18:07:42Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-06-25T18:07:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5416f8af0f632d05371868bc4340327e1672c83c'/>
<id>urn:sha1:5416f8af0f632d05371868bc4340327e1672c83c</id>
<content type='text'>
* cb/array-size:
  Fix definition of ARRAY_SIZE for non-gcc builds
</content>
</entry>
<entry>
<title>Fix definition of ARRAY_SIZE for non-gcc builds</title>
<updated>2015-06-25T00:14:00Z</updated>
<author>
<name>Charles Bailey</name>
<email>cbailey32@bloomberg.net</email>
</author>
<published>2015-06-24T22:12:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e2c6f7cd5a66ed0009662d2651e0cf3c655e83a9'/>
<id>urn:sha1:e2c6f7cd5a66ed0009662d2651e0cf3c655e83a9</id>
<content type='text'>
The improved ARRAY_SIZE macro uses BARF_UNLESS_AN_ARRAY which expands
to a valid check for recent gcc versions and to 0 for older gcc
versions but is not defined on non-gcc builds.

Non-gcc builds need this macro to expand to 0 as well. The current outer
test (defined(__GNUC__) &amp;&amp; (__GNUC__ &gt;= 3)) is a strictly weaker
condition than the inner test (GIT_GNUC_PREREQ(3, 1)) so we can omit the
outer test and cause the BARF_UNLESS_AN_ARRAY macro to be defined
correctly on non-gcc builds as well as gcc builds with older versions.

Signed-off-by: Charles Bailey &lt;cbailey32@bloomberg.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jk/diagnose-config-mmap-failure'</title>
<updated>2015-06-11T16:29:55Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-06-11T16:29:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=dee47925c1d001947cf9a099e1cb883835f90c64'/>
<id>urn:sha1:dee47925c1d001947cf9a099e1cb883835f90c64</id>
<content type='text'>
The configuration reader/writer uses mmap(2) interface to access
the files; when we find a directory, it barfed with "Out of memory?".

* jk/diagnose-config-mmap-failure:
  xmmap(): drop "Out of memory?"
  config.c: rewrite ENODEV into EISDIR when mmap fails
  config.c: avoid xmmap error messages
  config.c: fix mmap leak when writing config
  read-cache.c: drop PROT_WRITE from mmap of index
</content>
</entry>
<entry>
<title>config.c: avoid xmmap error messages</title>
<updated>2015-05-28T18:33:18Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-05-28T07:56:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1570856b510e3722a3620063e7ba209106b75857'/>
<id>urn:sha1:1570856b510e3722a3620063e7ba209106b75857</id>
<content type='text'>
The config-writing code uses xmmap to map the existing
config file, which will die if the map fails. This has two
downsides:

  1. The error message is not very helpful, as it lacks any
     context about the file we are mapping:

       $ mkdir foo
       $ git config --file=foo some.key value
       fatal: Out of memory? mmap failed: No such device

  2. We normally do not die in this code path; instead, we'd
     rather report the error and return an appropriate exit
     status (which is part of the public interface
     documented in git-config.1).

This patch introduces a "gentle" form of xmmap which lets us
produce our own error message. We do not want to use mmap
directly, because we would like to use the other
compatibility elements of xmmap (e.g., handling 0-length
maps portably).

The end result is:

    $ git.compile config --file=foo some.key value
    error: unable to mmap 'foo': No such device
    $ echo $?
    3

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'nd/untracked-cache'</title>
<updated>2015-05-26T20:24:46Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-05-26T20:24:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=38ccaf93bbf5a99dbff908068292ffaa5bafe25e'/>
<id>urn:sha1:38ccaf93bbf5a99dbff908068292ffaa5bafe25e</id>
<content type='text'>
Teach the index to optionally remember already seen untracked files
to speed up "git status" in a working tree with tons of cruft.

* nd/untracked-cache: (24 commits)
  git-status.txt: advertisement for untracked cache
  untracked cache: guard and disable on system changes
  mingw32: add uname()
  t7063: tests for untracked cache
  update-index: test the system before enabling untracked cache
  update-index: manually enable or disable untracked cache
  status: enable untracked cache
  untracked-cache: temporarily disable with $GIT_DISABLE_UNTRACKED_CACHE
  untracked cache: mark index dirty if untracked cache is updated
  untracked cache: print stats with $GIT_TRACE_UNTRACKED_STATS
  untracked cache: avoid racy timestamps
  read-cache.c: split racy stat test to a separate function
  untracked cache: invalidate at index addition or removal
  untracked cache: load from UNTR index extension
  untracked cache: save to an index extension
  ewah: add convenient wrapper ewah_serialize_strbuf()
  untracked cache: don't open non-existent .gitignore
  untracked cache: mark what dirs should be recursed/saved
  untracked cache: record/validate dir mtime and reuse cached output
  untracked cache: make a wrapper around {open,read,close}dir()
  ...
</content>
</entry>
<entry>
<title>Merge branch 'ep/do-not-feed-a-pointer-to-array-size'</title>
<updated>2015-05-11T21:24:00Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-05-11T21:24:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7cb5073fcaffe8a8c0572fdffb332110b0eaae69'/>
<id>urn:sha1:7cb5073fcaffe8a8c0572fdffb332110b0eaae69</id>
<content type='text'>
Catch a programmer mistake to feed a pointer not an array to
ARRAY_SIZE() macro, by using a couple of GCC extensions.

* ep/do-not-feed-a-pointer-to-array-size:
  git-compat-util.h: implement a different ARRAY_SIZE macro for for safely deriving the size of array
</content>
</entry>
<entry>
<title>git-compat-util.h: implement a different ARRAY_SIZE macro for for safely deriving the size of array</title>
<updated>2015-05-05T22:26:48Z</updated>
<author>
<name>Elia Pinto</name>
<email>gitter.spiros@gmail.com</email>
</author>
<published>2015-04-30T12:44:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=89c855ed3cbe64bea93ea081d0e96077e9ee8517'/>
<id>urn:sha1:89c855ed3cbe64bea93ea081d0e96077e9ee8517</id>
<content type='text'>
To get number of elements in an array git use the ARRAY_SIZE macro
defined as:

       #define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))

The problem with it is a possibility of mistakenly passing to it a
pointer instead an array. The ARRAY_SIZE macro as conventionally
defined does not provide good type-safety and the open-coded
approach is more fragile, more verbose and provides no improvement in
type-safety.

Use instead a different but compatible ARRAY_SIZE() macro,
which will also break compile if you try to
use it on a pointer. This implemention revert to the original code
if the compiler doesn't know the typeof and __builtin_types_compatible_p
GCC extensions.

This can ensure our code is robust to changes, without
needing a gratuitous macro or constant. A similar
ARRAY_SIZE implementation also exists in the linux kernel.

Credits to Rusty Russell and his ccan library.

Signed-off-by: Elia Pinto &lt;gitter.spiros@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>git-compat-util: add fallbacks for unlocked stdio</title>
<updated>2015-04-16T15:15:04Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-04-16T08:48:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f43cce23adde58d44081e46279c7fd655d4246ec'/>
<id>urn:sha1:f43cce23adde58d44081e46279c7fd655d4246ec</id>
<content type='text'>
POSIX.1-2001 specifies some functions for optimizing the
locking out of tight getc() loops. Not all systems are
POSIX, though, and even not all POSIX systems are required
to implement these functions. We can check for the
feature-test macro to see if they are available, and if not,
provide a noop implementation.

There's no Makefile knob here, because we should just detect
this automatically. If there are very bizarre systems, we
may need to add one, but it's not clear yet in which
direction:

  1. If a system defines _POSIX_THREAD_SAFE_FUNCTIONS but
     these functions are missing or broken, we would want a
     knob to manually turn them off.

  2. If a system has these functions but does not define
     _POSIX_THREAD_SAFE_FUNCTIONS, we would want a knob to
     manually turn them on.

We can add such a knob when we find a real-world system that
matches this.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'km/bsd-sysctl'</title>
<updated>2015-03-20T20:11:49Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-03-20T20:11:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=551fc7aec1a7efe868a59fbeea14582b41923f4d'/>
<id>urn:sha1:551fc7aec1a7efe868a59fbeea14582b41923f4d</id>
<content type='text'>
We now detect number of CPUs on older BSD-derived systems.

* km/bsd-sysctl:
  thread-utils.c: detect CPU count on older BSD-like systems
  configure: support HAVE_BSD_SYSCTL option
</content>
</entry>
</feed>
