<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/compat, branch v2.1.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.1.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.1.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2014-07-30T21:21:09Z</updated>
<entry>
<title>Merge branch 'sk/mingw-uni-fix-more'</title>
<updated>2014-07-30T21:21:09Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-07-30T21:21:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=385e171a5b56dabbe33dbef6f88e8f934a6cacda'/>
<id>urn:sha1:385e171a5b56dabbe33dbef6f88e8f934a6cacda</id>
<content type='text'>
Most of these are battle-tested in msysgit and are needed to
complete what has been merged to 'master' already.

* sk/mingw-uni-fix-more:
  Win32: enable color output in Windows cmd.exe
  Win32: patch Windows environment on startup
  Win32: keep the environment sorted
  Win32: use low-level memory allocation during initialization
  Win32: reduce environment array reallocations
  Win32: don't copy the environment twice when spawning child processes
  Win32: factor out environment block creation
  Win32: unify environment function names
  Win32: unify environment case-sensitivity
  Win32: fix environment memory leaks
  Win32: Unicode environment (incoming)
  Win32: Unicode environment (outgoing)
  Revert "Windows: teach getenv to do a case-sensitive search"
  tests: do not pass iso8859-1 encoded parameter
</content>
</entry>
<entry>
<title>Merge branch 'maint'</title>
<updated>2014-07-21T19:35:39Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-07-21T19:35:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9ab08822556c49a7856dadd0e9a42f9ec2aaf850'/>
<id>urn:sha1:9ab08822556c49a7856dadd0e9a42f9ec2aaf850</id>
<content type='text'>
* maint:
  use xmemdupz() to allocate copies of strings given by start and length
  use xcalloc() to allocate zero-initialized memory
</content>
</entry>
<entry>
<title>Merge branch 'sk/mingw-uni-fix'</title>
<updated>2014-07-21T18:18:50Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-07-21T18:18:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=80e85754e08da9999f7b7ab956465150aebcf44d'/>
<id>urn:sha1:80e85754e08da9999f7b7ab956465150aebcf44d</id>
<content type='text'>
* sk/mingw-uni-fix:
  Win32: Unicode file name support (dirent)
  Win32: Unicode file name support (except dirent)
</content>
</entry>
<entry>
<title>use xcalloc() to allocate zero-initialized memory</title>
<updated>2014-07-21T17:30:21Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2014-07-19T13:56:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=51a60f5bfbaf1ee7c7a2d2b73eca4f042f7af8cb'/>
<id>urn:sha1:51a60f5bfbaf1ee7c7a2d2b73eca4f042f7af8cb</id>
<content type='text'>
Use xcalloc() instead of xmalloc() followed by memset() to allocate
and zero out memory because it's shorter and avoids duplicating the
function parameters.

Signed-off-by: Rene Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Win32: enable color output in Windows cmd.exe</title>
<updated>2014-07-21T16:32:50Z</updated>
<author>
<name>Karsten Blees</name>
<email>blees@dcon.de</email>
</author>
<published>2014-07-17T15:38:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=baea068d677fae92d7903e984cf93bbd5195a000'/>
<id>urn:sha1:baea068d677fae92d7903e984cf93bbd5195a000</id>
<content type='text'>
Git requires the TERM environment variable to be set for all color*
settings. Simulate the TERM variable if it is not set (default on Windows).

Signed-off-by: Karsten Blees &lt;blees@dcon.de&gt;
Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Stepan Kasal &lt;kasal@ucw.cz&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Win32: patch Windows environment on startup</title>
<updated>2014-07-21T16:32:50Z</updated>
<author>
<name>Karsten Blees</name>
<email>blees@dcon.de</email>
</author>
<published>2014-07-17T15:38:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6dc715439b8e9ec85d6412750665431dd6a5afc6'/>
<id>urn:sha1:6dc715439b8e9ec85d6412750665431dd6a5afc6</id>
<content type='text'>
Fix Windows specific environment settings on startup rather than checking
for special values on every getenv call.

As a side effect, this makes the patched environment (i.e. with properly
initialized TMPDIR and TERM) available to child processes.

Signed-off-by: Karsten Blees &lt;blees@dcon.de&gt;
Signed-off-by: Stepan Kasal &lt;kasal@ucw.cz&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Win32: keep the environment sorted</title>
<updated>2014-07-21T16:32:50Z</updated>
<author>
<name>Karsten Blees</name>
<email>blees@dcon.de</email>
</author>
<published>2014-07-17T15:38:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=343ff06da7d83f40892b10a3b653c7d0e6cb526c'/>
<id>urn:sha1:343ff06da7d83f40892b10a3b653c7d0e6cb526c</id>
<content type='text'>
The Windows environment is sorted, keep it that way for O(log n)
environment access.

Change compareenv to compare only the keys, so that it can be used to
find an entry irrespective of the value.

Change lookupenv to binary seach for an entry. Return one's complement of
the insert position if not found (libc's bsearch returns NULL).

Replace MSVCRT's getenv with a minimal do_getenv based on the binary search
function.

Change do_putenv to insert new entries at the correct position. Simplify
the function by swapping if conditions and using memmove instead of for
loops.

Move qsort from make_environment_block to mingw_startup. We still need to
sort on startup to make sure that the environment is sorted according to
our compareenv function (while Win32 / CreateProcess requires the
environment block to be sorted case-insensitively, CreateProcess currently
doesn't enforce this, and some applications such as bash just don't care).

Note that environment functions are _not_ thread-safe and are not required
to be so by POSIX, the application is responsible for synchronizing access
to the environment. MSVCRT's getenv and our new getenv implementation are
better than that in that they are thread-safe with respect to other getenv
calls as long as the environment is not modified. Git's indiscriminate use
of getenv in background threads currently requires this property.

Signed-off-by: Karsten Blees &lt;blees@dcon.de&gt;
Signed-off-by: Stepan Kasal &lt;kasal@ucw.cz&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Win32: use low-level memory allocation during initialization</title>
<updated>2014-07-21T16:32:50Z</updated>
<author>
<name>Karsten Blees</name>
<email>blees@dcon.de</email>
</author>
<published>2014-07-17T15:38:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6f1c189cadd7c18c03138070324af02563c0b0d1'/>
<id>urn:sha1:6f1c189cadd7c18c03138070324af02563c0b0d1</id>
<content type='text'>
As of d41489a6 "Add more large blob test cases", git's high-level memory
allocation functions (xmalloc, xmemdupz etc.) access the environment to
simulate limited memory in tests (see 'getenv("GIT_ALLOC_LIMIT")' in
memory_limit_check()). These functions should not be used before the
environment is fully initialized (particularly not to initialize the
environment itself).

The current solution ('environ = NULL; ALLOC_GROW(environ...)') only works
because MSVCRT's getenv() reinitializes environ when it is NULL (i.e. it
leaves us with two sets of unusabe (non-UTF-8) and unfreeable (CRT-
allocated) environments).

Add our own set of malloc-or-die functions to be used in startup code.

Also check the result of __wgetmainargs, which may fail if there's not
enough memory for wide-char arguments and environment.

This patch is in preparation of the sorted environment feature, which
completely replaces MSVCRT's getenv() implementation.

Signed-off-by: Karsten Blees &lt;blees@dcon.de&gt;
Signed-off-by: Stepan Kasal &lt;kasal@ucw.cz&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Win32: reduce environment array reallocations</title>
<updated>2014-07-21T16:32:49Z</updated>
<author>
<name>Karsten Blees</name>
<email>blees@dcon.de</email>
</author>
<published>2014-07-17T15:38:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f279242d5e3f17e01e1d70010c4f072798899a47'/>
<id>urn:sha1:f279242d5e3f17e01e1d70010c4f072798899a47</id>
<content type='text'>
Move environment array reallocation from do_putenv to the respective
callers. Keep track of the environment size in a global variable. Use
ALLOC_GROW in mingw_putenv to reduce reallocations. Allocate a
sufficiently sized environment array in make_environment_block to prevent
reallocations.

Signed-off-by: Karsten Blees &lt;blees@dcon.de&gt;
Signed-off-by: Stepan Kasal &lt;kasal@ucw.cz&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Win32: don't copy the environment twice when spawning child processes</title>
<updated>2014-07-21T16:32:49Z</updated>
<author>
<name>Karsten Blees</name>
<email>blees@dcon.de</email>
</author>
<published>2014-07-17T15:38:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=77734da241f97607eea8f2bb55e0e19937e918d4'/>
<id>urn:sha1:77734da241f97607eea8f2bb55e0e19937e918d4</id>
<content type='text'>
When spawning child processes via start_command(), the environment and all
environment entries are copied twice. First by make_augmented_environ /
copy_environ to merge with child_process.env. Then a second time by
make_environment_block to create a sorted environment block string as
required by CreateProcess.

Move the merge logic to make_environment_block so that we only need to copy
the environment once. This changes semantics of the env parameter: it now
expects a delta (such as child_process.env) rather than a full environment.
This is not a problem as the parameter is only used by start_command()
(all other callers previously passed char **environ, and now pass NULL).

The merge logic no longer xstrdup()s the environment strings, so do_putenv
must not free them. Add a parameter to distinguish this from normal putenv.

Remove the now unused make_augmented_environ / free_environ API.

Signed-off-by: Karsten Blees &lt;blees@dcon.de&gt;
Signed-off-by: Stepan Kasal &lt;kasal@ucw.cz&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
