<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/libgit2.git/src/diff_output.c, branch v0.18.0</title>
<subtitle>github.com: libgit2/libgit2.git
</subtitle>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/libgit2.git/'/>
<entry>
<title>Tests and more fixes for submodule diffs</title>
<updated>2013-04-09T21:52:32+00:00</updated>
<author>
<name>Russell Belfer</name>
<email>rb@github.com</email>
</author>
<published>2013-04-09T21:52:32+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/libgit2.git/commit/?id=ad26434b3b8a5eafab8ec52b83aa99beaf48fb03'/>
<id>ad26434b3b8a5eafab8ec52b83aa99beaf48fb03</id>
<content type='text'>
This adds tests for diffs with submodules in them and (perhaps
unsurprisingly) requires further fixes to be made.  Specifically,
this fixes:

- when considering if a submodule is dirty in the workdir, it was
  being treated as dirty even if only the index was dirty.
- git_diff_patch_to_str (and git_diff_patch_print) were "printing"
  the headers for files (and submodules) that were unmodified or
  had no meaningful content.
- added comment to previous fix and removed unneeded parens.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This adds tests for diffs with submodules in them and (perhaps
unsurprisingly) requires further fixes to be made.  Specifically,
this fixes:

- when considering if a submodule is dirty in the workdir, it was
  being treated as dirty even if only the index was dirty.
- git_diff_patch_to_str (and git_diff_patch_print) were "printing"
  the headers for files (and submodules) that were unmodified or
  had no meaningful content.
- added comment to previous fix and removed unneeded parens.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix submodule dirty states not showing if submodules comes before files, or there are only dirty submodules but no changed files</title>
<updated>2013-04-09T17:51:35+00:00</updated>
<author>
<name>Linquize</name>
<email>linquize@yahoo.com.hk</email>
</author>
<published>2013-03-29T03:52:18+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/libgit2.git/commit/?id=94750e8af246b2adf7bd5766e7e0da5fcf928d24'/>
<id>94750e8af246b2adf7bd5766e7e0da5fcf928d24</id>
<content type='text'>
GIT_DIFF_PATCH_DIFFABLE was not set, so the diff content was not shown

When submodule is dirty, the hash may be the same, but the length is different because -dirty is appended

We can therefore compare the length or hash
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
GIT_DIFF_PATCH_DIFFABLE was not set, so the diff content was not shown

When submodule is dirty, the hash may be the same, but the length is different because -dirty is appended

We can therefore compare the length or hash
</pre>
</div>
</content>
</entry>
<entry>
<title>Move crlf conversion into buf_text</title>
<updated>2013-03-25T21:20:07+00:00</updated>
<author>
<name>Russell Belfer</name>
<email>rb@github.com</email>
</author>
<published>2013-03-25T21:20:07+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/libgit2.git/commit/?id=3658e81e3499f874dc9f323d4d9127df7e219e12'/>
<id>3658e81e3499f874dc9f323d4d9127df7e219e12</id>
<content type='text'>
This adds crlf/lf conversion functions into buf_text with more
efficient implementations that bypass the high level buffer
functions.  They attempt to minimize the number of reallocations
done and they directly write the buffer data as needed if they
know that there is enough memory allocated to memcpy data.

Tests are added for these new functions.  The crlf.c code is
updated to use the new functions.

Removed the include of buf_text.h from filter.h and just include
it more narrowly in the places that need it.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This adds crlf/lf conversion functions into buf_text with more
efficient implementations that bypass the high level buffer
functions.  They attempt to minimize the number of reallocations
done and they directly write the buffer data as needed if they
know that there is enough memory allocated to memcpy data.

Tests are added for these new functions.  The crlf.c code is
updated to use the new functions.

Removed the include of buf_text.h from filter.h and just include
it more narrowly in the places that need it.
</pre>
</div>
</content>
</entry>
<entry>
<title>Three submodule status bug fixes</title>
<updated>2013-03-19T00:24:13+00:00</updated>
<author>
<name>Russell Belfer</name>
<email>rb@github.com</email>
</author>
<published>2013-03-19T00:24:13+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/libgit2.git/commit/?id=65025cb8934a289460bc64f82c27027c68a85be6'/>
<id>65025cb8934a289460bc64f82c27027c68a85be6</id>
<content type='text'>
1. Fix sort order problem with submodules where "mod" was sorting
   after "mod-plus" because they were being sorted as "mod/" and
   "mod-plus/".  This involved pushing the "contains a .git entry"
   test significantly lower in the stack.
2. Reinstate behavior that a directory which contains a .git entry
   will be treated as a submodule during iteration even if it is
   not yet added to the .gitmodules.
3. Now that any directory containing .git is reported as submodule,
   we have to be more careful checking for GIT_EEXISTS when we
   do a submodule lookup, because that is the error code that is
   returned by git_submodule_lookup when you try to look up a
   directory containing .git that has no record in gitmodules or
   the index.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
1. Fix sort order problem with submodules where "mod" was sorting
   after "mod-plus" because they were being sorted as "mod/" and
   "mod-plus/".  This involved pushing the "contains a .git entry"
   test significantly lower in the stack.
2. Reinstate behavior that a directory which contains a .git entry
   will be treated as a submodule during iteration even if it is
   not yet added to the .gitmodules.
3. Now that any directory containing .git is reported as submodule,
   we have to be more careful checking for GIT_EEXISTS when we
   do a submodule lookup, because that is the error code that is
   returned by git_submodule_lookup when you try to look up a
   directory containing .git that has no record in gitmodules or
   the index.
</pre>
</div>
</content>
</entry>
<entry>
<title>Several warnings detected by static code analyzer fixed</title>
<updated>2013-03-17T23:30:26+00:00</updated>
<author>
<name>Arkadiy Shapkin</name>
<email>ashapkin@artec-group.com</email>
</author>
<published>2013-03-17T00:46:46+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/libgit2.git/commit/?id=10c06114cbb1c384b7de3cca6d6601ee750f5178'/>
<id>10c06114cbb1c384b7de3cca6d6601ee750f5178</id>
<content type='text'>
Implicit type conversion argument of function to size_t type
Suspicious sequence of types castings: size_t -&gt; int -&gt; size_t
Consider reviewing the expression of the 'A = B == C' kind. The expression is calculated as following: 'A = (B == C)'
Unsigned type is never &lt; 0
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Implicit type conversion argument of function to size_t type
Suspicious sequence of types castings: size_t -&gt; int -&gt; size_t
Consider reviewing the expression of the 'A = B == C' kind. The expression is calculated as following: 'A = (B == C)'
Unsigned type is never &lt; 0
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix valgrind issues (and mmap fallback for diff)</title>
<updated>2013-03-14T20:50:54+00:00</updated>
<author>
<name>Russell Belfer</name>
<email>rb@github.com</email>
</author>
<published>2013-03-14T20:50:54+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/libgit2.git/commit/?id=d85296ab9b9c4a01adb35d4d2438b72177aeabc4'/>
<id>d85296ab9b9c4a01adb35d4d2438b72177aeabc4</id>
<content type='text'>
This fixes a number of issues identified by valgrind - mostly
missed free calls.  Inside valgrind, mmap() may fail which causes
some of the diff tests to fail.  This adds a fallback code path
to diff_output.c:get_workdir_content() where is the mmap() fails
the code will now try to read the file data directly into allocated
memory (which is what it would do if the data needed to be filtered
anyhow).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This fixes a number of issues identified by valgrind - mostly
missed free calls.  Inside valgrind, mmap() may fail which causes
some of the diff tests to fail.  This adds a fallback code path
to diff_output.c:get_workdir_content() where is the mmap() fails
the code will now try to read the file data directly into allocated
memory (which is what it would do if the data needed to be filtered
anyhow).
</pre>
</div>
</content>
</entry>
<entry>
<title>diff: allow asking for diffs with no context</title>
<updated>2013-03-09T15:04:34+00:00</updated>
<author>
<name>Carlos Martín Nieto</name>
<email>cmn@dwim.me</email>
</author>
<published>2013-03-09T15:04:34+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/libgit2.git/commit/?id=1aa5318a9ec4f0ec16518d1102b29e5ba94a801a'/>
<id>1aa5318a9ec4f0ec16518d1102b29e5ba94a801a</id>
<content type='text'>
Previously, 0 meant default. This is problematic, as asking for 0
context lines is a valid thing to do.

Change GIT_DIFF_OPTIONS_INIT to default to three and stop treating 0
as a magic value. In case no options are provided, make sure the
options in the diff object default to 3.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously, 0 meant default. This is problematic, as asking for 0
context lines is a valid thing to do.

Change GIT_DIFF_OPTIONS_INIT to default to three and stop treating 0
as a magic value. In case no options are provided, make sure the
options in the diff object default to 3.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix a few leaks</title>
<updated>2013-03-03T23:21:56+00:00</updated>
<author>
<name>Carlos Martín Nieto</name>
<email>cmn@dwim.me</email>
</author>
<published>2013-03-03T23:21:56+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/libgit2.git/commit/?id=323bb88514347ebb7a1d760490384b305f4f4d92'/>
<id>323bb88514347ebb7a1d760490384b305f4f4d92</id>
<content type='text'>
`git_diff_get_patch()` would unconditionally load the patch object and
then simply leak it if the user hadn't requested it. Short-circuit
loading the object if the user doesn't want it.

The rest of the plugs are simply calling the free functions of objects
allocated during the tests.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
`git_diff_get_patch()` would unconditionally load the patch object and
then simply leak it if the user hadn't requested it. Short-circuit
loading the object if the user doesn't want it.

The rest of the plugs are simply calling the free functions of objects
allocated during the tests.
</pre>
</div>
</content>
</entry>
<entry>
<title>Initial integration of similarity metric to diff</title>
<updated>2013-02-21T20:40:33+00:00</updated>
<author>
<name>Russell Belfer</name>
<email>rb@github.com</email>
</author>
<published>2013-02-21T20:40:33+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/libgit2.git/commit/?id=960a04dd56d89e94b5092be19ba9704b2d292dba'/>
<id>960a04dd56d89e94b5092be19ba9704b2d292dba</id>
<content type='text'>
This is the initial integration of the similarity metric into
the `git_diff_find_similar()` code path.  The existing tests all
pass, but the new functionality isn't currently well tested.  The
integration does go through the pluggable metric interface, so it
should be possible to drop in an alternative to the internal
metric that libgit2 implements.

This comes along with a behavior change for an existing interface;
namely, passing two NULLs to git_diff_blobs (or passing NULLs to
git_diff_blob_to_buffer) will now call the file_cb parameter zero
times instead of one time.  I know it's strange that that change
is paired with this other change, but it emerged from some
initialization changes that I ended up making.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is the initial integration of the similarity metric into
the `git_diff_find_similar()` code path.  The existing tests all
pass, but the new functionality isn't currently well tested.  The
integration does go through the pluggable metric interface, so it
should be possible to drop in an alternative to the internal
metric that libgit2 implements.

This comes along with a behavior change for an existing interface;
namely, passing two NULLs to git_diff_blobs (or passing NULLs to
git_diff_blob_to_buffer) will now call the file_cb parameter zero
times instead of one time.  I know it's strange that that change
is paired with this other change, but it emerged from some
initialization changes that I ended up making.
</pre>
</div>
</content>
</entry>
<entry>
<title>Replace diff delta binary with flags</title>
<updated>2013-02-20T23:10:21+00:00</updated>
<author>
<name>Russell Belfer</name>
<email>rb@github.com</email>
</author>
<published>2013-02-08T18:06:47+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/libgit2.git/commit/?id=71a3d27ea686845811f04314d02798b4f1745046'/>
<id>71a3d27ea686845811f04314d02798b4f1745046</id>
<content type='text'>
Previously the git_diff_delta recorded if the delta was binary.
This replaces that (with no net change in structure size) with
a full set of flags.  The flag values that were already in use
for individual git_diff_file objects are reused for the delta
flags, too (along with renaming those flags to make it clear that
they are used more generally).

This (a) makes things somewhat more consistent (because I was
using a -1 value in the "boolean" binary field to indicate unset,
whereas now I can just use the flags that are easier to understand),
and (b) will make it easier for me to add some additional flags to
the delta object in the future, such as marking the results of a
copy/rename detection or other deltas that might want a special
indicator.

While making this change, I officially moved some of the flags that
were internal only into the private diff header.

This also allowed me to remove a gross hack in rename/copy detect
code where I was overwriting the status field with an internal
value.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously the git_diff_delta recorded if the delta was binary.
This replaces that (with no net change in structure size) with
a full set of flags.  The flag values that were already in use
for individual git_diff_file objects are reused for the delta
flags, too (along with renaming those flags to make it clear that
they are used more generally).

This (a) makes things somewhat more consistent (because I was
using a -1 value in the "boolean" binary field to indicate unset,
whereas now I can just use the flags that are easier to understand),
and (b) will make it easier for me to add some additional flags to
the delta object in the future, such as marking the results of a
copy/rename detection or other deltas that might want a special
indicator.

While making this change, I officially moved some of the flags that
were internal only into the private diff header.

This also allowed me to remove a gross hack in rename/copy detect
code where I was overwriting the status field with an internal
value.
</pre>
</div>
</content>
</entry>
</feed>
