Skip to content

Commit 6e8d5cc

Browse files
committed
Fix debug()
1 parent 4e4a51c commit 6e8d5cc

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

git-fmt-diff

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,14 @@ cleanup () {
5151

5252
debug () (
5353
[ "$1" != "--" ] && [ "$gf_debug" -eq 0 ] && return
54-
>&2 printf "[debug] %s" "$(basename "$0")"
55-
if [ -n "$BASH_VERSION" ]; then
56-
# shellcheck disable=SC3028,SC3054
57-
>&2 printf ":%-3d %30s" "${BASH_LINENO[0]}" "${FUNCNAME[1]}"'()'
54+
if [ -z "$BASH_VERSION" ]; then
55+
>&2 printf '[debug] %s | %s\n' "$(basename "$0")" "$*"
56+
return
5857
fi
59-
>&2 printf " | %s\n" "$*"
58+
59+
# shellcheck disable=SC3028,SC3054
60+
>&2 printf '[debug] %s:%-3d %30s | %s\n' \
61+
"$(basename "$0")" "${BASH_LINENO[0]}" "${FUNCNAME[1]}"'()' "$*"
6062
)
6163

6264
pat_list_to_case () {
@@ -399,7 +401,6 @@ process_file () (
399401
rm_list__push "$fmtcmd"
400402
echo "$formatter" > "$fmtcmd"
401403

402-
# shellcheck disable=SC2086
403404
eval "sh '$fmtcmd' < '$b_raw' > '$b_fmt' $g_fmtprg_devnull"
404405
rm_list__push "$b_fmt"
405406

0 commit comments

Comments
 (0)