<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/git.git/xdiff-interface.h, branch v2.6.1</title>
<subtitle>Git
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/git.git/atom?h=v2.6.1</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/atom?h=v2.6.1'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/'/>
<updated>2015-09-28T21:57:23Z</updated>
<entry>
<title>xdiff: reject files larger than ~1GB</title>
<updated>2015-09-28T21:57:23Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-09-24T23:12:45Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=dcd1742e56ebb944c4ff62346da4548e1e3be675'/>
<id>urn:sha1:dcd1742e56ebb944c4ff62346da4548e1e3be675</id>
<content type='text'>
The xdiff code is not prepared to handle extremely large
files. It uses "int" in many places, which can overflow if
we have a very large number of lines or even bytes in our
input files. This can cause us to produce incorrect diffs,
with no indication that the output is wrong. Or worse, we
may even underallocate a buffer whose size is the result of
an overflowing addition.

We're much better off to tell the user that we cannot diff
or merge such a large file. This patch covers both cases,
but in slightly different ways:

  1. For merging, we notice the large file and cleanly fall
     back to a binary merge (which is effectively "we cannot
     merge this").

  2. For diffing, we make the binary/text distinction much
     earlier, and in many different places. For this case,
     we'll use the xdi_diff as our choke point, and reject
     any diff there before it hits the xdiff code.

     This means in most cases we'll die() immediately after.
     That's not ideal, but in practice we shouldn't
     generally hit this code path unless the user is trying
     to do something tricky. We already consider files
     larger than core.bigfilethreshold to be binary, so this
     code would only kick in when that is circumvented
     (either by bumping that value, or by using a
     .gitattribute to mark a file as diffable).

     In other words, we can avoid being "nice" here, because
     there is already nice code that tries to do the right
     thing. We are adding the suspenders to the nice code's
     belt, so notice when it has been worked around (both to
     protect the user from malicious inputs, and because it
     is better to die() than generate bogus output).

The maximum size was chosen after experimenting with feeding
large files to the xdiff code. It's just under a gigabyte,
which leaves room for two obvious cases:

  - a diff3 merge conflict result on files of maximum size X
    could be 3*X plus the size of the markers, which would
    still be only about 3G, which fits in a 32-bit int.

  - some of the diff code allocates arrays of one int per
    record. Even if each file consists only of blank lines,
    then a file smaller than 1G will have fewer than 1G
    records, and therefore the int array will fit in 4G.

Since the limit is arbitrary anyway, I chose to go under a
gigabyte, to leave a safety margin (e.g., we would not want
to overflow by allocating "(records + 1) * sizeof(int)" or
similar.

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: remove emit_func() and xdi_diff_hunks()</title>
<updated>2012-05-09T21:08:42Z</updated>
<author>
<name>René Scharfe</name>
<email>rene.scharfe@lsrfire.ath.cx</email>
</author>
<published>2012-05-09T20:24:34Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=3319e606336c13ba6475d83e700ca53537cedfd9'/>
<id>urn:sha1:3319e606336c13ba6475d83e700ca53537cedfd9</id>
<content type='text'>
The functions are unused now, remove them.

Signed-off-by: Rene Scharfe &lt;rene.scharfe@lsrfire.ath.cx&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'maint-1.7.0' into maint</title>
<updated>2010-05-04T22:20:47Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2010-05-04T22:20:47Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=6b6f5d4664c9088636418653a61f600b5e3a9ea4'/>
<id>urn:sha1:6b6f5d4664c9088636418653a61f600b5e3a9ea4</id>
<content type='text'>
* maint-1.7.0:
  remove ecb parameter from xdi_diff_outf()
</content>
</entry>
<entry>
<title>remove ecb parameter from xdi_diff_outf()</title>
<updated>2010-05-04T22:19:14Z</updated>
<author>
<name>René Scharfe</name>
<email>rene.scharfe@lsrfire.ath.cx</email>
</author>
<published>2010-05-04T20:41:34Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=dfea79004c54bc96143386d6ac22de500ba4f747'/>
<id>urn:sha1:dfea79004c54bc96143386d6ac22de500ba4f747</id>
<content type='text'>
xdi_diff_outf() overrides the structure members of its last parameter,
ignoring any value that callers pass in.  It's no surprise then that all
callers pass a pointer to an uninitialized structure.  They also don't
read it after the call, so the parameter is neither used for input nor
for output.   Turn it into a local variable of xdi_diff_outf().

Signed-off-by: Rene Scharfe &lt;rene.scharfe@lsrfire.ath.cx&gt;
Acked-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>refactor duplicated fill_mm() in checkout and merge-recursive</title>
<updated>2010-02-17T23:11:33Z</updated>
<author>
<name>Michael Lukashov</name>
<email>michael.lukashov@gmail.com</email>
</author>
<published>2010-02-16T23:42:55Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=06b65939b083ba1b71043005bf83b4883e98264e'/>
<id>urn:sha1:06b65939b083ba1b71043005bf83b4883e98264e</id>
<content type='text'>
The following function is duplicated:

  fill_mm

Move it to xdiff-interface.c and rename it 'read_mmblob', as suggested
by Junio C Hamano.

Also, change parameters order for consistency with read_mmfile().

Signed-off-by: Michael Lukashov &lt;michael.lukashov@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>userdiff: add xdiff_clear_find_func()</title>
<updated>2009-07-02T02:16:37Z</updated>
<author>
<name>René Scharfe</name>
<email>rene.scharfe@lsrfire.ath.cx</email>
</author>
<published>2009-07-01T22:01:43Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=8cfe5f1cd5dabc3a21bc792327747deefeff6dff'/>
<id>urn:sha1:8cfe5f1cd5dabc3a21bc792327747deefeff6dff</id>
<content type='text'>
xdiff_set_find_func() is used to set user defined regular expressions
for finding function signatures.  Add xdiff_clear_find_func(), which
frees the memory allocated by the former, making the API complete.

Also, use the new function in diff.c (the only call site of
xdiff_set_find_func()) to clean up after ourselves.

Signed-off-by: Rene Scharfe &lt;rene.scharfe@lsrfire.ath.cx&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>add xdi_diff_hunks() for callers that only need hunk lengths</title>
<updated>2008-10-25T19:09:31Z</updated>
<author>
<name>René Scharfe</name>
<email>rene.scharfe@lsrfire.ath.cx</email>
</author>
<published>2008-10-25T13:31:15Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=86295bb6bac1482d29650d1f77f19d8e7a7cc2fe'/>
<id>urn:sha1:86295bb6bac1482d29650d1f77f19d8e7a7cc2fe</id>
<content type='text'>
Based on a patch by Brian Downing, this uses the xdiff emit_func feature
to implement xdi_diff_hunks().  It's a function that calls a callback for
each hunk of a diff, passing its lengths.

Signed-off-by: Rene Scharfe &lt;rene.scharfe@lsrfire.ath.cx&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'bc/master-diff-hunk-header-fix'</title>
<updated>2008-09-29T18:04:20Z</updated>
<author>
<name>Shawn O. Pearce</name>
<email>spearce@spearce.org</email>
</author>
<published>2008-09-29T18:04:20Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=9800c0df412869c7949935b61581b9361fc49bd1'/>
<id>urn:sha1:9800c0df412869c7949935b61581b9361fc49bd1</id>
<content type='text'>
* bc/master-diff-hunk-header-fix:
  Clarify commit error message for unmerged files
  Use strchrnul() instead of strchr() plus manual workaround
  Use remove_path from dir.c instead of own implementation
  Add remove_path: a function to remove as much as possible of a path
  git-submodule: Fix "Unable to checkout" for the initial 'update'
  Clarify how the user can satisfy stash's 'dirty state' check.
  t4018-diff-funcname: test syntax of builtin xfuncname patterns
  t4018-diff-funcname: test syntax of builtin xfuncname patterns
  make "git remote" report multiple URLs
  diff hunk pattern: fix misconverted "\{" tex macro introducers
  diff: fix "multiple regexp" semantics to find hunk header comment
  diff: use extended regexp to find hunk headers
  diff: use extended regexp to find hunk headers
  diff.*.xfuncname which uses "extended" regex's for hunk header selection
  diff.c: associate a flag with each pattern and use it for compiling regex
  diff.c: return pattern entry pointer rather than just the hunk header pattern

Conflicts:
	builtin-merge-recursive.c
	t/t7201-co.sh
	xdiff-interface.h
</content>
</entry>
<entry>
<title>Merge branch 'jc/better-conflict-resolution'</title>
<updated>2008-09-29T17:15:07Z</updated>
<author>
<name>Shawn O. Pearce</name>
<email>spearce@spearce.org</email>
</author>
<published>2008-09-29T17:04:21Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=9ba929ed652f5ed7707f1c684999af4ad02c4925'/>
<id>urn:sha1:9ba929ed652f5ed7707f1c684999af4ad02c4925</id>
<content type='text'>
* jc/better-conflict-resolution:
  Fix AsciiDoc errors in merge documentation
  git-merge documentation: describe how conflict is presented
  checkout --conflict=&lt;style&gt;: recreate merge in a non-default style
  checkout -m: recreate merge when checking out of unmerged index
  git-merge-recursive: learn to honor merge.conflictstyle
  merge.conflictstyle: choose between "merge" and "diff3 -m" styles
  rerere: understand "diff3 -m" style conflicts with the original
  rerere.c: use symbolic constants to keep track of parsing states
  xmerge.c: "diff3 -m" style clips merge reduction level to EAGER or less
  xmerge.c: minimum readability fixups
  xdiff-merge: optionally show conflicts in "diff3 -m" style
  xdl_fill_merge_buffer(): separate out a too deeply nested function
  checkout --ours/--theirs: allow checking out one side of a conflicting merge
  checkout -f: allow ignoring unmerged paths when checking out of the index

Conflicts:
	Documentation/git-checkout.txt
	builtin-checkout.c
	builtin-merge-recursive.c
	t/t7201-co.sh
</content>
</entry>
<entry>
<title>Merge branch 'bc/maint-diff-hunk-header-fix' into bc/master-diff-hunk-header-fix</title>
<updated>2008-09-19T03:32:50Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2008-09-19T03:32:50Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=dde4af4313c6fba5269df384d97ef4fa3ab5971d'/>
<id>urn:sha1:dde4af4313c6fba5269df384d97ef4fa3ab5971d</id>
<content type='text'>
* bc/maint-diff-hunk-header-fix:
  diff.*.xfuncname which uses "extended" regex's for hunk header selection
  diff.c: associate a flag with each pattern and use it for compiling regex
  diff.c: return pattern entry pointer rather than just the hunk header pattern
  Cosmetical command name fix
  Start conforming code to "git subcmd" style part 3
  t9700/test.pl: remove File::Temp requirement
  t9700/test.pl: avoid bareword 'STDERR' in 3-argument open()
  GIT 1.6.0.2
  Fix some manual typos.
  Use compatibility regex library also on FreeBSD
  Use compatibility regex library also on AIX
  Update draft release notes for 1.6.0.2
  Use compatibility regex library for OSX/Darwin
  git-svn: Fixes my() parameter list syntax error in pre-5.8 Perl
  Git.pm: Use File::Temp-&gt;tempfile instead of -&gt;new
  t7501: always use test_cmp instead of diff
  Start conforming code to "git subcmd" style part 2
  diff: Help "less" hide ^M from the output
  checkout: do not check out unmerged higher stages randomly

Conflicts:
	Documentation/git.txt
	Documentation/gitattributes.txt
	Makefile
	diff.c
	t/t7201-co.sh
</content>
</entry>
</feed>
