Git Mailing List Archive on
 help / color / Atom feed
From: "Đoàn Trần Công Danh" <>
Cc: "Đoàn Trần Công Danh" <>
Subject: [PATCH v3 7/8] t4124: fix test for non-compliant diff(1)
Date: Wed, 25 Mar 2020 22:06:20 +0700
Message-ID: <> (raw)
In-Reply-To: <>

POSIX's diff(1) requires output in normal diff format.
However, busybox's diff's output is written in unified format.

HP-UX's diff(1) doesn't understand "-u" as of now.

Workaround this problem by checking "diff -u" output,
if we couldn't make anything from normal-diff format.

Signed-off-by: Đoàn Trần Công Danh <>
 t/ | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/t/ b/t/
index 971a5a7512..691f82da9f 100755
--- a/t/
+++ b/t/
@@ -52,6 +52,12 @@ test_fix () {
 	# find touched lines
 	$DIFF file target | sed -n -e "s/^> //p" >fixed
+	# busybox's diff(1) doesn't output normal format
+	if ! test -s fixed; then
+		$DIFF -u file target |
+		grep -v '^+++ target' |
+		sed -e "/^+/s/+//" >fixed
+	fi
 	# the changed lines are all expected to change
 	fixed_cnt=$(wc -l <fixed)

  parent reply index

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-25 15:06 [PATCH v3 0/8] fix test failure with busybox Đoàn Trần Công Danh
2020-03-25 15:06 ` [PATCH v3 1/8] t4061: use POSIX compliant regex(7) Đoàn Trần Công Danh
2020-03-25 15:06 ` [PATCH v3 2/8] test-lib-functions: test_cmp: eval $GIT_TEST_CMP Đoàn Trần Công Danh
2020-03-25 15:06 ` [PATCH v3 3/8] t5003: drop the subshell in test_lazy_prereq Đoàn Trần Công Danh
2020-03-25 15:06 ` [PATCH v3 4/8] t5003: skip conversion test if unzip -a is unavailable Đoàn Trần Công Danh
2020-03-25 15:06 ` [PATCH v3 5/8] t5616: use rev-parse instead to get HEAD's object_id Đoàn Trần Công Danh
2020-03-25 15:06 ` [PATCH v3 6/8] t7063: drop non-POSIX argument "-ls" from find(1) Đoàn Trần Công Danh
2020-03-25 15:06 ` Đoàn Trần Công Danh [this message]
2020-03-25 15:06 ` [PATCH v3 8/8] t5703: feed raw data into test-tool unpack-sideband Đoàn Trần Công Danh

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Mailing List Archive on

Archives are clonable:
	git clone --mirror git/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 git git/ \
	public-inbox-index git

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone