<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/xdiff-interface.c, branch v2.22.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.22.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.22.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2019-02-20T20:31:56Z</updated>
<entry>
<title>completion: add more parameter value completion</title>
<updated>2019-02-20T20:31:56Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2019-02-16T11:24:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5a59a2301f6ec9bcf1b101edb9ca33beb465842f'/>
<id>urn:sha1:5a59a2301f6ec9bcf1b101edb9ca33beb465842f</id>
<content type='text'>
This adds value completion for a couple more paramters. To make it
easier to maintain these hard coded lists, add a comment at the original
list/code to remind people to update git-completion.bash too.

Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jk/xdiff-interface'</title>
<updated>2018-11-13T13:37:27Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-11-13T13:37:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=39d23dfa409e51844ddda99599927092c8300f12'/>
<id>urn:sha1:39d23dfa409e51844ddda99599927092c8300f12</id>
<content type='text'>
The interface into "xdiff" library used to discover the offset and
size of a generated patch hunk by first formatting it into the
textual hunk header "@@ -n,m +k,l @@" and then parsing the numbers
out.  A new interface has been introduced to allow callers a more
direct access to them.

* jk/xdiff-interface:
  xdiff-interface: drop parse_hunk_header()
  range-diff: use a hunk callback
  diff: convert --check to use a hunk callback
  combine-diff: use an xdiff hunk callback
  diff: use hunk callback for word-diff
  diff: discard hunk headers for patch-ids earlier
  diff: avoid generating unused hunk header lines
  xdiff-interface: provide a separate consume callback for hunks
  xdiff: provide a separate emit callback for hunks
</content>
</entry>
<entry>
<title>xdiff-interface: drop parse_hunk_header()</title>
<updated>2018-11-05T04:14:35Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-11-02T06:40:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5eade0746e1daf659a9559d804068f9f31614625'/>
<id>urn:sha1:5eade0746e1daf659a9559d804068f9f31614625</id>
<content type='text'>
This function was used only for parsing the hunk headers generated by
xdiff. Now that we can use hunk callbacks to get that information
directly, it has outlived its usefulness.

Note to anyone who wants to resurrect it: the "len" parameter was
totally unused, meaning that the function could read past the end of the
"line" array. In practice this never happened, because we only used it
to parse xdiff's generated header lines. But it would be dangerous to
use it for other cases without fixing this defect.

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>diff: use hunk callback for word-diff</title>
<updated>2018-11-05T04:14:35Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-11-02T06:37:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7c61e25fbf1a4a65208be1197940a383f220a1b7'/>
<id>urn:sha1:7c61e25fbf1a4a65208be1197940a383f220a1b7</id>
<content type='text'>
Our word-diff does not look at the -/+ lines generated by xdiff at all
(because they are not real lines to show the user, but just the
tokenized words split into lines). Instead we use the line numbers from
the hunk headers to index our own data structure.

As a result, our xdi_diff_outf() callback throws away all lines except
hunk headers. We can instead use a hunk callback, which has two
benefits:

  1. We don't have to re-parse the generated hunk header line, but can
     use the passed parameters directly.

  2. By setting our line callback to NULL, we can tell xdiff-interface
     that it does not even need to bother generating the other lines,
     saving a small amount of work.

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>diff: avoid generating unused hunk header lines</title>
<updated>2018-11-05T04:14:35Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-11-02T06:36:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3b40a090fd4e441e88897dfa96f50039952ed45b'/>
<id>urn:sha1:3b40a090fd4e441e88897dfa96f50039952ed45b</id>
<content type='text'>
Some callers of xdi_diff_outf() do not look at the generated hunk header
lines at all. By plugging in a no-op hunk callback, this tells xdiff not
to even bother formatting them.

This patch introduces a stock no-op callback and uses it with a few
callers whose line callbacks explicitly ignore hunk headers (because
they look only for +/- lines).

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>xdiff-interface: provide a separate consume callback for hunks</title>
<updated>2018-11-02T11:43:02Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-11-02T06:35:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9346d6d14dddc7989ba879839d58f6c2426cffbb'/>
<id>urn:sha1:9346d6d14dddc7989ba879839d58f6c2426cffbb</id>
<content type='text'>
The previous commit taught xdiff to optionally provide the hunk header
data to a specialized callback. But most users of xdiff actually use our
more convenient xdi_diff_outf() helper, which ensures that our callbacks
are always fed whole lines.

Let's plumb the special hunk-callback through this interface, too. It
will follow the same rule as xdiff when the hunk callback is NULL (i.e.,
continue to pass a stringified hunk header to the line callback). Since
we add NULL to each caller, there should be no behavior change yet.

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>xdiff: provide a separate emit callback for hunks</title>
<updated>2018-11-02T11:43:02Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-11-02T06:35:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=611e42a5980a3a9f8bb3b1b49c1abde63c7a191e'/>
<id>urn:sha1:611e42a5980a3a9f8bb3b1b49c1abde63c7a191e</id>
<content type='text'>
The xdiff library always emits hunk header lines to our callbacks as
formatted strings like "@@ -a,b +c,d @@\n". This is convenient if we're
going to output a diff, but less so if we actually need to compute using
those numbers, which requires re-parsing the line.

In preparation for moving away from this, let's teach xdiff a new
callback function which gets the broken-out hunk information. To help
callers that don't want to use this new callback, if it's NULL we'll
continue to format the hunk header into a string.

Note that this function renames the "outf" callback to "out_line", as
well. This isn't strictly necessary, but helps in two ways:

  1. Now that there are two callbacks, it's nice to use more descriptive
     names.

  2. Many callers did not zero the emit_callback_data struct, and needed
     to be modified to set ecb.out_hunk to NULL. By changing the name of
     the existing struct member, that guarantees that any new callers
     from in-flight topics will break the build and be examined
     manually.

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>convert "oidcmp() == 0" to oideq()</title>
<updated>2018-08-29T18:32:49Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-08-28T21:22:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4a7e27e95797c0a094f8ee300a260777ddd7eec9'/>
<id>urn:sha1:4a7e27e95797c0a094f8ee300a260777ddd7eec9</id>
<content type='text'>
Using the more restrictive oideq() should, in the long run,
give the compiler more opportunities to optimize these
callsites. For now, this conversion should be a complete
noop with respect to the generated code.

The result is also perhaps a little more readable, as it
avoids the "zero is equal" idiom. Since it's so prevalent in
C, I think seasoned programmers tend not to even notice it
anymore, but it can sometimes make for awkward double
negations (e.g., we can drop a few !!oidcmp() instances
here).

This patch was generated almost entirely by the included
coccinelle patch. This mechanical conversion should be
completely safe, because we check explicitly for cases where
oidcmp() is compared to 0, which is what oideq() is doing
under the hood. Note that we don't have to catch "!oidcmp()"
separately; coccinelle's standard isomorphisms make sure the
two are treated equivalently.

I say "almost" because I did hand-edit the coccinelle output
to fix up a few style violations (it mostly keeps the
original formatting, but sometimes unwraps long lines).

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>object-store: move object access functions to object-store.h</title>
<updated>2018-05-16T02:42:03Z</updated>
<author>
<name>Stefan Beller</name>
<email>sbeller@google.com</email>
</author>
<published>2018-05-15T23:42:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=cbd53a2193d11e83b5bad2c3514bd1603074bc36'/>
<id>urn:sha1:cbd53a2193d11e83b5bad2c3514bd1603074bc36</id>
<content type='text'>
This should make these functions easier to find and cache.h less
overwhelming to read.

In particular, this moves:
- read_object_file
- oid_object_info
- write_object_file

As a result, most of the codebase needs to #include object-store.h.
In this patch the #include is only added to files that would fail to
compile otherwise.  It would be better to #include wherever
identifiers from the header are used.  That can happen later
when we have better tooling for it.

Signed-off-by: Stefan Beller &lt;sbeller@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>sha1_file: convert read_sha1_file to struct object_id</title>
<updated>2018-03-14T16:23:50Z</updated>
<author>
<name>brian m. carlson</name>
<email>sandals@crustytoothpaste.net</email>
</author>
<published>2018-03-12T02:27:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b4f5aca40e6f77cbabcbf4ff003c3cf30a1830c8'/>
<id>urn:sha1:b4f5aca40e6f77cbabcbf4ff003c3cf30a1830c8</id>
<content type='text'>
Convert read_sha1_file to take a pointer to struct object_id and rename
it read_object_file.  Do the same for read_sha1_file_extended.

Convert one use in grep.c to use the new function without any other code
change, since the pointer being passed is a void pointer that is already
initialized with a pointer to struct object_id.  Update the declaration
and definitions of the modified functions, and apply the following
semantic patch to convert the remaining callers:

@@
expression E1, E2, E3;
@@
- read_sha1_file(E1.hash, E2, E3)
+ read_object_file(&amp;E1, E2, E3)

@@
expression E1, E2, E3;
@@
- read_sha1_file(E1-&gt;hash, E2, E3)
+ read_object_file(E1, E2, E3)

@@
expression E1, E2, E3, E4;
@@
- read_sha1_file_extended(E1.hash, E2, E3, E4)
+ read_object_file_extended(&amp;E1, E2, E3, E4)

@@
expression E1, E2, E3, E4;
@@
- read_sha1_file_extended(E1-&gt;hash, E2, E3, E4)
+ read_object_file_extended(E1, E2, E3, E4)

Signed-off-by: brian m. carlson &lt;sandals@crustytoothpaste.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
