Skip to content

Commit 698a745

Browse files
EliahKaganLuaKT
authored andcommitted
Remove execution-specific code in sourcing-only .sh files
Some of the .sh script files are only meant ever to be sourced and not to be executed. These are already correctly not marked executable, but some of them contained code that would only be proper for scripts that are actually run, and not for scripts that are only sourced: - One contained a #! line, which this removes because it falsely indicated an intent to be executed, and because it was not effective even in principle when sourcing the script. - Two contained `set -eu` commands affecting the behavior of the running interpreter, which were redundant because the script for which they are helpers already runs such a command. If they are later sourced into other scripts (a use for which they are not intended and would probably require further modification), those other scripts might not have these `set` commands, but in that case those commands' behavior would probably not be wanted. This also adds "Must be sourced into the main journey test" comments at the top of .sh files to which they apply, mirroring the presence of such comments in other such files. Besides consistency, this has the advantage of making clear what all the scripts that are meant only for sourcing are being used for.
1 parent 9cd1a93 commit 698a745

File tree

4 files changed

+2
-4
lines changed

4 files changed

+2
-4
lines changed

tests/helpers.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Must be sourced into the main journey test
12

23
function set-static-git-environment() {
34
set -a
@@ -66,4 +67,3 @@ function launch-git-daemon() {
6667
done
6768
trap 'kill $daemon_pid' EXIT
6869
}
69-

tests/journey/ein.sh

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# Must be sourced into the main journey test
2-
set -eu
32

43
if test "$kind" = "max" || test "$kind" = "max-pure"; then
54
title "Porcelain ${kind}"

tests/journey/gix.sh

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# Must be sourced into the main journey test
2-
set -eu
32

43
title plumbing "${kind}"
54
snapshot="$snapshot/plumbing"

tests/utilities.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
# Must be sourced into the main journey test
22

33
WHITE="$(tput setaf 9 2>/dev/null || echo -n '')"
44
YELLOW="$(tput setaf 3 2>/dev/null || echo -n '')"

0 commit comments

Comments
 (0)