<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/parse-options-cb.c, branch v2.12.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.12.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.12.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2016-10-17T20:25:21Z</updated>
<entry>
<title>Merge branch 'rs/cocci'</title>
<updated>2016-10-17T20:25:21Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-10-17T20:25:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=69e6544998892a2bd3c785cd238c786da40cf6a3'/>
<id>urn:sha1:69e6544998892a2bd3c785cd238c786da40cf6a3</id>
<content type='text'>
Code cleanup.

* rs/cocci:
  use strbuf_add_unique_abbrev() for adding short hashes, part 3
  remove unnecessary NULL check before free(3)
</content>
</entry>
<entry>
<title>remove unnecessary NULL check before free(3)</title>
<updated>2016-10-10T18:37:41Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2016-10-08T14:14:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=39ea59a2570547166834ceeff9ae0c0c05748f35'/>
<id>urn:sha1:39ea59a2570547166834ceeff9ae0c0c05748f35</id>
<content type='text'>
free(3) handles NULL pointers just fine.  Add a semantic patch for
removing unnecessary NULL checks before calling this function, and
apply it on the code base.

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 'mh/diff-indent-heuristic'</title>
<updated>2016-09-26T23:09:16Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-09-26T23:09:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b7af6ae5cff8439fdf5b72f926cab2e614906af3'/>
<id>urn:sha1:b7af6ae5cff8439fdf5b72f926cab2e614906af3</id>
<content type='text'>
Output from "git diff" can be made easier to read by selecting
which lines are common and which lines are added/deleted
intelligently when the lines before and after the changed section
are the same.  A command line option is added to help with the
experiment to find a good heuristics.

* mh/diff-indent-heuristic:
  blame: honor the diff heuristic options and config
  parse-options: add parse_opt_unknown_cb()
  diff: improve positioning of add/delete blocks in diffs
  xdl_change_compact(): introduce the concept of a change group
  recs_match(): take two xrecord_t pointers as arguments
  is_blank_line(): take a single xrecord_t as argument
  xdl_change_compact(): only use heuristic if group can't be matched
  xdl_change_compact(): fix compaction heuristic to adjust ixo
</content>
</entry>
<entry>
<title>parse-options: add parse_opt_unknown_cb()</title>
<updated>2016-09-19T17:25:11Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2016-09-05T09:44:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ce564eb1bd541a87152e3546fb7d7a2b460df7ed'/>
<id>urn:sha1:ce564eb1bd541a87152e3546fb7d7a2b460df7ed</id>
<content type='text'>
Add a new callback function, parse_opt_unknown_cb(), which returns -2 to
indicate that the corresponding option is unknown. This can be used to
add "-h" documentation for an option that will be handled externally to
parse_options().

Signed-off-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jk/parse-options-concat'</title>
<updated>2016-08-03T22:10:25Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-08-03T22:10:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d083d420b7d24a57cfd32af71100ae4c887f3a39'/>
<id>urn:sha1:d083d420b7d24a57cfd32af71100ae4c887f3a39</id>
<content type='text'>
Users of the parse_options_concat() API function need to allocate
extra slots in advance and fill them with OPT_END() when they want
to decide the set of supported options dynamically, which makes the
code error-prone and hard to read.  This has been corrected by tweaking
the API to allocate and return a new copy of "struct option" array.

* jk/parse-options-concat:
  parse_options: allocate a new array when concatenating
</content>
</entry>
<entry>
<title>parse_options: allocate a new array when concatenating</title>
<updated>2016-07-06T17:11:08Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2016-07-05T20:44:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=023ff39b2994804e4a7b2274b22336bdb37d4a54'/>
<id>urn:sha1:023ff39b2994804e4a7b2274b22336bdb37d4a54</id>
<content type='text'>
In exactly one callers (builtin/revert.c), we build up the
options list dynamically from multiple arrays. We do so by
manually inserting "filler" entries into one array, and then
copying the other array into the allocated space.

This is tedious and error-prone, as you have to adjust the
filler any time the second array is modified (although we do
at least check and die() when the counts do not match up).

Instead, let's just allocate a new array.

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 'jk/parseopt-string-list' into jk/string-list-static-init</title>
<updated>2016-06-13T17:37:48Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-06-13T17:37:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7013220d2b3181d4ae55e21e0f18b9abfd6e011d'/>
<id>urn:sha1:7013220d2b3181d4ae55e21e0f18b9abfd6e011d</id>
<content type='text'>
* jk/parseopt-string-list:
  blame,shortlog: don't make local option variables static
  interpret-trailers: don't duplicate option strings
  parse_opt_string_list: stop allocating new strings
</content>
</entry>
<entry>
<title>parse_opt_string_list: stop allocating new strings</title>
<updated>2016-06-13T17:33:08Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2016-06-13T05:39:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7a7a517a2f6264a893ed47f8daf02cb221aca67c'/>
<id>urn:sha1:7a7a517a2f6264a893ed47f8daf02cb221aca67c</id>
<content type='text'>
The parse_opt_string_list callback is basically a thin
wrapper to string_list_append() any string options we get.
However, it calls:

  string_list_append(v, xstrdup(arg));

which duplicates the option value. This is wrong for two
reasons:

  1. If the string list has strdup_strings set, then we are
     making an extra copy, which is simply leaked.

  2. If the string list does not have strdup_strings set,
     then we pass memory ownership to the string list, but
     it does not realize this. If we later call
     string_list_clear(), which can happen if "--no-foo" is
     passed, then we will leak all of the existing entries.

Instead, we should just pass the argument straight to
string_list_append, and it can decide whether to copy or not
based on its strdup_strings flag.

It's possible that some (buggy) caller could be relying on
this extra copy (e.g., because it parses some options from
an allocated argv array and then frees the array), but it's
not likely. For one, we generally only use parse_options on
the argv given to us in main(). And two, such a caller is
broken anyway, because other option types like OPT_STRING()
do not make such a copy.  This patch brings us in line with
them.

Noticed-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
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 'kn/for-each-tag-branch'</title>
<updated>2015-10-05T19:30:03Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-10-05T19:30:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9958dd8685a0a8b3d6ecdd07e35d8ecb22b304a7'/>
<id>urn:sha1:9958dd8685a0a8b3d6ecdd07e35d8ecb22b304a7</id>
<content type='text'>
Some features from "git tag -l" and "git branch -l" have been made
available to "git for-each-ref" so that eventually the unified
implementation can be shared across all three, in a follow-up
series or two.

* kn/for-each-tag-branch:
  for-each-ref: add '--contains' option
  ref-filter: implement '--contains' option
  parse-options.h: add macros for '--contains' option
  parse-option: rename parse_opt_with_commit()
  for-each-ref: add '--merged' and '--no-merged' options
  ref-filter: implement '--merged' and '--no-merged' options
  ref-filter: add parse_opt_merge_filter()
  for-each-ref: add '--points-at' option
  ref-filter: implement '--points-at' option
  tag: libify parse_opt_points_at()
  t6302: for-each-ref tests for ref-filter APIs
</content>
</entry>
<entry>
<title>parse-option: rename parse_opt_with_commit()</title>
<updated>2015-08-03T17:25:28Z</updated>
<author>
<name>Karthik Nayak</name>
<email>karthik.188@gmail.com</email>
</author>
<published>2015-07-07T16:06:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9d306b5a6077f026291df3c4a5968eaf95a92417'/>
<id>urn:sha1:9d306b5a6077f026291df3c4a5968eaf95a92417</id>
<content type='text'>
Rename parse_opt_with_commit() to parse_opt_commits() to show
that it can be used to obtain a list of commits and is not
constricted to usage of '--contains' option.

Mentored-by: Christian Couder &lt;christian.couder@gmail.com&gt;
Mentored-by: Matthieu Moy &lt;matthieu.moy@grenoble-inp.fr&gt;
Signed-off-by: Karthik Nayak &lt;karthik.188@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
