threads / patch / 53106

patch, 2 partstest shell-library cleanups

Subject: [PATCH 0/2] test shell-library cleanups

## tl;dr

4 messages between Mar 26, 2020 and Mar 26, 2020. Diffs are folded; open one to read it.

replies: 3people: 2as markdown or json

Jeff King· Mar 26, 2020, 08:23 UTC · lore

Inspired by Dscho's cleanup of lib-gpg.sh in [1], I noticed a few other things.

  [1/2]: t/lib-credential.sh: drop shebang line
  [2/2]: t/lib-*.sh: drop executable bit
 t/lib-credential.sh       | 3 ++-
 t/lib-gpg.sh              | 0
 t/lib-log-graph.sh        | 0
 t/lib-submodule-update.sh | 0
 4 files changed, 2 insertions(+), 1 deletion(-)
 mode change 100755 => 100644 t/lib-credential.sh
 mode change 100755 => 100644 t/lib-gpg.sh
 mode change 100755 => 100644 t/lib-log-graph.sh
 mode change 100755 => 100644 t/lib-submodule-update.sh
-Peff
[1] https://lore.kernel.org/git/c1811d54190a62e3d35505e2b806c89238b56de8.1585114881.git.gitgitgadget@gmail.com/
Jeff King· Mar 26, 2020, 08:25 UTC · re: Jeff King · lore

[PATCH 1/2] t/lib-credential.sh: drop shebang line

The purpose of lib-credential.sh is to be sourced into other test scripts. It doesn't need a "#!/bin/sh" line, as running it directly makes no sense. Nor does it serve any real filetype documentation purpose, as the file is cleary named with a ".sh" extension.

In the spirit of c74c72034f (test: replace shebangs with descriptions in shell libraries, 2013-11-25), let's replace it with a human-readable description.

Signed-off-by: Jeff King <peff@peff.net>
---
I left the similar case in lib-gpg alone so as not to conflict with
Dscho's version.
 t/lib-credential.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Show changes to t/lib-credential.sh +2 −1
diff --git a/t/lib-credential.sh b/t/lib-credential.sh
index 937b831ea6..5ea8bc9f1d 100755
--- a/t/lib-credential.sh
+++ b/t/lib-credential.sh
@@ -1,4 +1,5 @@
-#!/bin/sh
+# Shell library for testing credential handling including helpers. See t0302
+# for an example of testing a specific helper.
 
 # Try a set of credential helpers; the expected stdin,
 # stdout and stderr should be provided on stdin,
-- 
2.26.0.576.gb87790c3c1
Denton Liu· Mar 26, 2020, 08:33 UTC · re: Jeff King · lore

Re: [PATCH 1/2] t/lib-credential.sh: drop shebang line

On Thu, Mar 26, 2020 at 04:25:27AM -0400, Jeff King wrote:
> The purpose of lib-credential.sh is to be sourced into other test
> scripts. It doesn't need a "#!/bin/sh" line, as running it directly
> makes no sense. Nor does it serve any real filetype documentation
> purpose, as the file is cleary named with a ".sh" extension.
s/cleary/clearly/
Patch and message look obviously good otherwise.
Jeff King· Mar 26, 2020, 08:25 UTC · re: Jeff King · lore

[PATCH 2/2] t/lib-*.sh: drop executable bit

There's no need for shell libraries to have the executable bit. They're meant to be sourced, and running them stand-alone is pointless. Let's reduce any possible confusion by making it more clear they're not meant to be run this way.

Signed-off-by: Jeff King <peff@peff.net>
---
 t/lib-credential.sh       | 0
 t/lib-gpg.sh              | 0
 t/lib-log-graph.sh        | 0
 t/lib-submodule-update.sh | 0
 4 files changed, 0 insertions(+), 0 deletions(-)
 mode change 100755 => 100644 t/lib-credential.sh
 mode change 100755 => 100644 t/lib-gpg.sh
 mode change 100755 => 100644 t/lib-log-graph.sh
 mode change 100755 => 100644 t/lib-submodule-update.sh
Show changes to 4 files +0 −0

t/lib-credential.sh, t/lib-gpg.sh, t/lib-log-graph.sh, t/lib-submodule-update.sh

diff --git a/t/lib-credential.sh b/t/lib-credential.sh
old mode 100755
new mode 100644
diff --git a/t/lib-gpg.sh b/t/lib-gpg.sh
old mode 100755
new mode 100644
diff --git a/t/lib-log-graph.sh b/t/lib-log-graph.sh
old mode 100755
new mode 100644
diff --git a/t/lib-submodule-update.sh b/t/lib-submodule-update.sh
old mode 100755
new mode 100644
-- 
2.26.0.576.gb87790c3c1

← back to recent threads