From: Keith Cascio <keith@cs.ucla.edu>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: [PATCH v2 2/2] Test functionality of new config variable "diff.primer"
Date: Mon, 2 Feb 2009 10:20:55 -0800 [thread overview]
Message-ID: <1233598855-1088-3-git-send-email-keith@cs.ucla.edu> (raw)
In-Reply-To: <1233598855-1088-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/t4035-diff-primer.sh | 129 ++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 129 insertions(+), 0 deletions(-)
create mode 100755 t/t4035-diff-primer.sh
diff --git a/t/t4035-diff-primer.sh b/t/t4035-diff-primer.sh
new file mode 100755
index 0000000..c33911c
--- /dev/null
+++ b/t/t4035-diff-primer.sh
@@ -0,0 +1,129 @@
+#!/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 born empty' '
+[ -z $(git config --get diff.primer) ]
+'
+
+tr 'Q_' '\015 ' << EOF > expect_noprimer
+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 git-diff with empty value of diff.primer' 'test_cmp expect_noprimer 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_noprimer out'
+git diff-files -p > out
+test_expect_success 'ensure diff-files unaffected by diff.primer' 'test_cmp expect_noprimer out'
+git diff-index -p HEAD > out
+test_expect_success 'ensure diff-index unaffected by diff.primer' 'test_cmp expect_noprimer out'
+
+cat << EOF > expect_primer
+diff --git a/x b/x
+index d99af23..8b32fb5 100644
+EOF
+git diff > out
+test_expect_success 'test git-diff with diff.primer = -w' 'test_cmp expect_primer out'
+git diff-files -p --primer > out
+test_expect_success 'ensure diff-files honors --primer' 'test_cmp expect_primer out'
+git diff-index -p --primer HEAD > out
+test_expect_success 'ensure diff-index honors --primer' 'test_cmp expect_primer 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 format-patch unaffected by diff.primer' 'test_cmp expect out'
+
+git add x
+git commit -m '2.0' >/dev/null 2>&1
+
+git config diff.primer '-w'
+
+git diff-tree -p -r HEAD^ HEAD > out
+test_expect_success 'ensure diff-tree unaffected by diff.primer' 'test_cmp expect_noprimer out'
+git diff-tree -p -r --primer HEAD^ HEAD > out
+test_expect_success 'ensure diff-tree honors --primer' 'test_cmp expect_primer out'
+
+test_done
+
--
1.6.1
next prev parent reply other threads:[~2009-02-02 18:58 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1233598855-1088-1-git-send-email-keith@cs.ucla.edu>
2009-02-02 18:20 ` [PATCH v2 1/2] Introduce config variable "diff.primer" Keith Cascio
2009-02-02 18:20 ` Keith Cascio [this message]
2009-02-02 20:45 ` [PATCH v2 0/2] " Keith Cascio
2009-02-02 21:03 ` Keith Cascio
2009-02-03 7:15 ` [PATCH v2 1/2] " Jeff King
2009-02-03 17:55 ` Keith Cascio
2009-02-04 5:43 ` Junio C Hamano
2009-02-04 6:36 ` Keith Cascio
2009-02-06 16:54 ` Jeff King
2009-02-06 16:19 ` Jeff King
2009-02-07 21:45 ` Junio C Hamano
2009-02-09 17:24 ` Keith Cascio
2009-02-13 22:22 ` Jeff King
2009-02-14 6:03 ` Johannes Schindelin
2009-02-14 6:15 ` Jeff King
2009-02-14 6:24 ` Johannes Schindelin
2009-02-14 15:17 ` Jeff King
2009-02-15 23:26 ` Keith Cascio
2009-02-15 23:39 ` Junio C Hamano
2009-02-17 7:24 ` diff.defaultOptions implementation design [was diff.primer] Keith Cascio
2009-02-17 19:56 ` Jeff King
2009-03-17 16:05 ` [PATCH v2 1/2] Introduce config variable "diff.defaultOptions" Keith Cascio
2009-03-20 7:01 ` Jeff King
2009-03-20 17:11 ` Keith Cascio
2009-03-20 19:49 ` Jeff King
2009-03-21 2:00 ` [PATCH/RFC v3] Introduce config variable "diff.defaultoptions" Keith Cascio
2009-03-21 3:15 ` [PATCH] Allow setting default diff options via diff.defaultOptions Johannes Schindelin
2009-04-03 0:04 ` Keith Cascio
2009-04-09 8:45 ` Johannes Schindelin
2009-04-09 8:49 ` Jeff King
2009-04-09 10:43 ` Johannes Schindelin
2009-04-10 8:01 ` Jeff King
2009-04-13 22:37 ` [PATCH] Add the diff option --no-defaults Johannes Schindelin
2009-04-16 8:34 ` Jeff King
2009-04-16 9:25 ` Johannes Schindelin
2009-04-16 9:41 ` Jeff King
2009-04-16 16:52 ` Junio C Hamano
2009-04-16 17:36 ` Johannes Schindelin
2009-04-17 11:54 ` Jeff King
2009-04-17 13:15 ` Johannes Schindelin
2009-04-18 16:41 ` Keith Cascio
2009-04-18 17:40 ` Johannes Schindelin
2009-04-18 20:32 ` Keith Cascio
2009-04-18 21:15 ` Johannes Schindelin
2009-04-09 16:29 ` [PATCH] Allow setting default diff options via diff.defaultOptions Keith Cascio
2009-04-09 0:44 ` Keith Cascio
2009-04-09 8:29 ` Johannes Schindelin
2009-04-09 8:31 ` Jeff King
2009-02-03 18:56 ` [PATCH v2 1/2] Introduce config variable "diff.primer" Jakub Narebski
2009-02-03 19:13 ` Keith Cascio
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=1233598855-1088-3-git-send-email-keith@cs.ucla.edu \
--to=keith@cs.ucla.edu \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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).