<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/utf8.h, branch v1.8.2.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v1.8.2.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v1.8.2.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2013-04-03T16:25:29Z</updated>
<entry>
<title>Merge branch 'ks/rfc2047-one-char-at-a-time' into maint</title>
<updated>2013-04-03T16:25:29Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-04-03T16:25:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e6658b9d6917d9888fa41702bf53393c57de0631'/>
<id>urn:sha1:e6658b9d6917d9888fa41702bf53393c57de0631</id>
<content type='text'>
When "format-patch" quoted a non-ascii strings on the header files,
it incorrectly applied rfc2047 and chopped a single character in the
middle of it.

* ks/rfc2047-one-char-at-a-time:
  format-patch: RFC 2047 says multi-octet character may not be split
</content>
</entry>
<entry>
<title>format-patch: RFC 2047 says multi-octet character may not be split</title>
<updated>2013-03-09T19:11:19Z</updated>
<author>
<name>Kirill Smelkov</name>
<email>kirr@mns.spb.ru</email>
</author>
<published>2013-03-07T10:55:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6cd3c0532772749bcf6c4688f34c8ecc65ecb655'/>
<id>urn:sha1:6cd3c0532772749bcf6c4688f34c8ecc65ecb655</id>
<content type='text'>
Even though an earlier attempt (bafc478..41dd00bad) cleaned
up RFC 2047 encoding, pretty.c::add_rfc2047() still decides
where to split the output line by going through the input
one byte at a time, and potentially splits a character in
the middle.  A subject line may end up showing like this:

     ".... fö?? bar".   (instead of  ".... föö bar".)

if split incorrectly.

RFC 2047, section 5 (3) explicitly forbids such beaviour

    Each 'encoded-word' MUST represent an integral number of
    characters.  A multi-octet character may not be split across
    adjacent 'encoded- word's.

that means that e.g. for

    Subject: .... föö bar

encoding

    Subject: =?UTF-8?q?....=20f=C3=B6=C3=B6?=
     =?UTF-8?q?=20bar?=

is correct, and

    Subject: =?UTF-8?q?....=20f=C3=B6=C3?=      &lt;-- NOTE ö is broken here
     =?UTF-8?q?=B6=20bar?=

is not, because "ö" character UTF-8 encoding C3 B6 is split here across
adjacent encoded words.

To fix the problem, make the loop grab one _character_ at a time and
determine its output length to see where to break the output line.  Note
that this version only knows about UTF-8, but the logic to grab one
character is abstracted out in mbs_chrlen() function to make it possible
to extend it to other encodings with the help of iconv in the future.

Signed-off-by: Kirill Smelkov &lt;kirr@mns.spb.ru&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jx/utf8-printf-width'</title>
<updated>2013-02-14T18:29:08Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-02-14T18:29:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3cc3cf970c5ce477bde78df73614d1efba2b52eb'/>
<id>urn:sha1:3cc3cf970c5ce477bde78df73614d1efba2b52eb</id>
<content type='text'>
Use a new helper that prints a message and counts its display width
to align the help messages parse-options produces.

* jx/utf8-printf-width:
  Add utf8_fprintf helper that returns correct number of columns
</content>
</entry>
<entry>
<title>Add utf8_fprintf helper that returns correct number of columns</title>
<updated>2013-02-11T19:29:45Z</updated>
<author>
<name>Jiang Xin</name>
<email>worldhello.net@gmail.com</email>
</author>
<published>2013-02-09T06:31:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c082196575e13dd5960031f213b20e2df989ca18'/>
<id>urn:sha1:c082196575e13dd5960031f213b20e2df989ca18</id>
<content type='text'>
Since command usages can be translated, they may include utf-8
encoded strings, and the output in console may not align well any
more. This is because strlen() is different from strwidth() on utf-8
strings.

A wrapper utf8_fprintf() can help to return the correct number of
columns required.

Signed-off-by: Jiang Xin &lt;worldhello.net@gmail.com&gt;
Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Reviewed-by: Torsten Bögershausen &lt;tboegi@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'sp/shortlog-missing-lf'</title>
<updated>2013-01-02T18:40:34Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-01-02T18:40:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=71288e15dfd6638d14b307b564d1230a4500daa1'/>
<id>urn:sha1:71288e15dfd6638d14b307b564d1230a4500daa1</id>
<content type='text'>
When a line to be wrapped has a solid run of non space characters
whose length exactly is the wrap width, "git shortlog -w" failed to
add a newline after such a line.

* sp/shortlog-missing-lf:
  strbuf_add_wrapped*(): Remove unused return value
  shortlog: fix wrapping lines of wraplen
</content>
</entry>
<entry>
<title>strbuf_add_wrapped*(): Remove unused return value</title>
<updated>2012-12-11T18:05:17Z</updated>
<author>
<name>Steffen Prohaska</name>
<email>prohaska@zib.de</email>
</author>
<published>2012-12-11T05:59:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e0db1765c3bb108b55ebf82b4e5962f9d1f5e5b7'/>
<id>urn:sha1:e0db1765c3bb108b55ebf82b4e5962f9d1f5e5b7</id>
<content type='text'>
Since shortlog isn't using the return value anymore (see previous
commit), the functions can be changed to void.

Signed-off-by: Steffen Prohaska &lt;prohaska@zib.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>reencode_string(): introduce and use same_encoding()</title>
<updated>2012-11-04T13:10:33Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2012-10-19T05:41:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0e18bcd5e937b9e5857892e7f5c80c3c5b1da5d4'/>
<id>urn:sha1:0e18bcd5e937b9e5857892e7f5c80c3c5b1da5d4</id>
<content type='text'>
Callers of reencode_string() that re-encodes a string from one
encoding to another all used ad-hoc way to bypass the case where the
input and the output encodings are the same.  Some did strcmp(),
some did strcasecmp(), yet some others when converting to UTF-8 used
is_encoding_utf8().

Introduce same_encoding() helper function to make these callers use
the same logic.  Notably, is_encoding_utf8() has a work-around for
common misconfiguration to use "utf8" to name UTF-8 encoding, which
does not match "UTF-8" hence strcasecmp() would not consider the
same.  Make use of it in this helper function.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>git on Mac OS and precomposed unicode</title>
<updated>2012-07-09T05:03:46Z</updated>
<author>
<name>Torsten Bögershausen</name>
<email>tboegi@web.de</email>
</author>
<published>2012-07-08T13:50:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=76759c7dff53e8c84e975b88cb8245587c14c7ba'/>
<id>urn:sha1:76759c7dff53e8c84e975b88cb8245587c14c7ba</id>
<content type='text'>
Mac OS X mangles file names containing unicode on file systems HFS+,
VFAT or SAMBA.  When a file using unicode code points outside ASCII
is created on a HFS+ drive, the file name is converted into
decomposed unicode and written to disk. No conversion is done if
the file name is already decomposed unicode.

Calling open("\xc3\x84", ...) with a precomposed "Ä" yields the same
result as open("\x41\xcc\x88",...) with a decomposed "Ä".

As a consequence, readdir() returns the file names in decomposed
unicode, even if the user expects precomposed unicode.  Unlike on
HFS+, Mac OS X stores files on a VFAT drive (e.g. an USB drive) in
precomposed unicode, but readdir() still returns file names in
decomposed unicode.  When a git repository is stored on a network
share using SAMBA, file names are send over the wire and written to
disk on the remote system in precomposed unicode, but Mac OS X
readdir() returns decomposed unicode to be compatible with its
behaviour on HFS+ and VFAT.

The unicode decomposition causes many problems:

- The names "git add" and other commands get from the end user may
  often be precomposed form (the decomposed form is not easily input
  from the keyboard), but when the commands read from the filesystem
  to see what it is going to update the index with already is on the
  filesystem, readdir() will give decomposed form, which is different.

- Similarly "git log", "git mv" and all other commands that need to
  compare pathnames found on the command line (often but not always
  precomposed form; a command line input resulting from globbing may
  be in decomposed) with pathnames found in the tree objects (should
  be precomposed form to be compatible with other systems and for
  consistency in general).

- The same for names stored in the index, which should be
  precomposed, that may need to be compared with the names read from
  readdir().

NFS mounted from Linux is fully transparent and does not suffer from
the above.

As Mac OS X treats precomposed and decomposed file names as equal,
we can

 - wrap readdir() on Mac OS X to return the precomposed form, and

 - normalize decomposed form given from the command line also to the
   precomposed form,

to ensure that all pathnames used in Git are always in the
precomposed form.  This behaviour can be requested by setting
"core.precomposedunicode" configuration variable to true.

The code in compat/precomposed_utf8.c implements basically 4 new
functions: precomposed_utf8_opendir(), precomposed_utf8_readdir(),
precomposed_utf8_closedir() and precompose_argv().  The first three
are to wrap opendir(3), readdir(3), and closedir(3) functions.

The argv[] conversion allows to use the TAB filename completion done
by the shell on command line.  It tolerates other tools which use
readdir() to feed decomposed file names into git.

When creating a new git repository with "git init" or "git clone",
"core.precomposedunicode" will be set "false".

The user needs to activate this feature manually.  She typically
sets core.precomposedunicode to "true" on HFS and VFAT, or file
systems mounted via SAMBA.

Helped-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Signed-off-by: Torsten Bögershausen &lt;tboegi@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>strbuf: add fixed-length version of add_wrapped_text</title>
<updated>2011-02-23T21:44:36Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2011-02-23T09:50:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=98acc837a14c2ab1975b38b93cb028e87e47ad4a'/>
<id>urn:sha1:98acc837a14c2ab1975b38b93cb028e87e47ad4a</id>
<content type='text'>
The function strbuf_add_wrapped_text takes a NUL-terminated
string. This makes it annoying to wrap strings we have as a
pointer and a length.

Refactoring strbuf_add_wrapped_text and all of its
sub-functions to handle fixed-length strings turned out to
be really ugly. So this implementation is lame; it just
strdups the text and operates on the NUL-terminated version.
This should be fine as the strings we are wrapping are
generally pretty short.  If it becomes a problem, we can
optimize later.

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 'rs/optim-text-wrap'</title>
<updated>2010-03-02T20:44:10Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2010-03-02T20:44:10Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=32ae5b342545f168b6006bcd8974cc96650d083d'/>
<id>urn:sha1:32ae5b342545f168b6006bcd8974cc96650d083d</id>
<content type='text'>
* rs/optim-text-wrap:
  utf8.c: speculatively assume utf-8 in strbuf_add_wrapped_text()
  utf8.c: remove strbuf_write()
  utf8.c: remove print_spaces()
  utf8.c: remove print_wrapped_text()
</content>
</entry>
</feed>
