diff --git a/bash/functions/cybersecurity/scan_secrets_in_dirty.sh b/bash/functions/cybersecurity/scan_secrets_in_dirty.sh index aff8a79c..6946b673 100644 --- a/bash/functions/cybersecurity/scan_secrets_in_dirty.sh +++ b/bash/functions/cybersecurity/scan_secrets_in_dirty.sh @@ -6,7 +6,9 @@ scan_secrets_in_dirty() { local repo_dir="${1:-.}" - if [[ ! -d "$repo_dir/.git" ]]; then + # Accept both regular repos (.git is a directory) and worktrees (.git is a + # file containing "gitdir: ..." pointer). + if [[ ! -d "$repo_dir/.git" && ! -f "$repo_dir/.git" ]]; then echo "scan_secrets_in_dirty: '$repo_dir' no es un repo git" >&2 return 1 fi diff --git a/bash/functions/infra/git_hook_audit_app_drift.sh b/bash/functions/infra/git_hook_audit_app_drift.sh index 18dba3de..a8920cb6 100755 --- a/bash/functions/infra/git_hook_audit_app_drift.sh +++ b/bash/functions/infra/git_hook_audit_app_drift.sh @@ -17,7 +17,9 @@ git_hook_audit_app_drift() { echo "ERROR: repo_dir required" >&2 return 2 fi - if [[ ! -d "$repo_dir/.git" ]]; then + # Accept both regular repos (.git is a directory) and worktrees (.git is a + # file containing "gitdir: ..." pointer). + if [[ ! -d "$repo_dir/.git" && ! -f "$repo_dir/.git" ]]; then echo "ERROR: $repo_dir is not a git repo" >&2 return 2 fi diff --git a/cmd/fn/run.go b/cmd/fn/run.go index e15dab39..b4fc34fa 100644 --- a/cmd/fn/run.go +++ b/cmd/fn/run.go @@ -194,10 +194,67 @@ func buildGoCommand(fn *registry.Function, registryRoot, absPath string, args [] } +// bashFunctionName returns the name of the top-level function defined in the +// script that matches the file basename (e.g. "gradle_unit_test" for +// "gradle_unit_test.sh"), or "" if no such function is found. +// +// Library-style bash scripts define a function `()` or +// `function ` at the top level but do not call it. When executed +// directly with `bash