From fc98edad6ef9917afc7d9e6af3e6162f2167a5ef Mon Sep 17 00:00:00 2001 From: James Farrell Date: Wed, 18 May 2022 14:08:45 +0000 Subject: [PATCH] Allow empty line format flags. --- tests/diff.test | 3 ++- toys/pending/diff.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/diff.test b/tests/diff.test index 1f56ae64..5903f144 100644 --- a/tests/diff.test +++ b/tests/diff.test @@ -42,6 +42,7 @@ testing "--strip-trailing-cr on" "diff -u --strip-trailing-cr a b" "" "" "" echo -e "1\n2" > aa echo -e "1\n3" > bb testing "line format" "diff --unchanged-line-format=U%l --old-line-format=D%l --new-line-format=A%l aa bb" "U1D2A3" "" "" +testing "line format empty" "diff --unchanged-line-format= --old-line-format=D%l --new-line-format=A%l aa bb" "D2A3" "" "" mkfifo fifo1 mkfifo fifo2 @@ -54,4 +55,4 @@ expected='--- fifo1 -2 +3 ' -testing "fifos" "diff -L fifo1 -L fifo2 fifo1 fifo2" "$expected" "" "" \ No newline at end of file +testing "fifos" "diff -L fifo1 -L fifo2 fifo1 fifo2" "$expected" "" "" diff --git a/toys/pending/diff.c b/toys/pending/diff.c index aee7253f..2f73bd8b 100644 --- a/toys/pending/diff.c +++ b/toys/pending/diff.c @@ -5,7 +5,7 @@ * * See: http://cm.bell-labs.com/cm/cs/cstr/41.pdf -USE_DIFF(NEWTOY(diff, "<2>2(unchanged-line-format):(old-line-format):(new-line-format):(color)(strip-trailing-cr)B(ignore-blank-lines)d(minimal)b(ignore-space-change)ut(expand-tabs)w(ignore-all-space)i(ignore-case)T(initial-tab)s(report-identical-files)q(brief)a(text)L(label)*S(starting-file):N(new-file)r(recursive)U(unified)#<0=3", TOYFLAG_USR|TOYFLAG_BIN|TOYFLAG_ARGFAIL(2))) +USE_DIFF(NEWTOY(diff, "<2>2(unchanged-line-format):;(old-line-format):;(new-line-format):;(color)(strip-trailing-cr)B(ignore-blank-lines)d(minimal)b(ignore-space-change)ut(expand-tabs)w(ignore-all-space)i(ignore-case)T(initial-tab)s(report-identical-files)q(brief)a(text)L(label)*S(starting-file):N(new-file)r(recursive)U(unified)#<0=3", TOYFLAG_USR|TOYFLAG_BIN|TOYFLAG_ARGFAIL(2))) config DIFF bool "diff" -- 2.39.2