Odd git diff breakage

2014-03-31 Thread Linus Torvalds
I hit this oddity when not remembering the right syntax for --color-words..

Try this (outside of a git repository):

   touch a b
   git diff -u --color=words a b

and watch it scroll (infinitely) printing out

   error: option `color' expects always, auto, or never

forever.

I haven't tried to root-cause it, since I'm supposed to be merging stuff..

Linus
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Odd git diff breakage

2014-03-31 Thread Junio C Hamano
Linus Torvalds torva...@linux-foundation.org writes:

 I hit this oddity when not remembering the right syntax for --color-words..

 Try this (outside of a git repository):

touch a b
git diff -u --color=words a b

 and watch it scroll (infinitely) printing out

error: option `color' expects always, auto, or never

 forever.

 I haven't tried to root-cause it, since I'm supposed to be merging stuff..

 Linus

Hmph, interesting.  outside a repository is the key, it seems.
And I can see it all the way down to 1.7.3 (at least).

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Odd git diff breakage

2014-03-31 Thread Linus Torvalds
On Mon, Mar 31, 2014 at 11:30 AM, Junio C Hamano gits...@pobox.com wrote:

 Hmph, interesting.  outside a repository is the key, it seems.

Well, you can do it inside a repository too, but then you need to use
the --no-index flag to get the diff two files behavior. It will
result in the same infinite error messages.

  Linus
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Odd git diff breakage

2014-03-31 Thread Junio C Hamano
Junio C Hamano gits...@pobox.com writes:

 Linus Torvalds torva...@linux-foundation.org writes:

 I hit this oddity when not remembering the right syntax for --color-words..

 Try this (outside of a git repository):

touch a b
git diff -u --color=words a b

 and watch it scroll (infinitely) printing out

error: option `color' expects always, auto, or never

 forever.

 I haven't tried to root-cause it, since I'm supposed to be merging stuff..

 Linus

 Hmph, interesting.  outside a repository is the key, it seems.
 And I can see it all the way down to 1.7.3 (at least).

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 don't understand that option, which should cause the
caller to say that, but negative return should not be forgotten.



 diff-no-index.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/diff-no-index.c b/diff-no-index.c
index c554691..265709b 100644
--- a/diff-no-index.c
+++ b/diff-no-index.c
@@ -198,7 +198,7 @@ void diff_no_index(struct rev_info *revs,
i++;
else {
j = diff_opt_parse(revs-diffopt, argv + i, argc - i);
-   if (!j)
+   if (j = 0)
die(invalid diff option/value: %s, argv[i]);
i += j;
}
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html