All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/6] t4061: use POSIX compliance regex(7)
       [not found] <cover.1584838133.git.congdanhqx@gmail.com>
@ 2020-03-22  0:55 ` Đoàn Trần Công Danh
  2020-03-22  1:52   ` Danh Doan
  2020-03-22  0:55 ` [PATCH v2 3/6] t5003: skip conversion test if unzip -a is unavailable Đoàn Trần Công Danh
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 6+ messages in thread
From: Đoàn Trần Công Danh @ 2020-03-22  0:55 UTC (permalink / raw)
  To: git; +Cc: Đoàn Trần Công Danh

BRE interprets `+` literally, and
`\+` is undefined for POSIX BRE, from:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_03_02

> The interpretation of an ordinary character preceded
> by an unescaped <backslash> ( '\\' ) is undefined, except for:
> - The characters ')', '(', '{', and '}'
> - The digits 1 to 9 inclusive
> - A character inside a bracket expression

This test is failing with busybox sed, the default sed of Alpine Linux

Fix it by using literal `+` instead.

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
---
 t/t4061-diff-indent.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/t4061-diff-indent.sh b/t/t4061-diff-indent.sh
index 2affd7a100..0f7a6d97a8 100755
--- a/t/t4061-diff-indent.sh
+++ b/t/t4061-diff-indent.sh
@@ -17,7 +17,7 @@ compare_diff () {
 # Compare blame output using the expectation for a diff as reference.
 # Only look for the lines coming from non-boundary commits.
 compare_blame () {
-	sed -n -e "1,4d" -e "s/^\+//p" <"$1" >.tmp-1
+	sed -n -e "1,4d" -e "s/^+//p" <"$1" >.tmp-1
 	sed -ne "s/^[^^][^)]*) *//p" <"$2" >.tmp-2
 	test_cmp .tmp-1 .tmp-2 && rm -f .tmp-1 .tmp-2
 }
-- 
2.26.0.rc2.310.g2932bb562d


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 3/6] t5003: skip conversion test if unzip -a is unavailable
       [not found] <cover.1584838133.git.congdanhqx@gmail.com>
  2020-03-22  0:55 ` [PATCH v2 1/6] t4061: use POSIX compliance regex(7) Đoàn Trần Công Danh
@ 2020-03-22  0:55 ` Đoàn Trần Công Danh
  2020-03-22  0:55 ` [PATCH v2 4/6] t5616: use rev-parse instead to get HEAD's object_id Đoàn Trần Công Danh
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Đoàn Trần Công Danh @ 2020-03-22  0:55 UTC (permalink / raw)
  To: git; +Cc: Đoàn Trần Công Danh

Alpine Linux's default unzip(1) doesn't support `-a`.

Skip those tests on that platform.

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
---
 t/t5003-archive-zip.sh | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/t/t5003-archive-zip.sh b/t/t5003-archive-zip.sh
index 106eddbd85..78fb4bf323 100755
--- a/t/t5003-archive-zip.sh
+++ b/t/t5003-archive-zip.sh
@@ -15,6 +15,14 @@ test_lazy_prereq UNZIP_SYMLINKS '
 	)
 '
 
+test_lazy_prereq UNZIP_CONVERT '
+	(
+		mkdir unzip-convert &&
+		cd unzip-convert &&
+		"$GIT_UNZIP" -a "$TEST_DIRECTORY"/t5003/infozip-symlinks.zip
+	)
+'
+
 check_zip() {
 	zipfile=$1.zip
 	listfile=$1.lst
@@ -39,33 +47,33 @@ check_zip() {
 	extracted=${dir_with_prefix}a
 	original=a
 
-	test_expect_success UNZIP " extract ZIP archive with EOL conversion" '
+	test_expect_success UNZIP_CONVERT " extract ZIP archive with EOL conversion" '
 		(mkdir $dir && cd $dir && "$GIT_UNZIP" -a ../$zipfile)
 	'
 
-	test_expect_success UNZIP " validate that text files are converted" "
+	test_expect_success UNZIP_CONVERT " validate that text files are converted" "
 		test_cmp_bin $extracted/text.cr $extracted/text.crlf &&
 		test_cmp_bin $extracted/text.cr $extracted/text.lf
 	"
 
-	test_expect_success UNZIP " validate that binary files are unchanged" "
+	test_expect_success UNZIP_CONVERT " validate that binary files are unchanged" "
 		test_cmp_bin $original/binary.cr   $extracted/binary.cr &&
 		test_cmp_bin $original/binary.crlf $extracted/binary.crlf &&
 		test_cmp_bin $original/binary.lf   $extracted/binary.lf
 	"
 
-	test_expect_success UNZIP " validate that diff files are converted" "
+	test_expect_success UNZIP_CONVERT " validate that diff files are converted" "
 		test_cmp_bin $extracted/diff.cr $extracted/diff.crlf &&
 		test_cmp_bin $extracted/diff.cr $extracted/diff.lf
 	"
 
-	test_expect_success UNZIP " validate that -diff files are unchanged" "
+	test_expect_success UNZIP_CONVERT " validate that -diff files are unchanged" "
 		test_cmp_bin $original/nodiff.cr   $extracted/nodiff.cr &&
 		test_cmp_bin $original/nodiff.crlf $extracted/nodiff.crlf &&
 		test_cmp_bin $original/nodiff.lf   $extracted/nodiff.lf
 	"
 
-	test_expect_success UNZIP " validate that custom diff is unchanged " "
+	test_expect_success UNZIP_CONVERT " validate that custom diff is unchanged " "
 		test_cmp_bin $original/custom.cr   $extracted/custom.cr &&
 		test_cmp_bin $original/custom.crlf $extracted/custom.crlf &&
 		test_cmp_bin $original/custom.lf   $extracted/custom.lf
-- 
2.26.0.rc2.310.g2932bb562d


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 4/6] t5616: use rev-parse instead to get HEAD's object_id
       [not found] <cover.1584838133.git.congdanhqx@gmail.com>
  2020-03-22  0:55 ` [PATCH v2 1/6] t4061: use POSIX compliance regex(7) Đoàn Trần Công Danh
  2020-03-22  0:55 ` [PATCH v2 3/6] t5003: skip conversion test if unzip -a is unavailable Đoàn Trần Công Danh
@ 2020-03-22  0:55 ` Đoàn Trần Công Danh
  2020-03-22  0:55 ` [PATCH v2 5/6] t7063: use POSIX find(1) syntax Đoàn Trần Công Danh
  2020-03-22  0:55 ` [PATCH v2 6/6] t4124: fix test for non-compliance diff Đoàn Trần Công Danh
  4 siblings, 0 replies; 6+ messages in thread
From: Đoàn Trần Công Danh @ 2020-03-22  0:55 UTC (permalink / raw)
  To: git; +Cc: Đoàn Trần Công Danh

Only HEAD's object_id is necessary, rev-list is an overkill.

Despite POSIX requires grep(1) treat single pattern with <newline>
as multiple patterns.
busybox's grep(1) (as of v1.31.1) haven't implemented it yet.

Use rev-parse to simplify the test and avoid busybox unimplemented
features.

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
---
 t/t5616-partial-clone.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/t5616-partial-clone.sh b/t/t5616-partial-clone.sh
index 77bb91e976..135187c5b5 100755
--- a/t/t5616-partial-clone.sh
+++ b/t/t5616-partial-clone.sh
@@ -49,7 +49,7 @@ test_expect_success 'do partial clone 1' '
 test_expect_success 'verify that .promisor file contains refs fetched' '
 	ls pc1/.git/objects/pack/pack-*.promisor >promisorlist &&
 	test_line_count = 1 promisorlist &&
-	git -C srv.bare rev-list HEAD >headhash &&
+	git -C srv.bare rev-parse HEAD >headhash &&
 	grep "$(cat headhash) HEAD" $(cat promisorlist) &&
 	grep "$(cat headhash) refs/heads/master" $(cat promisorlist)
 '
-- 
2.26.0.rc2.310.g2932bb562d


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 5/6] t7063: use POSIX find(1) syntax
       [not found] <cover.1584838133.git.congdanhqx@gmail.com>
                   ` (2 preceding siblings ...)
  2020-03-22  0:55 ` [PATCH v2 4/6] t5616: use rev-parse instead to get HEAD's object_id Đoàn Trần Công Danh
@ 2020-03-22  0:55 ` Đoàn Trần Công Danh
  2020-03-22  0:55 ` [PATCH v2 6/6] t4124: fix test for non-compliance diff Đoàn Trần Công Danh
  4 siblings, 0 replies; 6+ messages in thread
From: Đoàn Trần Công Danh @ 2020-03-22  0:55 UTC (permalink / raw)
  To: git; +Cc: Đoàn Trần Công Danh

Since commit 6b7728db81, (t7063: work around FreeBSD's lazy mtime
update feature, 2016-08-03), we started to use ls as a trick to update
directory's mtime.

However, `-ls` flag isn't required by POSIX's find(1), and
busybox(1) doesn't implement it.

Use an equivalence `-exec ls -dils {} +` instead.

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
---
 t/t7063-status-untracked-cache.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/t7063-status-untracked-cache.sh b/t/t7063-status-untracked-cache.sh
index 190ae149cf..c2731d445a 100755
--- a/t/t7063-status-untracked-cache.sh
+++ b/t/t7063-status-untracked-cache.sh
@@ -18,7 +18,7 @@ GIT_FORCE_UNTRACKED_CACHE=true
 export GIT_FORCE_UNTRACKED_CACHE
 
 sync_mtime () {
-	find . -type d -ls >/dev/null
+	find . -type d -exec ls -dils {} + >/dev/null
 }
 
 avoid_racy() {
-- 
2.26.0.rc2.310.g2932bb562d


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 6/6] t4124: fix test for non-compliance diff
       [not found] <cover.1584838133.git.congdanhqx@gmail.com>
                   ` (3 preceding siblings ...)
  2020-03-22  0:55 ` [PATCH v2 5/6] t7063: use POSIX find(1) syntax Đoàn Trần Công Danh
@ 2020-03-22  0:55 ` Đoàn Trần Công Danh
  4 siblings, 0 replies; 6+ messages in thread
From: Đoàn Trần Công Danh @ 2020-03-22  0:55 UTC (permalink / raw)
  To: git; +Cc: Đoàn Trần Công Danh

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

POSIX requires no option for normal-diff format.

A hint in test-lib-functions::test_cmp said `diff -u` isn't available
everywhere.

Workaround this problem by assuming `diff(1)` output is unified
if we couldn't make anything from normal-diff format.

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
---
 t/t4124-apply-ws-rule.sh | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/t/t4124-apply-ws-rule.sh b/t/t4124-apply-ws-rule.sh
index 971a5a7512..2a54ce96b5 100755
--- a/t/t4124-apply-ws-rule.sh
+++ b/t/t4124-apply-ws-rule.sh
@@ -52,6 +52,12 @@ test_fix () {
 
 	# find touched lines
 	$DIFF file target | sed -n -e "s/^> //p" >fixed
+	if ! test -s fixed; then
+		$DIFF file target |
+		grep '^+' |
+		grep -v '^+++' |
+		sed -e "s/+//" >fixed
+	fi
 
 	# the changed lines are all expected to change
 	fixed_cnt=$(wc -l <fixed)
-- 
2.26.0.rc2.310.g2932bb562d


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/6] t4061: use POSIX compliance regex(7)
  2020-03-22  0:55 ` [PATCH v2 1/6] t4061: use POSIX compliance regex(7) Đoàn Trần Công Danh
@ 2020-03-22  1:52   ` Danh Doan
  0 siblings, 0 replies; 6+ messages in thread
From: Danh Doan @ 2020-03-22  1:52 UTC (permalink / raw)
  To: git

On 2020-03-22 07:55:10+0700, Đoàn Trần Công Danh <congdanhqx@gmail.com> wrote:
> BRE interprets `+` literally, and
> `\+` is undefined for POSIX BRE, from:
> https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_03_02
> 
> > The interpretation of an ordinary character preceded
> > by an unescaped <backslash> ( '\\' ) is undefined, except for:
> > - The characters ')', '(', '{', and '}'
> > - The digits 1 to 9 inclusive
> > - A character inside a bracket expression
> 
> This test is failing with busybox sed, the default sed of Alpine Linux
> 
> Fix it by using literal `+` instead.
> 
> Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>

Due to error in my part, please ignore the v2 with 6 patches.
It's the same with v1.

Please look into v2 with 8 patches instead.

Sorry for the noise.

-- 
Danh

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-03-22  1:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <cover.1584838133.git.congdanhqx@gmail.com>
2020-03-22  0:55 ` [PATCH v2 1/6] t4061: use POSIX compliance regex(7) Đoàn Trần Công Danh
2020-03-22  1:52   ` Danh Doan
2020-03-22  0:55 ` [PATCH v2 3/6] t5003: skip conversion test if unzip -a is unavailable Đoàn Trần Công Danh
2020-03-22  0:55 ` [PATCH v2 4/6] t5616: use rev-parse instead to get HEAD's object_id Đoàn Trần Công Danh
2020-03-22  0:55 ` [PATCH v2 5/6] t7063: use POSIX find(1) syntax Đoàn Trần Công Danh
2020-03-22  0:55 ` [PATCH v2 6/6] t4124: fix test for non-compliance diff Đoàn Trần Công Danh

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.