git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Test case for "git diff" outside a git repo

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 24, 2007, 06:14 UTC
Message-ID
<7vy7h6ib0b.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20070723132248.GA24122@midwinter.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 13 quoted lines
> 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.

Show 13 quoted lines
>> 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.

Previous: Steven GrimmNext: Johannes Schindelin
Message 2 of 3 in “Test case for "git diff" outside a git repo”
  1. Test case for "git diff" outside a git repoSteven Grimm, Jul 23, 2007
  2. Junio C HamanoJul 24, 2007
  3. Johannes SchindelinJul 24, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.