<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/diff-no-index.c, branch v2.7.3</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.7.3</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.7.3'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2016-02-05T22:54:15Z</updated>
<entry>
<title>Merge branch 'nd/diff-with-path-params' into maint</title>
<updated>2016-02-05T22:54:15Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-02-05T22:54:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=02dab5d399fb276f91646d7780da90596bffefab'/>
<id>urn:sha1:02dab5d399fb276f91646d7780da90596bffefab</id>
<content type='text'>
A few options of "git diff" did not work well when the command was
run from a subdirectory.

* nd/diff-with-path-params:
  diff: make -O and --output work in subdirectory
  diff-no-index: do not take a redundant prefix argument
</content>
</entry>
<entry>
<title>diff: make -O and --output work in subdirectory</title>
<updated>2016-01-21T18:45:13Z</updated>
<author>
<name>Duy Nguyen</name>
<email>pclouds@gmail.com</email>
</author>
<published>2016-01-21T11:48:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a97262c62f1a31fcc7edf7629d313058bc7d66b5'/>
<id>urn:sha1:a97262c62f1a31fcc7edf7629d313058bc7d66b5</id>
<content type='text'>
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>diff-no-index: do not take a redundant prefix argument</title>
<updated>2016-01-21T18:45:11Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2016-01-20T11:06:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e5f7a5d16f2c890e7dda96e5681ee8f6687b45e4'/>
<id>urn:sha1:e5f7a5d16f2c890e7dda96e5681ee8f6687b45e4</id>
<content type='text'>
Prefix is already set up in "revs". The same prefix should be used for
all options parsing. So kill the last argument. This patch does not
actually change anything because the only caller does use the same
prefix for init_revisions() and diff_no_index().

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>use strbuf_complete to conditionally append slash</title>
<updated>2015-10-05T18:08:06Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-09-24T21:08:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=00b6c178c3ab475098f7a0bc63b2df2da508020c'/>
<id>urn:sha1:00b6c178c3ab475098f7a0bc63b2df2da508020c</id>
<content type='text'>
When working with paths in strbufs, we frequently want to
ensure that a directory contains a trailing slash before
appending to it. We can shorten this code (and make the
intent more obvious) by calling strbuf_complete.

Most of these cases are trivially identical conversions, but
there are two things to note:

  - in a few cases we did not check that the strbuf is
    non-empty (which would lead to an out-of-bounds memory
    access). These were generally not triggerable in
    practice, either from earlier assertions, or typically
    because we would have just fed the strbuf to opendir(),
    which would choke on an empty path.

  - in a few cases we indexed the buffer with "original_len"
    or similar, rather than the current sb-&gt;len, and it is
    not immediately obvious from the diff that they are the
    same. In all of these cases, I manually verified that
    the strbuf does not change between the assignment and
    the strbuf_complete call.

This does not convert cases which look like:

  if (sb-&gt;len &amp;&amp; !is_dir_sep(sb-&gt;buf[sb-&gt;len - 1]))
	  strbuf_addch(sb, '/');

as those are obviously semantically different. Some of these
cases arguably should be doing that, but that is out of
scope for this change, which aims purely for cleanup with no
behavior change (and at least it will make such sites easier
to find and examine in the future, as we can grep for
strbuf_complete).

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-no-index: align D/F handling with that of normal Git</title>
<updated>2015-03-26T21:08:43Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-03-22T05:11:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=06151739988601b0fe6179c6c67a0031b85b536f'/>
<id>urn:sha1:06151739988601b0fe6179c6c67a0031b85b536f</id>
<content type='text'>
When a commit changes a path P that used to be a file to a directory
and creates a new path P/X in it, "git show" would say that file P
was removed and file P/X was created for such a commit.

However, if we compare two directories, D1 and D2, where D1 has a
file D1/P in it and D2 has a directory D2/P under which there is a
file D2/P/X, and ask "git diff --no-index D1 D2" to show their
differences, we simply get a refusal "file/directory conflict".

Surely, that may be what GNU diff does, but we can do better and it
is easy to do so.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>diff-no-index: DWIM "diff D F" into "diff D/F F"</title>
<updated>2015-03-26T05:39:07Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-03-25T23:11:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c9e1f2c7f2acca17c629255b96761a4a1047a28a'/>
<id>urn:sha1:c9e1f2c7f2acca17c629255b96761a4a1047a28a</id>
<content type='text'>
"git diff --no-index" was supposed to be a poor-man's approach to
allow using Git diff goodies outside of a Git repository, without
having to patch mainstream diff implementations.

Unlike a POSIX diff that treats "diff D F" (or "diff F D") as a
request to compare D/F and F (or F and D/F) when D is a directory
and F is a file, however, we did not accept such a command line and
instead barfed with "file/directory conflict".

Imitate what POSIX diff does and append the basename of the file
after the name of the directory before comparing.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jc/fix-diff-no-index-diff-opt-parse'</title>
<updated>2014-04-03T19:38:42Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-04-03T19:38:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7b6bc4d8350029fed82824a33ea9039f22788eec'/>
<id>urn:sha1:7b6bc4d8350029fed82824a33ea9039f22788eec</id>
<content type='text'>
"diff --no-index -Mq a b" fell into an infinite loop.

* jc/fix-diff-no-index-diff-opt-parse:
  diff-no-index: correctly diagnose error return from diff_opt_parse()
</content>
</entry>
<entry>
<title>diff-no-index: correctly diagnose error return from diff_opt_parse()</title>
<updated>2014-03-31T18:48:26Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-03-31T18:47:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ad1c3fbd26d0aae50abfb3c7d654f7229ba9370d'/>
<id>urn:sha1:ad1c3fbd26d0aae50abfb3c7d654f7229ba9370d</id>
<content type='text'>
diff_opt_parse() returns the number of options parsed, or often
returns error() which is defined to return -1.  Yes, return value of
0 is "I did not process that option at all", which should cause the
caller to say that, but negative return should not be forgotten.

This bug caused "diff --no-index" to infinitely show the same error
message because the returned value was used to decrement the loop
control variable, e.g.

        $ git diff --no-index --color=words a b
        error: option `color' expects "always", "auto", or "never"
        error: option `color' expects "always", "auto", or "never"
        ...

Instead, make it act like so:

        $ git diff --no-index --color=words a b
        error: option `color' expects "always", "auto", or "never"
        fatal: invalid diff option/value: --color=words

Reported-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'bb/diff-no-index-dotdot'</title>
<updated>2014-03-25T18:08:31Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-03-25T18:08:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=37943cc6b9a24c1636472f670aba972d12757ba7'/>
<id>urn:sha1:37943cc6b9a24c1636472f670aba972d12757ba7</id>
<content type='text'>
* bb/diff-no-index-dotdot:
  diff-no-index: replace manual "."/".." check with is_dot_or_dotdot()
  diff-no-index: rename read_directory()
</content>
</entry>
<entry>
<title>diff-no-index: replace manual "."/".." check with is_dot_or_dotdot()</title>
<updated>2014-03-19T18:49:39Z</updated>
<author>
<name>Brian Bourn</name>
<email>ba.bourn@gmail.com</email>
</author>
<published>2014-03-19T15:58:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=fd3aeeab0d41474af86e41d207196abbb7bf78f6'/>
<id>urn:sha1:fd3aeeab0d41474af86e41d207196abbb7bf78f6</id>
<content type='text'>
Helped-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Brian Bourn &lt;ba.bourn@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
