Skip to content

Commit

Permalink
test: replace shebangs with descriptions in shell libraries
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jonathan Nieder authored and Junio C Hamano committed Nov 26, 2013
1 parent b018c73 commit c74c720
Show file tree
Hide file tree
Showing 15 changed files with 64 additions and 20 deletions.
3 changes: 2 additions & 1 deletion t/gitweb-lib.sh
Original file line number Diff line number Diff line change
@@ -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
#
Expand Down
7 changes: 3 additions & 4 deletions t/lib-bash.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion t/lib-cvs.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
# Shell library sourced instead of ./test-lib.sh by cvsimport tests.

. ./test-lib.sh

Expand Down
3 changes: 2 additions & 1 deletion t/lib-diff-alternative.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
# Helpers shared by the test scripts for diff algorithms (patience,
# histogram, etc).

test_diff_frobnitz() {
cat >file1 <<\EOF
Expand Down
3 changes: 2 additions & 1 deletion t/lib-gettext.sh
Original file line number Diff line number Diff line change
@@ -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
#
Expand Down
18 changes: 17 additions & 1 deletion t/lib-git-daemon.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down
29 changes: 28 additions & 1 deletion t/lib-httpd.sh
Original file line number Diff line number Diff line change
@@ -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>
#
Expand Down
2 changes: 0 additions & 2 deletions t/lib-pack.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/bin/sh
#
# Support routines for hand-crafting weird or malicious packs.
#
# You can make a complete pack like:
Expand Down
2 changes: 1 addition & 1 deletion t/lib-pager.sh
Original file line number Diff line number Diff line change
@@ -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 &&
Expand Down
2 changes: 0 additions & 2 deletions t/lib-read-tree.sh
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion t/lib-rebase.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
# Helper functions used by interactive rebase tests.

# After setting the fake editor with this function, you can
#
Expand Down
2 changes: 1 addition & 1 deletion t/lib-terminal.sh
Original file line number Diff line number Diff line change
@@ -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_
Expand Down
4 changes: 3 additions & 1 deletion t/perf/perf-lib.sh
Original file line number Diff line number Diff line change
@@ -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
#
Expand Down
3 changes: 2 additions & 1 deletion t/test-lib-functions.sh
Original file line number Diff line number Diff line change
@@ -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
#
Expand Down
2 changes: 1 addition & 1 deletion t/test-lib.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
# Test framework for git. See t/README for usage.
#
# Copyright (c) 2005 Junio C Hamano
#
Expand Down

0 comments on commit c74c720

Please sign in to comment.