Context
check_script_up_to_date compares local HEAD with the configured upstream ref, but it does not fetch first. If remote-tracking refs are stale, the function can report up to date when the remote has moved.
Fetching unconditionally may be undesirable in offline or latency-sensitive scripts, so this needs an explicit API/product decision.
Scope
- Decide whether
check_script_up_to_date should fetch by default, fetch behind an option/env var, or explicitly remain a local-ref-only check.
- Implement the chosen behavior in
lib/bash/git/lib_git.sh.
- Update
lib/bash/git/README.md to describe the freshness contract.
- Add BATS coverage for the selected behavior.
Acceptance Criteria
- Callers can tell whether the check reflects live remote state or only local remote-tracking refs.
- Stale-ref behavior is tested or documented as intentional.
- Existing skip conditions for no git, no upstream, untracked scripts, and non-repo paths remain predictable.
Validation
Suggested Branch
enhancement/<issue>-20260618-script-freshness-contract
Context
check_script_up_to_datecompares localHEADwith the configured upstream ref, but it does not fetch first. If remote-tracking refs are stale, the function can report up to date when the remote has moved.Fetching unconditionally may be undesirable in offline or latency-sensitive scripts, so this needs an explicit API/product decision.
Scope
check_script_up_to_dateshould fetch by default, fetch behind an option/env var, or explicitly remain a local-ref-only check.lib/bash/git/lib_git.sh.lib/bash/git/README.mdto describe the freshness contract.Acceptance Criteria
Validation
./tests/validate.shSuggested Branch
enhancement/<issue>-20260618-script-freshness-contract