<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/pretty.c, branch v2.6.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.6.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.6.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2015-06-29T18:39:07Z</updated>
<entry>
<title>convert "enum date_mode" into a struct</title>
<updated>2015-06-29T18:39:07Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-06-25T16:55:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a5481a6c9438cbd9c246cfa59ff49c31a0926fb6'/>
<id>urn:sha1:a5481a6c9438cbd9c246cfa59ff49c31a0926fb6</id>
<content type='text'>
In preparation for adding date modes that may carry extra
information beyond the mode itself, this patch converts the
date_mode enum into a struct.

Most of the conversion is fairly straightforward; we pass
the struct as a pointer and dereference the type field where
necessary. Locations that declare a date_mode can use a "{}"
constructor.  However, the tricky case is where we use the
enum labels as constants, like:

  show_date(t, tz, DATE_NORMAL);

Ideally we could say:

  show_date(t, tz, &amp;{ DATE_NORMAL });

but of course C does not allow that. Likewise, we cannot
cast the constant to a struct, because we need to pass an
actual address. Our options are basically:

  1. Manually add a "struct date_mode d = { DATE_NORMAL }"
     definition to each caller, and pass "&amp;d". This makes
     the callers uglier, because they sometimes do not even
     have their own scope (e.g., they are inside a switch
     statement).

  2. Provide a pre-made global "date_normal" struct that can
     be passed by address. We'd also need "date_rfc2822",
     "date_iso8601", and so forth. But at least the ugliness
     is defined in one place.

  3. Provide a wrapper that generates the correct struct on
     the fly. The big downside is that we end up pointing to
     a single global, which makes our wrapper non-reentrant.
     But show_date is already not reentrant, so it does not
     matter.

This patch implements 3, along with a minor macro to keep
the size of the callers sane.

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/simple-cleanups'</title>
<updated>2015-03-05T20:45:42Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-03-05T20:45:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8a6444d50ea73350ae7e6083ecc63393749e5bb0'/>
<id>urn:sha1:8a6444d50ea73350ae7e6083ecc63393749e5bb0</id>
<content type='text'>
Code cleanups.

* rs/simple-cleanups:
  sha1_name: use strlcpy() to copy strings
  pretty: use starts_with() to check for a prefix
  for-each-ref: use skip_prefix() to avoid duplicate string comparison
  connect: use strcmp() for string comparison
</content>
</entry>
<entry>
<title>pretty: use starts_with() to check for a prefix</title>
<updated>2015-02-22T20:01:37Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2015-02-21T19:53:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=68d6d6eb402d7e39c89ce43ca37e6c16b941890c'/>
<id>urn:sha1:68d6d6eb402d7e39c89ce43ca37e6c16b941890c</id>
<content type='text'>
Simplify the code and avoid duplication by using starts_with() instead
of strlen() and strncmp() to check if a line starts with "encoding ".

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>Merge branch 'jn/parse-config-slot'</title>
<updated>2014-10-20T19:23:48Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-10-20T19:23:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b94657683996402228abb1694a5db4792c424f9e'/>
<id>urn:sha1:b94657683996402228abb1694a5db4792c424f9e</id>
<content type='text'>
Code cleanup.

* jn/parse-config-slot:
  color_parse: do not mention variable name in error message
  pass config slots as pointers instead of offsets
</content>
</entry>
<entry>
<title>color_parse: do not mention variable name in error message</title>
<updated>2014-10-14T18:01:21Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-10-07T19:33:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f6c5a2968c103621adf6928a29e4895361eaa23b'/>
<id>urn:sha1:f6c5a2968c103621adf6928a29e4895361eaa23b</id>
<content type='text'>
Originally the color-parsing function was used only for
config variables. It made sense to pass the variable name so
that the die() message could be something like:

  $ git -c color.branch.plain=bogus branch
  fatal: bad color value 'bogus' for variable 'color.branch.plain'

These days we call it in other contexts, and the resulting
error messages are a little confusing:

  $ git log --pretty='%C(bogus)'
  fatal: bad color value 'bogus' for variable '--pretty format'

  $ git config --get-color foo.bar bogus
  fatal: bad color value 'bogus' for variable 'command line'

This patch teaches color_parse to complain only about the
value, and then return an error code. Config callers can
then propagate that up to the config parser, which mentions
the variable name. Other callers can provide a custom
message. After this patch these three cases now look like:

  $ git -c color.branch.plain=bogus branch
  error: invalid color value: bogus
  fatal: unable to parse 'color.branch.plain' from command-line config

  $ git log --pretty='%C(bogus)'
  error: invalid color value: bogus
  fatal: unable to parse --pretty format

  $ git config --get-color foo.bar bogus
  error: invalid color value: bogus
  fatal: unable to parse default color value

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>use skip_prefix() to avoid more magic numbers</title>
<updated>2014-10-07T18:09:16Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2014-10-04T18:54:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e3f1da982e4f14e7146964cb25a5011a3f41e84a'/>
<id>urn:sha1:e3f1da982e4f14e7146964cb25a5011a3f41e84a</id>
<content type='text'>
Continue where ae021d87 (use skip_prefix to avoid magic numbers) left off
and use skip_prefix() in more places for determining the lengths of prefix
strings to avoid using dependent constants and other indirect methods.

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>Merge branch 'hj/pretty-naked-decoration'</title>
<updated>2014-09-29T19:36:09Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-09-29T19:36:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b8e533f12acec63242c5405286fbbcfa66eecfdd'/>
<id>urn:sha1:b8e533f12acec63242c5405286fbbcfa66eecfdd</id>
<content type='text'>
The pretty-format specifier "%d", which expanded to " (tagname)"
for a tagged commit, gained a cousin "%D" that just gives the
"tagname" without frills.

* hj/pretty-naked-decoration:
  pretty: add %D format specifier
</content>
</entry>
<entry>
<title>Merge branch 'rs/export-strbuf-addchars'</title>
<updated>2014-09-19T18:38:39Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-09-19T18:38:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=56feed1c7641bbf7920efe6607c6a04309073baa'/>
<id>urn:sha1:56feed1c7641bbf7920efe6607c6a04309073baa</id>
<content type='text'>
Code clean-up.

* rs/export-strbuf-addchars:
  strbuf: use strbuf_addchars() for adding a char multiple times
  strbuf: export strbuf_addchars()
</content>
</entry>
<entry>
<title>Merge branch 'jk/commit-author-parsing'</title>
<updated>2014-09-19T18:38:33Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-09-19T18:38:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9ff700ebacffc8fb8cf80daabfb6503cb24dca0b'/>
<id>urn:sha1:9ff700ebacffc8fb8cf80daabfb6503cb24dca0b</id>
<content type='text'>
Code clean-up.

* jk/commit-author-parsing:
  determine_author_info(): copy getenv output
  determine_author_info(): reuse parsing functions
  date: use strbufs in date-formatting functions
  record_author_date(): use find_commit_header()
  record_author_date(): fix memory leak on malformed commit
  commit: provide a function to find a header in a buffer
</content>
</entry>
<entry>
<title>Merge branch 'bb/date-iso-strict'</title>
<updated>2014-09-19T18:38:32Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-09-19T18:38:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ceeacc501bc64dcdff180a9250bf2fcea3582837'/>
<id>urn:sha1:ceeacc501bc64dcdff180a9250bf2fcea3582837</id>
<content type='text'>
"log --date=iso" uses a slight variant of ISO 8601 format that is
made more human readable.  A new "--date=iso-strict" option gives
datetime output that is more strictly conformant.

* bb/date-iso-strict:
  pretty: provide a strict ISO 8601 date format
</content>
</entry>
</feed>
