From: Jonathan Nieder <jrnieder@gmail.com>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: Git List <git@vger.kernel.org>, Clemens Buchacher <drizzd@aon.at>,
Marc Branchaud <marcnarc@xiplink.com>
Subject: [PATCH 8/9 v2] test: replace shebangs with descriptions in shell libraries
Date: Tue, 26 Nov 2013 13:39:51 -0800 [thread overview]
Message-ID: <20131126213951.GE4212@google.com> (raw)
In-Reply-To: <CAPig+cQizcuPjastanvyKkuo2=p9BPhBE-PhBC2J2EKwXvLekg@mail.gmail.com>
A #! line in these files is misleading, since these scriptlets are
meant to be sourced with '.' (using whatever shell sources them)
instead of run directly using the interpreter named on the #! line.
Removing the #! line shouldn't hurt syntax highlighting since
these files have filenames ending with '.sh'. For documentation,
add a brief description of how the files are meant to be used in
place of the shebang line.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Eric Sunshine wrote:
> On Mon, Nov 25, 2013 at 4:03 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
>> +++ b/t/lib-bash.sh
>> @@ -1,7 +1,6 @@
>> -#!/bin/sh
>> -#
>> -# Ensures that tests are run under Bash; primarily intended for running tests
>> -# of the completion script.
>> +# Shell library sourced instead of ./test-lib.sh by tests that need
>> +# to run under Bash; primary intended for tests of the completion
>
> s/primary/primarily/
Good eyes. Here's an updated version of the patch with that change.
Thanks,
Jonathan
t/gitweb-lib.sh | 3 ++-
t/lib-bash.sh | 7 +++----
t/lib-cvs.sh | 2 +-
t/lib-diff-alternative.sh | 3 ++-
t/lib-gettext.sh | 3 ++-
t/lib-git-daemon.sh | 18 +++++++++++++++++-
t/lib-httpd.sh | 29 ++++++++++++++++++++++++++++-
t/lib-pack.sh | 2 --
| 2 +-
t/lib-read-tree.sh | 2 --
t/lib-rebase.sh | 2 +-
t/lib-terminal.sh | 2 +-
t/perf/perf-lib.sh | 4 +++-
t/test-lib-functions.sh | 3 ++-
t/test-lib.sh | 2 +-
15 files changed, 64 insertions(+), 20 deletions(-)
diff --git a/t/gitweb-lib.sh b/t/gitweb-lib.sh
index 8cf909a..d5dab5a 100644
--- a/t/gitweb-lib.sh
+++ b/t/gitweb-lib.sh
@@ -1,4 +1,5 @@
-#!/bin/sh
+# Initialization and helpers for Gitweb tests, which source this
+# shell library instead of test-lib.sh.
#
# Copyright (c) 2007 Jakub Narebski
#
diff --git a/t/lib-bash.sh b/t/lib-bash.sh
index 11397f7..2be955f 100644
--- a/t/lib-bash.sh
+++ b/t/lib-bash.sh
@@ -1,7 +1,6 @@
-#!/bin/sh
-#
-# Ensures that tests are run under Bash; primarily intended for running tests
-# of the completion script.
+# Shell library sourced instead of ./test-lib.sh by tests that need
+# to run under Bash; primarily intended for tests of the completion
+# script.
if test -n "$BASH" && test -z "$POSIXLY_CORRECT"; then
# we are in full-on bash mode
diff --git a/t/lib-cvs.sh b/t/lib-cvs.sh
index 44263ad..5076718 100644
--- a/t/lib-cvs.sh
+++ b/t/lib-cvs.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+# Shell library sourced instead of ./test-lib.sh by cvsimport tests.
. ./test-lib.sh
diff --git a/t/lib-diff-alternative.sh b/t/lib-diff-alternative.sh
index 75ffd91..8b4dbf2 100644
--- a/t/lib-diff-alternative.sh
+++ b/t/lib-diff-alternative.sh
@@ -1,4 +1,5 @@
-#!/bin/sh
+# Helpers shared by the test scripts for diff algorithms (patience,
+# histogram, etc).
test_diff_frobnitz() {
cat >file1 <<\EOF
diff --git a/t/lib-gettext.sh b/t/lib-gettext.sh
index ae8883a..eec757f 100644
--- a/t/lib-gettext.sh
+++ b/t/lib-gettext.sh
@@ -1,4 +1,5 @@
-#!/bin/sh
+# Initialization and Icelandic locale for basic git i18n tests,
+# which source this scriptlet instead of ./test-lib.sh.
#
# Copyright (c) 2010 Ævar Arnfjörð Bjarmason
#
diff --git a/t/lib-git-daemon.sh b/t/lib-git-daemon.sh
index 87f0ad8..394b06b 100644
--- a/t/lib-git-daemon.sh
+++ b/t/lib-git-daemon.sh
@@ -1,4 +1,20 @@
-#!/bin/sh
+# Shell library to run git-daemon in tests. Ends the test early if
+# GIT_TEST_GIT_DAEMON is not set.
+#
+# Usage:
+#
+# . ./test-lib.sh
+# . "$TEST_DIRECTORY"/lib-git-daemon.sh
+# start_git_daemon
+#
+# test_expect_success '...' '
+# ...
+# '
+#
+# test_expect_success ...
+#
+# stop_git_daemon
+# test_done
if test -z "$GIT_TEST_GIT_DAEMON"
then
diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh
index ad8f1ef..c470784 100644
--- a/t/lib-httpd.sh
+++ b/t/lib-httpd.sh
@@ -1,4 +1,31 @@
-#!/bin/sh
+# Shell library to run an HTTP server for use in tests.
+# Ends the test early if httpd tests should not be run,
+# for example because the user has not enabled them.
+#
+# Usage:
+#
+# . ./test-lib.sh
+# . "$TEST_DIRECTORY"/lib-httpd.sh
+# start_httpd
+#
+# test_expect_success '...' '
+# ...
+# '
+#
+# test_expect_success ...
+#
+# stop_httpd
+# test_done
+#
+# Can be configured using the following variables.
+#
+# GIT_TEST_HTTPD enable HTTPD tests
+# LIB_HTTPD_PATH web server path
+# LIB_HTTPD_MODULE_PATH web server modules path
+# LIB_HTTPD_PORT listening port
+# LIB_HTTPD_DAV enable DAV
+# LIB_HTTPD_SVN enable SVN
+# LIB_HTTPD_SSL enable SSL
#
# Copyright (c) 2008 Clemens Buchacher <drizzd@aon.at>
#
diff --git a/t/lib-pack.sh b/t/lib-pack.sh
index b96e125..7509846 100644
--- a/t/lib-pack.sh
+++ b/t/lib-pack.sh
@@ -1,5 +1,3 @@
-#!/bin/sh
-#
# Support routines for hand-crafting weird or malicious packs.
#
# You can make a complete pack like:
--git a/t/lib-pager.sh b/t/lib-pager.sh
index ba03eab..3aa7a3f 100644
--- a/t/lib-pager.sh
+++ b/t/lib-pager.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+# Helpers for tests of git's choice of pager.
test_expect_success 'determine default pager' '
test_might_fail git config --unset core.pager &&
diff --git a/t/lib-read-tree.sh b/t/lib-read-tree.sh
index abc2c6f..6442ae3 100644
--- a/t/lib-read-tree.sh
+++ b/t/lib-read-tree.sh
@@ -1,5 +1,3 @@
-#!/bin/sh
-#
# Helper functions to check if read-tree would succeed/fail as expected with
# and without the dry-run option. They also test that the dry-run does not
# write the index and that together with -u it doesn't touch the work tree.
diff --git a/t/lib-rebase.sh b/t/lib-rebase.sh
index 8ff87fb..6bd2522 100644
--- a/t/lib-rebase.sh
+++ b/t/lib-rebase.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+# Helper functions used by interactive rebase tests.
# After setting the fake editor with this function, you can
#
diff --git a/t/lib-terminal.sh b/t/lib-terminal.sh
index 737df28..9a2dca5 100644
--- a/t/lib-terminal.sh
+++ b/t/lib-terminal.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+# Helpers for terminal output tests.
test_expect_success PERL 'set up terminal for tests' '
# Reading from the pty master seems to get stuck _sometimes_
diff --git a/t/perf/perf-lib.sh b/t/perf/perf-lib.sh
index f4eecaa..a8c9574 100644
--- a/t/perf/perf-lib.sh
+++ b/t/perf/perf-lib.sh
@@ -1,4 +1,6 @@
-#!/bin/sh
+# Performance testing framework. Each perf script starts much like
+# a normal test script, except it sources this library instead of
+# test-lib.sh. See t/perf/README for documentation.
#
# Copyright (c) 2011 Thomas Rast
#
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index 2f79146..aeae3ca 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -1,4 +1,5 @@
-#!/bin/sh
+# Library of functions shared by all tests scripts, included by
+# test-lib.sh.
#
# Copyright (c) 2005 Junio C Hamano
#
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 5968157..c306bd0 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+# Test framework for git. See t/README for usage.
#
# Copyright (c) 2005 Junio C Hamano
#
--
1.8.4.1
next prev parent reply other threads:[~2013-11-26 21:40 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-25 20:51 [PATCH 0/9] War on #! lines in shell libraries Jonathan Nieder
2013-11-25 20:52 ` [PATCH 1/9] mark Windows build scripts executable Jonathan Nieder
2013-11-25 20:53 ` [PATCH 2/9] mark perl test " Jonathan Nieder
2013-11-25 20:55 ` [PATCH 3/9] mark contributed hooks executable Jonathan Nieder
2013-11-25 20:58 ` [PATCH 4/9] contrib: remove git-p4import Jonathan Nieder
2013-11-26 12:31 ` Pete Wyckoff
2013-11-25 21:00 ` [PATCH 5/9 gitk] gitk: chmod +x po2msg Jonathan Nieder
2013-11-25 21:01 ` [PATCH 6/9 git-gui] git-gui: chmod +x po2msg, windows/git-gui.sh Jonathan Nieder
2013-11-25 21:02 ` [PATCH 7/9] test: make FILEMODE a lazy prereq Jonathan Nieder
2013-11-25 21:03 ` [PATCH 8/9] test: replace shebangs with descriptions in shell libraries Jonathan Nieder
2013-11-26 5:18 ` Eric Sunshine
2013-11-26 21:39 ` Jonathan Nieder [this message]
2013-11-25 21:03 ` [PATCH 9/9] remove #!interpreter line from " Jonathan Nieder
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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131126213951.GE4212@google.com \
--to=jrnieder@gmail.com \
--cc=drizzd@aon.at \
--cc=git@vger.kernel.org \
--cc=marcnarc@xiplink.com \
--cc=sunshine@sunshineco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).