<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/python-packages/gitpython.git/git/test/test_diff.py, branch 2.0.1</title>
<subtitle>github.com: gitpython-developers/GitPython.git
</subtitle>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/python-packages/gitpython.git/'/>
<entry>
<title>Python 3 compat fixes</title>
<updated>2016-04-19T22:12:55+00:00</updated>
<author>
<name>Vincent Driessen</name>
<email>me@nvie.com</email>
</author>
<published>2016-04-19T22:07:22+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/python-packages/gitpython.git/commit/?id=19099f9ce7e8d6cb1f5cafae318859be8c082ca2'/>
<id>19099f9ce7e8d6cb1f5cafae318859be8c082ca2</id>
<content type='text'>
Specifically "string_escape" does not exist as an encoding anymore.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Specifically "string_escape" does not exist as an encoding anymore.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix diff patch parser for paths with unsafe chars</title>
<updated>2016-04-19T21:46:54+00:00</updated>
<author>
<name>Vincent Driessen</name>
<email>me@nvie.com</email>
</author>
<published>2016-04-19T21:41:01+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/python-packages/gitpython.git/commit/?id=7fbc182e6d4636f67f44e5893dee3dcedfa90e04'/>
<id>7fbc182e6d4636f67f44e5893dee3dcedfa90e04</id>
<content type='text'>
This specifically covers the cases where unsafe chars occur in path
names, and git-diff -p will escape those.

From the git-diff-tree manpage:

&gt; 3. TAB, LF, double quote and backslash characters in pathnames are
&gt;    represented as \t, \n, \" and \\, respectively. If there is need
&gt;    for such substitution then the whole pathname is put in double
&gt;    quotes.

This patch checks whether or not this has happened and will unescape
those paths accordingly.

One thing to note here is that, depending on the position in the patch
format, those paths may be prefixed with an a/ or b/.  I've specifically
made sure to never interpret a path that actually starts with a/ or b/
incorrectly.

Example of that subtlety below.  Here, the actual file path is
"b/normal".  On the diff file that gets encoded as "b/b/normal".

     diff --git a/b/normal b/b/normal
     new file mode 100644
     index 0000000000000000000000000000000000000000..eaf5f7510320b6a327fb308379de2f94d8859a54
     --- /dev/null
     +++ b/b/normal
     @@ -0,0 +1 @@
     +dummy content

Here, we prefer the "---" and "+++" lines' values.  Note that these
paths start with a/ or b/.  The only exception is the value "/dev/null",
which is handled as a special case.

Suppose now the file gets moved "b/moved", the output of that diff would
then be this:

     diff --git a/b/normal b/b/moved
     similarity index 100%
     rename from b/normal
     rename to b/moved

We prefer the "rename" lines' values in this case (the "diff" line is
always a last resort).  Take note that those lines are not prefixed with
a/ or b/, but the ones in the "diff" line are (just like the ones in
"---" or "+++" lines).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This specifically covers the cases where unsafe chars occur in path
names, and git-diff -p will escape those.

From the git-diff-tree manpage:

&gt; 3. TAB, LF, double quote and backslash characters in pathnames are
&gt;    represented as \t, \n, \" and \\, respectively. If there is need
&gt;    for such substitution then the whole pathname is put in double
&gt;    quotes.

This patch checks whether or not this has happened and will unescape
those paths accordingly.

One thing to note here is that, depending on the position in the patch
format, those paths may be prefixed with an a/ or b/.  I've specifically
made sure to never interpret a path that actually starts with a/ or b/
incorrectly.

Example of that subtlety below.  Here, the actual file path is
"b/normal".  On the diff file that gets encoded as "b/b/normal".

     diff --git a/b/normal b/b/normal
     new file mode 100644
     index 0000000000000000000000000000000000000000..eaf5f7510320b6a327fb308379de2f94d8859a54
     --- /dev/null
     +++ b/b/normal
     @@ -0,0 +1 @@
     +dummy content

Here, we prefer the "---" and "+++" lines' values.  Note that these
paths start with a/ or b/.  The only exception is the value "/dev/null",
which is handled as a special case.

Suppose now the file gets moved "b/moved", the output of that diff would
then be this:

     diff --git a/b/normal b/b/moved
     similarity index 100%
     rename from b/normal
     rename to b/moved

We prefer the "rename" lines' values in this case (the "diff" line is
always a last resort).  Take note that those lines are not prefixed with
a/ or b/, but the ones in the "diff" line are (just like the ones in
"---" or "+++" lines).
</pre>
</div>
</content>
</entry>
<entry>
<title>Make test stricter</title>
<updated>2016-04-19T19:46:16+00:00</updated>
<author>
<name>Vincent Driessen</name>
<email>me@nvie.com</email>
</author>
<published>2016-04-15T00:18:12+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/python-packages/gitpython.git/commit/?id=2090b5487e69688be61cfbb97c346c452ab45ba2'/>
<id>2090b5487e69688be61cfbb97c346c452ab45ba2</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Make diff patch parsing more reliable</title>
<updated>2016-04-19T19:45:18+00:00</updated>
<author>
<name>Vincent Driessen</name>
<email>me@nvie.com</email>
</author>
<published>2016-04-14T19:27:39+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/python-packages/gitpython.git/commit/?id=e77128e5344ce7d84302facc08d17c3151037ec3'/>
<id>e77128e5344ce7d84302facc08d17c3151037ec3</id>
<content type='text'>
The a_path and b_path cannot reliably be read from the first diff line
as it's ambiguous.  From the git-diff manpage:

  &gt; The a/ and b/ filenames are the same unless rename/copy is involved.
  &gt; Especially, **even for a creation or a deletion**, /dev/null is not
  &gt; used in place of the a/ or b/ filenames.

This patch changes the a_path and b_path detection to read it from the
more reliable locations further down the diff headers.  Two use cases
are fixed by this:

  - As the man page snippet above states, for new/deleted files the a
    or b path will now be properly None.
  - File names with spaces in it are now properly parsed.

Working on this patch, I realized the --- and +++ lines really belong to
the diff header, not the diff contents.  This means that when parsing
the patch format, the --- and +++ will now be swallowed, and not end up
anymore as part of the diff contents.  The diff contents now always
start with an @@ line.

This may be a breaking change for some users that rely on this
behaviour.  However, those users could now access that information more
reliably via the normal Diff properties a_path and b_path now.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The a_path and b_path cannot reliably be read from the first diff line
as it's ambiguous.  From the git-diff manpage:

  &gt; The a/ and b/ filenames are the same unless rename/copy is involved.
  &gt; Especially, **even for a creation or a deletion**, /dev/null is not
  &gt; used in place of the a/ or b/ filenames.

This patch changes the a_path and b_path detection to read it from the
more reliable locations further down the diff headers.  Two use cases
are fixed by this:

  - As the man page snippet above states, for new/deleted files the a
    or b path will now be properly None.
  - File names with spaces in it are now properly parsed.

Working on this patch, I realized the --- and +++ lines really belong to
the diff header, not the diff contents.  This means that when parsing
the patch format, the --- and +++ will now be swallowed, and not end up
anymore as part of the diff contents.  The diff contents now always
start with an @@ line.

This may be a breaking change for some users that rely on this
behaviour.  However, those users could now access that information more
reliably via the normal Diff properties a_path and b_path now.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix test cases</title>
<updated>2016-04-14T13:56:13+00:00</updated>
<author>
<name>Vincent Driessen</name>
<email>me@nvie.com</email>
</author>
<published>2016-04-14T13:55:21+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/python-packages/gitpython.git/commit/?id=1875885485e7c78d34fd56b8db69d8b3f0df830c'/>
<id>1875885485e7c78d34fd56b8db69d8b3f0df830c</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Support "root" as a special value in .diff() calls</title>
<updated>2016-04-14T10:39:37+00:00</updated>
<author>
<name>Vincent Driessen</name>
<email>me@nvie.com</email>
</author>
<published>2016-04-12T13:55:01+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/python-packages/gitpython.git/commit/?id=5de21c7fa2bdd5cd50c4f62ba848af54589167d0'/>
<id>5de21c7fa2bdd5cd50c4f62ba848af54589167d0</id>
<content type='text'>
This enabled getting diff patches for root commits.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This enabled getting diff patches for root commits.
</pre>
</div>
</content>
</entry>
<entry>
<title>Add test and fixture for diff index from raw format</title>
<updated>2016-03-16T18:08:31+00:00</updated>
<author>
<name>Jonathan Chu</name>
<email>jonathan.chu@me.com</email>
</author>
<published>2016-03-16T18:08:31+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/python-packages/gitpython.git/commit/?id=e328ffddec722be3fba2c9b637378e31e623d58e'/>
<id>e328ffddec722be3fba2c9b637378e31e623d58e</id>
<content type='text'>
This tests the edge case of doing a diff against a single whitespace
filename and returns the proper change type.  All other normal usage of
this diff classmethod should remain unchanged.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This tests the edge case of doing a diff against a single whitespace
filename and returns the proper change type.  All other normal usage of
this diff classmethod should remain unchanged.
</pre>
</div>
</content>
</entry>
<entry>
<title>fix(diff): mode-assertions now deal with 0</title>
<updated>2015-07-29T13:14:41+00:00</updated>
<author>
<name>Sebastian Thiel</name>
<email>byronimo@gmail.com</email>
</author>
<published>2015-07-29T13:14:41+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/python-packages/gitpython.git/commit/?id=8324c4b38cf37af416833d36696577d8d35dce7f'/>
<id>8324c4b38cf37af416833d36696577d8d35dce7f</id>
<content type='text'>
If the file was not present, the mode seen in a diff can be legally '0',
which previously caused an assertion to fail for no good reason.
Now the assertion tests for None instead.

Closes #323
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If the file was not present, the mode seen in a diff can be legally '0',
which previously caused an assertion to fail for no good reason.
Now the assertion tests for None instead.

Closes #323
</pre>
</div>
</content>
</entry>
<entry>
<title>Added advance usage examples to tutorial and made minor fixes.</title>
<updated>2015-01-21T17:34:58+00:00</updated>
<author>
<name>Sebastian Thiel</name>
<email>byronimo@gmail.com</email>
</author>
<published>2015-01-21T17:34:58+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/python-packages/gitpython.git/commit/?id=e4d3809161fc54d6913c0c2c7f6a7b51eebe223f'/>
<id>e4d3809161fc54d6913c0c2c7f6a7b51eebe223f</id>
<content type='text'>
GIT_PYTHON_TRACE would actually fail (now) if we debugged archive operations.

Related to #239
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
GIT_PYTHON_TRACE would actually fail (now) if we debugged archive operations.

Related to #239
</pre>
</div>
</content>
</entry>
<entry>
<title>Now Diff.__str__ works correctly in all python versions.</title>
<updated>2015-01-09T16:16:35+00:00</updated>
<author>
<name>Sebastian Thiel</name>
<email>byronimo@gmail.com</email>
</author>
<published>2015-01-09T16:14:32+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/python-packages/gitpython.git/commit/?id=c767b5206f1e9c8536110dda4d515ebb9242bbeb'/>
<id>c767b5206f1e9c8536110dda4d515ebb9242bbeb</id>
<content type='text'>
Additionally, unicode handling was improved to the point where we deal
with all diff(create_path=True) data as binary.
Therefore we don't claim to know all encodings of all textfiles in the world,
even though we still assume that everything git throws at us is utf-8 encoded.

Fixes #113
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Additionally, unicode handling was improved to the point where we deal
with all diff(create_path=True) data as binary.
Therefore we don't claim to know all encodings of all textfiles in the world,
even though we still assume that everything git throws at us is utf-8 encoded.

Fixes #113
</pre>
</div>
</content>
</entry>
</feed>
