Context
Several smaller helper behaviors are not urgent defects, but they make the public API less tidy than it could be:
safe_mkdir only handles a leading -p by hand instead of using option parsing consistent with the rest of stdlib.
_git_pull_with_retry hardcodes two attempts.
git_get_current_branch changes process directory with pushd/popd even though git -C can avoid that.
git_get_current_branch docs say non-repo/missing directories store an empty string, but missing directories currently return nonzero.
Scope
- Make
safe_mkdir option/no-arg handling explicit and tested.
- Add a documented way to configure git pull retry attempts, or document the fixed retry policy as intentional.
- Refactor
git_get_current_branch to avoid changing the caller's working directory where practical.
- Align
git_get_current_branch docs, return codes, and tests.
Acceptance Criteria
- Helper contracts are documented and covered by BATS tests.
git_get_current_branch does not unexpectedly perturb the caller's directory stack.
- Retry behavior is either configurable or explicitly documented.
- Existing callers continue to work or have documented migration notes.
Validation
Suggested Branch
enhancement/<issue>-20260618-helper-contract-cleanup
Context
Several smaller helper behaviors are not urgent defects, but they make the public API less tidy than it could be:
safe_mkdironly handles a leading-pby hand instead of using option parsing consistent with the rest of stdlib._git_pull_with_retryhardcodes two attempts.git_get_current_branchchanges process directory withpushd/popdeven thoughgit -Ccan avoid that.git_get_current_branchdocs say non-repo/missing directories store an empty string, but missing directories currently return nonzero.Scope
safe_mkdiroption/no-arg handling explicit and tested.git_get_current_branchto avoid changing the caller's working directory where practical.git_get_current_branchdocs, return codes, and tests.Acceptance Criteria
git_get_current_branchdoes not unexpectedly perturb the caller's directory stack.Validation
./tests/validate.shSuggested Branch
enhancement/<issue>-20260618-helper-contract-cleanup