Skip to content

Commit a454f98

Browse files
committed
template: Don't send git clone output to /dev/null
Previously I'd squelched the output because of the verbosity of the `detached HEAD` warning when making a shallow clone, but it's not really necessary anymore given `-c advice.detachedHead=false`. Now that the `template` test is failing on Travis, I really need to see the output: https://travis-ci.org/mbland/go-script-bash/jobs/200472791 https://travis-ci.org/mbland/go-script-bash/jobs/200472885
1 parent 0767f7f commit a454f98

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

go-template

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ readonly GO_SCRIPT_BASH_CORE="$SCRIPTS_DIR/go-script-bash/go-core.bash"
4040
readonly GO_SCRIPT_BASH_REPO_URL='https://github.com/mbland/go-script-bash.git'
4141

4242
if [[ ! -e "$GO_SCRIPT_BASH_CORE" ]]; then
43-
printf 'Cloning %s into %s...\n' "$GO_SCRIPT_BASH_REPO_URL" \
44-
"${GO_SCRIPT_BASH_CORE%/*}"
43+
printf "Cloning framework from '%s'...\n" "$GO_SCRIPT_BASH_REPO_URL"
4544
if ! git clone --depth 1 -c advice.detachedHead=false \
4645
-b "$GO_SCRIPT_BASH_VERSION" "$GO_SCRIPT_BASH_REPO_URL" \
47-
"${GO_SCRIPT_BASH_CORE%/*}" &>/dev/null; then
48-
printf 'Failed to clone %s; aborting.\n' "$GO_SCRIPT_BASH_REPO_URL" >&2
46+
"${GO_SCRIPT_BASH_CORE%/*}"; then
47+
printf "Failed to clone '%s'; aborting.\n" "$GO_SCRIPT_BASH_REPO_URL" >&2
4948
exit 1
5049
fi
50+
printf "Clone of '%s' successful.\n\n" "$GO_SCRIPT_BASH_REPO_URL"
5151
fi
5252

5353
. "$GO_SCRIPT_BASH_CORE" "${SCRIPTS_DIR##*/}"

tests/template.bats

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@ create_template_script() {
3535
create_template_script "$_GO_CORE_DIR" "$_GO_CORE_VERSION"
3636
run "$TEST_GO_ROOTDIR/go-template"
3737

38-
# The script will return an error without a command, but the core repo should
39-
# exist as expected.
38+
# Without a command argument, the script will print the top-level help and
39+
# return an error, but the core repo should exist as expected.
4040
assert_failure
41-
assert_output_matches "Cloning $_GO_CORE_DIR into $TEST_CLONE_DIR\.\.\."
41+
assert_output_matches "Cloning framework from '$_GO_CORE_DIR'\.\.\."
42+
assert_output_matches "Cloning into '$TEST_CLONE_DIR'\.\.\."
43+
assert_output_matches "Clone of '$_GO_CORE_DIR' successful\."$'\n\n'
4244
assert_output_matches "Usage: $TEST_GO_ROOTDIR/go-template <command>"
4345
[[ -f "$TEST_GO_ROOTDIR/scripts/go-script-bash/go-core.bash" ]]
4446

@@ -51,7 +53,7 @@ create_template_script() {
5153
@test "$SUITE: fail to clone a nonexistent repo" {
5254
create_template_script 'bogus-repo-that-does-not-exist'
5355
run "$TEST_GO_ROOTDIR/go-template"
54-
assert_failure \
55-
"Cloning bogus-repo-that-does-not-exist into $TEST_CLONE_DIR..." \
56-
'Failed to clone bogus-repo-that-does-not-exist; aborting.'
56+
assert_failure "Cloning framework from 'bogus-repo-that-does-not-exist'..." \
57+
"fatal: repository 'bogus-repo-that-does-not-exist' does not exist" \
58+
"Failed to clone 'bogus-repo-that-does-not-exist'; aborting."
5759
}

0 commit comments

Comments
 (0)