<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/range-diff.c, branch v2.35.8</title>
<subtitle>Fork of git SCM with my patches.</subtitle>
<id>http://git.kilabit.info/git/atom?h=v2.35.8</id>
<link rel='self' href='http://git.kilabit.info/git/atom?h=v2.35.8'/>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/'/>
<updated>2022-01-05T21:29:23Z</updated>
<entry>
<title>i18n: refactor "foo and bar are mutually exclusive"</title>
<updated>2022-01-05T21:29:23Z</updated>
<author>
<name>Jean-Noël Avila</name>
<email>jn.avila@free.fr</email>
</author>
<published>2022-01-05T20:02:14Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=43ea635c35371b22a7a2010398d47040c5b95adc'/>
<id>urn:sha1:43ea635c35371b22a7a2010398d47040c5b95adc</id>
<content type='text'>
Use static strings for constant parts of the sentences. They are all
turned into "cannot be used together".

Signed-off-by: Jean-Noël Avila &lt;jn.avila@free.fr&gt;
Reviewed-by: Johannes Sixt &lt;j6t@kdbg.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'rs/range-diff-avoid-segfault-with-I'</title>
<updated>2021-09-15T20:15:27Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-09-15T20:15:27Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=3d141d87897676b81990fb47cdd75a562dd5dad9'/>
<id>urn:sha1:3d141d87897676b81990fb47cdd75a562dd5dad9</id>
<content type='text'>
"git range-diff -I... &lt;range&gt; &lt;range&gt;" segfaulted, which has been
corrected.

* rs/range-diff-avoid-segfault-with-I:
  range-diff: avoid segfault with -I
</content>
</entry>
<entry>
<title>range-diff: avoid segfault with -I</title>
<updated>2021-09-07T20:03:13Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2021-09-04T07:50:58Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=709b3f32d333df1e29dbb073b4e9e834f130a989'/>
<id>urn:sha1:709b3f32d333df1e29dbb073b4e9e834f130a989</id>
<content type='text'>
output() reuses the same struct diff_options for multiple calls of
diff_flush().  Set the option no_free to instruct it to keep the
ignore regexes between calls and release them explicitly at the end.

Signed-off-by: René 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 'jk/range-diff-fixes'</title>
<updated>2021-08-30T23:06:05Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-08-30T23:06:05Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=fb0b14df651184ef16b7f0dc093b7d46c7062413'/>
<id>urn:sha1:fb0b14df651184ef16b7f0dc093b7d46c7062413</id>
<content type='text'>
"git range-diff" code clean-up.

* jk/range-diff-fixes:
  range-diff: use ssize_t for parsed "len" in read_patches()
  range-diff: handle unterminated lines in read_patches()
  range-diff: drop useless "offset" variable from read_patches()
</content>
</entry>
<entry>
<title>range-diff: use ssize_t for parsed "len" in read_patches()</title>
<updated>2021-08-10T18:37:36Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2021-08-09T22:48:48Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=c4d5907324394228e08a42589a044fa14d7ffdcc'/>
<id>urn:sha1:c4d5907324394228e08a42589a044fa14d7ffdcc</id>
<content type='text'>
As we iterate through the buffer containing git-log output, parsing
lines, we use an "int" to store the size of an individual line. This
should be a size_t, as we have no guarantee that there is not a
malicious 2GB+ commit-message line in the output.

Overflowing this integer probably doesn't do anything _too_ terrible. We
are not using the value to size a buffer, so the worst case is probably
an out-of-bounds read from before the array. But it's easy enough to
fix.

Note that we have to use ssize_t here, since we also store the length
result from parse_git_diff_header(), which may return a negative value
for error. That function actually returns an int itself, which has a
similar overflow problem, but I'll leave that for another day. Much
of the apply.c code uses ints and should be converted as a whole; in the
meantime, a negative return from parse_git_diff_header() will be
interpreted as an error, and we'll bail (so we can't handle such a case,
but given that it's likely to be malicious anyway, the important thing
is we don't have any memory errors).

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Acked-by: Derrick Stolee &lt;dstolee@microsoft.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>range-diff: handle unterminated lines in read_patches()</title>
<updated>2021-08-10T18:37:36Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2021-08-09T22:48:39Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=7c86d365da1fe2e02f568365f0ae45deb2bd412e'/>
<id>urn:sha1:7c86d365da1fe2e02f568365f0ae45deb2bd412e</id>
<content type='text'>
When parsing our buffer of output from git-log, we have a
find_end_of_line() helper that finds the next newline, and gives us the
number of bytes to move past it, or the size of the whole remaining
buffer if there is no newline.

But trying to handle both those cases leads to some oddities:

  - we try to overwrite the newline with NUL in the caller, by writing
    over line[len-1]. This is at best redundant, since the helper will
    already have done so if it saw a newline. But if it didn't see a
    newline, it's actively wrong; we'll overwrite the byte at the end of
    the (unterminated) line.

    We could solve this just dropping the extra NUL assignment in the
    caller and just letting the helper do the right thing. But...

  - if we see a "diff --git" line, we'll restore the newline on top of
    the NUL byte, so we can pass the string to parse_git_diff_header().
    But if there was no newline in the first place, we can't do this.
    There's no place to put it (the current code writes a newline
    over whatever byte we obliterated earlier). The best we can do is
    feed the complete remainder of the buffer to the function (which is,
    in fact, a string, by virtue of being a strbuf).

To solve this, the caller needs to know whether we actually found a
newline or not. We could modify find_end_of_line() to return that
information, but we can further observe that it has only one caller.
So let's just inline it in that caller.

Nobody seems to have noticed this case, probably because git-log would
never produce input that doesn't end with a newline. Arguably we could
just return an error as soon as we see that the output does not end in a
newline. But the code to do so actually ends up _longer_, mostly because
of the cleanup we have to do in handling the error.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Acked-by: Derrick Stolee &lt;dstolee@microsoft.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>range-diff: drop useless "offset" variable from read_patches()</title>
<updated>2021-08-10T18:37:36Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2021-08-09T22:47:42Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=47ac23d31483fa8f942117fa5e0c0a70572e9e59'/>
<id>urn:sha1:47ac23d31483fa8f942117fa5e0c0a70572e9e59</id>
<content type='text'>
The "offset" variable was was introduced in 44b67cb62b (range-diff:
split lines manually, 2019-07-11), but it has never done anything
useful. We use it to count up the number of bytes we've consumed, but we
never look at the result. It was probably copied accidentally from an
almost-identical loop in apply.c:find_header() (and the point of that
commit was to make use of the parse_git_diff_header() function which
underlies both).

Because the variable was set but not used, most compilers didn't seem to
notice, but the upcoming clang-14 does complain about it, via its
-Wunused-but-set-variable warning.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Acked-by: Derrick Stolee &lt;dstolee@microsoft.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ab/pickaxe-pcre2'</title>
<updated>2021-07-13T23:52:50Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-07-13T23:52:50Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=4da281e84d87b099ba8d0a255534dc1251be968e'/>
<id>urn:sha1:4da281e84d87b099ba8d0a255534dc1251be968e</id>
<content type='text'>
Rewrite the backend for "diff -G/-S" to use pcre2 engine when
available.

* ab/pickaxe-pcre2: (22 commits)
  xdiff-interface: replace discard_hunk_line() with a flag
  xdiff users: use designated initializers for out_line
  pickaxe -G: don't special-case create/delete
  pickaxe -G: terminate early on matching lines
  xdiff-interface: allow early return from xdiff_emit_line_fn
  xdiff-interface: prepare for allowing early return
  pickaxe -S: slightly optimize contains()
  pickaxe: rename variables in has_changes() for brevity
  pickaxe -S: support content with NULs under --pickaxe-regex
  pickaxe: assert that we must have a needle under -G or -S
  pickaxe: refactor function selection in diffcore-pickaxe()
  perf: add performance test for pickaxe
  pickaxe/style: consolidate declarations and assignments
  diff.h: move pickaxe fields together again
  pickaxe: die when --find-object and --pickaxe-all are combined
  pickaxe: die when -G and --pickaxe-regex are combined
  pickaxe tests: add missing test for --no-pickaxe-regex being an error
  pickaxe tests: test for -G, -S and --find-object incompatibility
  pickaxe tests: add test for "log -S" not being a regex
  pickaxe tests: add test for diffgrep_consume() internals
  ...
</content>
</entry>
<entry>
<title>xdiff-interface: prepare for allowing early return</title>
<updated>2021-05-11T03:47:31Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2021-04-12T17:15:24Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=a8d5eb6dc0d61625667b0d8155c425d3629baa12'/>
<id>urn:sha1:a8d5eb6dc0d61625667b0d8155c425d3629baa12</id>
<content type='text'>
Change the function prototype of xdiff_emit_line_fn to return an "int"
instead of "void". Change all of those functions to "return 0",
nothing checks those return values yet, and no behavior is being
changed.

In subsequent commits the interface will be changed to allow early
return via this new return value.

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>hash: provide per-algorithm null OIDs</title>
<updated>2021-04-27T07:31:39Z</updated>
<author>
<name>brian m. carlson</name>
<email>sandals@crustytoothpaste.net</email>
</author>
<published>2021-04-26T01:02:56Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=14228447c9ce664a4e9c31ba10344ec5e4ea4ba5'/>
<id>urn:sha1:14228447c9ce664a4e9c31ba10344ec5e4ea4ba5</id>
<content type='text'>
Up until recently, object IDs did not have an algorithm member, only a
hash.  Consequently, it was possible to share one null (all-zeros)
object ID among all hash algorithms.  Now that we're going to be
handling objects from multiple hash algorithms, it's important to make
sure that all object IDs have a correct algorithm field.

Introduce a per-algorithm null OID, and add it to struct hash_algo.
Introduce a wrapper function as well, and use it everywhere we used to
use the null_oid constant.

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>
