Revision 9788
Added by Aaron Marcuse-Kubitza over 11 years ago
lib/sh/util.sh | ||
---|---|---|
386 | 386 |
|
387 | 387 |
rel_path() # usage: base_dir=... path=... rel_path |
388 | 388 |
{ |
389 |
log++; kw_params base_dir path
|
|
389 |
kw_params base_dir path |
|
390 | 390 |
: "${base_dir:?}" "${path:?}" |
391 | 391 |
|
392 | 392 |
local path="$path/" # add *extra* / to match path when exactly = base_dir |
... | ... | |
412 | 412 |
alias cmd2rel_path="$(cat <<'EOF' |
413 | 413 |
if test "$(type -t "$1")" = file && test -e "$1"; then # not relative to PATH |
414 | 414 |
declare _1="$1"; shift |
415 |
_1="$(canon_rel_path "$_1")" || return |
|
415 |
_1="$(clog++ canon_rel_path "$_1")" || return
|
|
416 | 416 |
set -- "$_1" "$@" |
417 | 417 |
fi |
418 | 418 |
EOF |
... | ... | |
502 | 502 |
local func="$1"; shift |
503 | 503 |
|
504 | 504 |
log++; if test "$minor"; then log++; fi |
505 |
local loc; loc="$(func_loc "$func")" || return |
|
505 |
local loc; loc="$(clog++ func_loc "$func")" || return
|
|
506 | 506 |
echo_cmd "$loc" "$func" "$@" |
507 | 507 |
can_log |
508 | 508 |
} |
... | ... | |
601 | 601 |
|
602 | 602 |
set_paths() |
603 | 603 |
{ |
604 |
top_script="$(canon_rel_path "$top_script_abs")" || return |
|
604 |
top_script="$(clog++ canon_rel_path "$top_script_abs")" || return
|
|
605 | 605 |
echo_vars top_script |
606 | 606 |
top_dir="$(dirname "$top_script")" || return; echo_vars top_dir |
607 | 607 |
} |
Also available in: Unified diff
lib/sh/util.sh: rel_path(): don't log++ it, and instead only log++ applicable calls of it or its callers. this allows non-internal calls of rel_path() to be logged at the usual log_level.