All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Grimm <koreth@midwinter.com>
To: git@vger.kernel.org
Subject: [PATCH] Test case for "git diff" outside a git repo
Date: Mon, 23 Jul 2007 06:22:48 -0700	[thread overview]
Message-ID: <20070723132248.GA24122@midwinter.com> (raw)

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.

 t/t4021-diff-norepo.sh |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)
 create mode 100755 t/t4021-diff-norepo.sh

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
+
+test_expect_success setup '
+
+	echo content1 >file1a &&
+	echo content1 >file1b &&
+	echo content2 >file2
+'
+
+test_expect_success 'zero return value with --quiet for different files' '
+
+	git diff --quiet file1a file2
+'
+
+test_expect_success 'nonzero return value with --quiet for identical files' '
+
+	! git diff --quiet file1a file1b >/dev/null
+'
+
+test_done
-- 
1.5.3.rc2.4.g726f9

             reply	other threads:[~2007-07-23 13:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-23 13:22 Steven Grimm [this message]
2007-07-24  6:14 ` [PATCH] Test case for "git diff" outside a git repo Junio C Hamano
2007-07-24  9:24   ` Johannes Schindelin

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=20070723132248.GA24122@midwinter.com \
    --to=koreth@midwinter.com \
    --cc=git@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.