git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] t6036: avoid "cp -a"
@ 2018-12-01  2:52 Carlo Marcelo Arenas Belón
  2018-12-01  4:21 ` Elijah Newren
  0 siblings, 1 reply; 4+ messages in thread
From: Carlo Marcelo Arenas Belón @ 2018-12-01  2:52 UTC (permalink / raw)
  To: git; +Cc: newren

b8cd1bb713 ("t6036, t6043: increase code coverage for file collision handling", 2018-11-07) uses this GNU extension that is not available in a POSIX complaint
cp; use cp -R instead

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
to be applied on top of en/merge-path-collision for next

 t/t6036-recursive-corner-cases.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/t6036-recursive-corner-cases.sh b/t/t6036-recursive-corner-cases.sh
index b7488b00c0..fdb120d0dc 100755
--- a/t/t6036-recursive-corner-cases.sh
+++ b/t/t6036-recursive-corner-cases.sh
@@ -1631,7 +1631,7 @@ test_expect_success 'check nested conflicts' '
 
 		# Compare m to expected contents
 		>empty &&
-		cp -a m_stage_2 expected_final_m &&
+		cp -R m_stage_2 expected_final_m &&
 		test_must_fail git merge-file --diff3 \
 			-L "HEAD"                     \
 			-L "merged common ancestors"  \
-- 
2.20.0.rc1.6.ga1598010f


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

* Re: [PATCH] t6036: avoid "cp -a"
  2018-12-01  2:52 [PATCH] t6036: avoid "cp -a" Carlo Marcelo Arenas Belón
@ 2018-12-01  4:21 ` Elijah Newren
  2018-12-01 12:02   ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Elijah Newren @ 2018-12-01  4:21 UTC (permalink / raw)
  To: carenas; +Cc: Git Mailing List

Hi,

Thanks for the patch!

On Fri, Nov 30, 2018 at 6:52 PM Carlo Marcelo Arenas Belón
<carenas@gmail.com> wrote:
>
> b8cd1bb713 ("t6036, t6043: increase code coverage for file collision handling", 2018-11-07) uses this GNU extension that is not available in a POSIX complaint

This is an extraordinarily long line; can you rewrap at around 72 characters?

> cp; use cp -R instead
>
> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
> ---
> to be applied on top of en/merge-path-collision for next
>
>  t/t6036-recursive-corner-cases.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/t/t6036-recursive-corner-cases.sh b/t/t6036-recursive-corner-cases.sh
> index b7488b00c0..fdb120d0dc 100755
> --- a/t/t6036-recursive-corner-cases.sh
> +++ b/t/t6036-recursive-corner-cases.sh
> @@ -1631,7 +1631,7 @@ test_expect_success 'check nested conflicts' '
>
>                 # Compare m to expected contents
>                 >empty &&
> -               cp -a m_stage_2 expected_final_m &&
> +               cp -R m_stage_2 expected_final_m &&
>                 test_must_fail git merge-file --diff3 \
>                         -L "HEAD"                     \
>                         -L "merged common ancestors"  \
> --
> 2.20.0.rc1.6.ga1598010f

Oops.  Thanks for catching.  To be honest, we don't even need -a, -R,
etc. -- it was just a habit for me to add -a after cp.  A simple cp
would do, though what you have here is fine too.

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

* Re: [PATCH] t6036: avoid "cp -a"
  2018-12-01  4:21 ` Elijah Newren
@ 2018-12-01 12:02   ` Junio C Hamano
  2018-12-01 17:36     ` Carlo Marcelo Arenas Belón
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2018-12-01 12:02 UTC (permalink / raw)
  To: Elijah Newren; +Cc: carenas, Git Mailing List

Elijah Newren <newren@gmail.com> writes:

> Thanks for the patch!
>
> On Fri, Nov 30, 2018 at 6:52 PM Carlo Marcelo Arenas Belón
> ...
> Oops.  Thanks for catching.  To be honest, we don't even need -a, -R,
> etc. -- it was just a habit for me to add -a after cp.  A simple cp
> would do, though what you have here is fine too.

Thanks, both.  I think the topic won't escape 'next' until 2.20
final, and after that we can rewind 'next', so it may be better
to squash it in, but anyway...

-- >8 --
From: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Date: Fri, 30 Nov 2018 18:52:12 -0800
Subject: [PATCH] t6036: avoid non-portable "cp -a"

b8cd1bb713 ("t6036, t6043: increase code coverage for file collision
handling", 2018-11-07) uses this GNU extension that is not available
in a POSIX complaint cp.  In this particular case, there is no need to
use the option, as it is just copying a single file to create another
file.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/t6036-recursive-corner-cases.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/t6036-recursive-corner-cases.sh b/t/t6036-recursive-corner-cases.sh
index b7488b00c0..d23b948f27 100755
--- a/t/t6036-recursive-corner-cases.sh
+++ b/t/t6036-recursive-corner-cases.sh
@@ -1631,7 +1631,7 @@ test_expect_success 'check nested conflicts' '
 
 		# Compare m to expected contents
 		>empty &&
-		cp -a m_stage_2 expected_final_m &&
+		cp m_stage_2 expected_final_m &&
 		test_must_fail git merge-file --diff3 \
 			-L "HEAD"                     \
 			-L "merged common ancestors"  \
-- 
2.20.0-rc1-10-g7068cbc4ab


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

* Re: [PATCH] t6036: avoid "cp -a"
  2018-12-01 12:02   ` Junio C Hamano
@ 2018-12-01 17:36     ` Carlo Marcelo Arenas Belón
  0 siblings, 0 replies; 4+ messages in thread
From: Carlo Marcelo Arenas Belón @ 2018-12-01 17:36 UTC (permalink / raw)
  To: git; +Cc: gitster, newren

Thanks both. Agree with Junio it would be better if squashed; apologize
for not catching it earlier, but the following might help to make it
visible for anyone that care to run the linter:

  $ make test-lint-shell-syntax

Carlo
-- >8 --
From: =?UTF-8?q?Carlo=20Marcelo=20Arenas=20Bel=C3=B3n?= <carenas@gmail.com>
Subject: [PATCH] tests: add lint for non portable cp -a

cp -a, while a common flag isn't in POSIX and will therefore fail
on systems that don't have GNUish tools (like OpenBSD, AIX or Solaris)

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
 t/check-non-portable-shell.pl | 1 +
 1 file changed, 1 insertion(+)

diff --git a/t/check-non-portable-shell.pl b/t/check-non-portable-shell.pl
index b45bdac688..8037eef777 100755
--- a/t/check-non-portable-shell.pl
+++ b/t/check-non-portable-shell.pl
@@ -35,6 +35,7 @@ sub err {
 		chomp;
 	}
 
+	/\bcp\s+-a/ and err 'cp -a is not portable';
 	/\bsed\s+-i/ and err 'sed -i is not portable';
 	/\becho\s+-[neE]/ and err 'echo with option is not portable (use printf)';
 	/^\s*declare\s+/ and err 'arrays/declare not portable';
-- 
2.20.0.rc2


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

end of thread, other threads:[~2018-12-01 17:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-01  2:52 [PATCH] t6036: avoid "cp -a" Carlo Marcelo Arenas Belón
2018-12-01  4:21 ` Elijah Newren
2018-12-01 12:02   ` Junio C Hamano
2018-12-01 17:36     ` Carlo Marcelo Arenas Belón

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).