From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: Steven Grimm <koreth@midwinter.com>, git@vger.kernel.org
Subject: Re: [PATCH] Test case for "git diff" outside a git repo
Date: Tue, 24 Jul 2007 10:24:45 +0100 (BST) [thread overview]
Message-ID: <Pine.LNX.4.64.0707241024350.14781@racer.site> (raw)
In-Reply-To: <7vy7h6ib0b.fsf@assigned-by-dhcp.cox.net>
Hi,
On Mon, 23 Jul 2007, Junio C Hamano wrote:
> Junio C Hamano <gitster@pobox.com> writes:
>
> > Steven Grimm <koreth@midwinter.com> writes:
> >
> >> Signed-off-by: Steven Grimm <koreth@midwinter.com>
> >> ---
> >> git-diff --quiet is pretty broken right now. If you do
> >> "strace git diff --quiet file1 file2" you will see that
> >> it never calls open() on either file! And it always
> >> returns a zero exit code whether or not the files are
> >> different.
> >>
> >> I'm trying to follow the code to figure out what's going on,
> >> but meanwhile, here's a test case. Perhaps someone more
> >> familiar with the diff code will beat me to a fix.
>
> The code to do "untracked diff" is an ugly stepchild and not really part
> of git-diff proper. In fact, --quiet also is an afterthought and I
> would not be too surprised if the "untracked diff" code does not work
> with it.
Not that ugly, mind you. Every third day or so I congratulate myself for
having "git diff --color-words" or "git diff -M", without having to suffer
initialising a git repository.
But yes, I agree, the --quiet code came after the --no-index code, and
thus it is well possible that the latter ignores the former.
> >> diff --git a/t/t4021-diff-norepo.sh b/t/t4021-diff-norepo.sh
> >> new file mode 100755
> >> index 0000000..dfee3d7
> >> --- /dev/null
> >> +++ b/t/t4021-diff-norepo.sh
> >> @@ -0,0 +1,26 @@
> >> +#!/bin/sh
> >> +
> >> +test_description='test git diff outside a repo'
> >> +
> >> +. ./test-lib.sh
> >> +
> >> +rm -rf .git
>
> Unless you are testing the t/ directory and git.git suite from a
> tarball, the only effect of this is to make t/trash controlled by its
> ../../.git repository (i.e. the git.git repository). You are still
> inside a git repository.
Yes, this is no good.
However, you can force --no-index. IMHO that is the way to go.
Ciao,
Dscho
prev parent reply other threads:[~2007-07-24 9:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-23 13:22 [PATCH] Test case for "git diff" outside a git repo Steven Grimm
2007-07-24 6:14 ` Junio C Hamano
2007-07-24 9:24 ` Johannes Schindelin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0707241024350.14781@racer.site \
--to=johannes.schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=koreth@midwinter.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).