From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Cc: christian.couder@gmail.com, peff@peff.net, jacob.e.keller@intel.com
Subject: [PATCH v2 6/7] t4045: reindent to make helpers readable
Date: Thu, 7 Dec 2017 09:30:33 -0800 [thread overview]
Message-ID: <20171207173034.12865-3-gitster@pobox.com> (raw)
In-Reply-To: <20171207173034.12865-1-gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
t/t4045-diff-relative.sh | 95 +++++++++++++++++++++++++-----------------------
1 file changed, 50 insertions(+), 45 deletions(-)
diff --git a/t/t4045-diff-relative.sh b/t/t4045-diff-relative.sh
index 3950f5034d..fefd2f3f81 100755
--- a/t/t4045-diff-relative.sh
+++ b/t/t4045-diff-relative.sh
@@ -12,59 +12,64 @@ test_expect_success 'setup' '
git commit -m one
'
-check_diff() {
-expect=$1; shift
-cat >expected <<EOF
-diff --git a/$expect b/$expect
-new file mode 100644
-index 0000000..25c05ef
---- /dev/null
-+++ b/$expect
-@@ -0,0 +1 @@
-+other content
-EOF
-test_expect_success "-p $*" "
- git diff -p $* HEAD^ >actual &&
- test_cmp expected actual
-"
+check_diff () {
+ expect=$1
+ shift
+ cat >expected <<-EOF
+ diff --git a/$expect b/$expect
+ new file mode 100644
+ index 0000000..25c05ef
+ --- /dev/null
+ +++ b/$expect
+ @@ -0,0 +1 @@
+ +other content
+ EOF
+ test_expect_success "-p $*" "
+ git diff -p $* HEAD^ >actual &&
+ test_cmp expected actual
+ "
}
-check_numstat() {
-expect=$1; shift
-cat >expected <<EOF
-1 0 $expect
-EOF
-test_expect_success "--numstat $*" "
- echo '1 0 $expect' >expected &&
- git diff --numstat $* HEAD^ >actual &&
- test_cmp expected actual
-"
+check_numstat () {
+ expect=$1
+ shift
+ cat >expected <<-EOF
+ 1 0 $expect
+ EOF
+ test_expect_success "--numstat $*" "
+ echo '1 0 $expect' >expected &&
+ git diff --numstat $* HEAD^ >actual &&
+ test_cmp expected actual
+ "
}
-check_stat() {
-expect=$1; shift
-cat >expected <<EOF
- $expect | 1 +
- 1 file changed, 1 insertion(+)
-EOF
-test_expect_success "--stat $*" "
- git diff --stat $* HEAD^ >actual &&
- test_i18ncmp expected actual
-"
+check_stat () {
+ expect=$1
+ shift
+ cat >expected <<-EOF
+ $expect | 1 +
+ 1 file changed, 1 insertion(+)
+ EOF
+ test_expect_success "--stat $*" "
+ git diff --stat $* HEAD^ >actual &&
+ test_i18ncmp expected actual
+ "
}
-check_raw() {
-expect=$1; shift
-cat >expected <<EOF
-:000000 100644 0000000000000000000000000000000000000000 25c05ef3639d2d270e7fe765a67668f098092bc5 A $expect
-EOF
-test_expect_success "--raw $*" "
- git diff --no-abbrev --raw $* HEAD^ >actual &&
- test_cmp expected actual
-"
+check_raw () {
+ expect=$1
+ shift
+ cat >expected <<-EOF
+ :000000 100644 0000000000000000000000000000000000000000 25c05ef3639d2d270e7fe765a67668f098092bc5 A $expect
+ EOF
+ test_expect_success "--raw $*" "
+ git diff --no-abbrev --raw $* HEAD^ >actual &&
+ test_cmp expected actual
+ "
}
-for type in diff numstat stat raw; do
+for type in diff numstat stat raw
+do
check_$type file2 --relative=subdir/
check_$type file2 --relative=subdir
check_$type dir/file2 --relative=sub
--
2.15.1-480-gbc5668f98a
next prev parent reply other threads:[~2017-12-07 17:30 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-07 0:35 [PATCH] diff: add test showing regression to --relative Jacob Keller
2017-12-07 1:04 ` Jeff King
2017-12-07 1:21 ` Jacob Keller
2017-12-07 17:30 ` [PATCH v2 0/7] reroll of cc/skip-to-optional-val Junio C Hamano
2017-12-07 17:30 ` [PATCH v2 5/7] diff: use skip-to-optional-val in parsing --relative Junio C Hamano
2017-12-07 19:03 ` Jacob Keller
2017-12-07 21:11 ` Jeff King
2017-12-07 21:59 ` Junio C Hamano
2017-12-07 22:21 ` Jeff King
2017-12-07 22:31 ` Junio C Hamano
2017-12-08 9:05 ` Jeff King
2017-12-08 21:09 ` Junio C Hamano
2017-12-07 17:30 ` Junio C Hamano [this message]
2017-12-07 17:30 ` [PATCH v2 7/7] t4045: test 'diff --relative' for real Junio C Hamano
2017-12-07 19:06 ` Jacob Keller
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=20171207173034.12865-3-gitster@pobox.com \
--to=gitster@pobox.com \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--cc=jacob.e.keller@intel.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 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.