From: Keith Cascio <keith@cs.ucla.edu>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jeff King <peff@peff.net>,
Johannes Schindelin <Johannes.Schindelin@gmx.de>,
git@vger.kernel.org
Subject: [PATCH v1 2/3] Test functionality of new config variable "diff.primer"
Date: Sun, 25 Jan 2009 09:30:56 -0800 [thread overview]
Message-ID: <1232904657-31831-3-git-send-email-keith@cs.ucla.edu> (raw)
In-Reply-To: <1232904657-31831-2-git-send-email-keith@cs.ucla.edu>
Test functionality of new config variable "diff.primer"
Signed-off-by: Keith Cascio <keith@cs.ucla.edu>
---
t/t4033-diff-primer.sh | 111 ++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 111 insertions(+), 0 deletions(-)
create mode 100755 t/t4033-diff-primer.sh
diff --git a/t/t4033-diff-primer.sh b/t/t4033-diff-primer.sh
new file mode 100755
index 0000000..116d6ad
--- /dev/null
+++ b/t/t4033-diff-primer.sh
@@ -0,0 +1,111 @@
+#!/bin/sh
+#
+# Copyright (c) 2009 Keith G. Cascio
+#
+# based on t4015-diff-whitespace.sh by Johannes E. Schindelin
+#
+
+test_description='Ensure diff engine honors config variable "diff.primer".
+
+'
+. ./test-lib.sh
+. "$TEST_DIRECTORY"/diff-lib.sh
+
+tr 'Q' '\015' << EOF > x
+whitespace at beginning
+whitespace change
+whitespace in the middle
+whitespace at end
+unchanged line
+CR at endQ
+EOF
+
+git add x
+git commit -m '1.0' >/dev/null 2>&1
+
+tr '_' ' ' << EOF > x
+ whitespace at beginning
+whitespace change
+white space in the middle
+whitespace at end__
+unchanged line
+CR at end
+EOF
+
+test_expect_success 'ensure diff.primer begins with empty value' '
+[ -z $(git config --get diff.primer) ]
+'
+
+tr 'Q_' '\015 ' << EOF > expect
+diff --git a/x b/x
+index d99af23..8b32fb5 100644
+--- a/x
++++ b/x
+@@ -1,6 +1,6 @@
+-whitespace at beginning
+-whitespace change
+-whitespace in the middle
+-whitespace at end
++ whitespace at beginning
++whitespace change
++white space in the middle
++whitespace at end__
+ unchanged line
+-CR at endQ
++CR at end
+EOF
+git diff > out
+test_expect_success 'test diff with empty value of diff.primer' 'test_cmp expect out'
+
+git config diff.primer '-w'
+
+test_expect_success 'ensure diff.primer value set' '
+[ $(git config --get diff.primer) = "-w" ]
+'
+
+git diff --no-primer > out
+test_expect_success 'test git diff --no-primer' 'test_cmp expect out'
+
+cat << EOF > expect
+diff --git a/x b/x
+index d99af23..8b32fb5 100644
+EOF
+git diff > out
+test_expect_success 'test with diff.primer = -w' 'test_cmp expect out'
+
+git add x
+git commit -m 'whitespace changes' >/dev/null 2>&1
+
+git config diff.primer '-w --color'
+
+tr 'Q_' '\015 ' << EOF > expect
+Subject: [PATCH] whitespace changes
+
+---
+ x | 10 +++++-----
+ 1 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/x b/x
+index d99af23..8b32fb5 100644
+--- a/x
++++ b/x
+@@ -1,6 +1,6 @@
+-whitespace at beginning
+-whitespace change
+-whitespace in the middle
+-whitespace at end
++ whitespace at beginning
++whitespace change
++white space in the middle
++whitespace at end__
+ unchanged line
+-CR at endQ
++CR at end
+--_
+EOF
+
+git format-patch --stdout HEAD^..HEAD 2>&1 | sed -re '1,3d;$d' | sed -re '$d' > out
+test_expect_success 'ensure git format-patch not affected by diff.primer' 'test_cmp expect out'
+
+test_done
+
--
1.6.1
next prev parent reply other threads:[~2009-01-25 17:44 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-25 17:30 [PATCH v1 0/3] Introduce config variable "diff.primer" Keith Cascio
2009-01-25 17:30 ` [PATCH v1 1/3] " Keith Cascio
2009-01-25 17:30 ` Keith Cascio [this message]
2009-01-25 17:30 ` [PATCH v1 3/3] git-gui hooks for new " Keith Cascio
2009-01-25 18:22 ` Johannes Schindelin
2009-01-25 18:58 ` Keith Cascio
2009-01-25 18:17 ` [PATCH v1 1/3] Introduce " Johannes Schindelin
2009-01-25 18:44 ` Keith Cascio
2009-01-25 19:30 ` Johannes Schindelin
2009-01-25 20:14 ` Keith Cascio
2009-01-25 22:11 ` Jeff King
2009-01-25 22:58 ` Keith Cascio
2009-01-25 23:25 ` Jeff King
2009-01-25 20:34 ` Junio C Hamano
2009-01-26 2:30 ` Junio C Hamano
2009-01-26 2:37 ` Keith Cascio
2009-01-26 3:18 ` Jeff King
2009-01-26 3:38 ` Junio C Hamano
2009-01-26 2:40 ` Keith Cascio
2009-01-26 3:12 ` Jeff King
2009-01-26 3:42 ` Junio C Hamano
2009-01-26 3:45 ` Jeff King
2009-01-26 10:54 ` Johannes Schindelin
2009-01-26 11:06 ` Jeff King
2009-01-26 10:59 ` backwards compatibility, was " Johannes Schindelin
2009-01-26 11:16 ` Jeff King
2009-01-26 11:28 ` Johannes Schindelin
2009-01-26 11:59 ` Jeff King
2009-01-27 3:01 ` Keith Cascio
2009-01-26 15:29 ` Jay Soffian
2009-01-26 18:48 ` Jeff King
2009-01-26 19:49 ` Jay Soffian
2009-01-26 20:04 ` Junio C Hamano
2009-01-26 20:32 ` Jay Soffian
2009-01-26 20:35 ` Jeff King
2009-01-26 3:36 ` Junio C Hamano
2009-01-25 20:35 ` [PATCH v1 0/3] " Junio C Hamano
2009-01-25 20:41 ` Keith Cascio
2009-01-25 22:07 ` Jeff King
2009-01-27 1:47 ` Keith Cascio
2009-01-27 4:54 ` Jeff King
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=1232904657-31831-3-git-send-email-keith@cs.ucla.edu \
--to=keith@cs.ucla.edu \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
/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).