Skip to content

Define check_script_up_to_date return precedence for behind and dirty scripts #81

Description

@codeforester

Context

check_script_up_to_date can detect both of these states:

  • repository is behind upstream, returned as status 2
  • tracked script has local modifications, returned as status 3

The current implementation returns 2 as soon as it detects the repo is behind, so status 3 is unreachable when both conditions are true.

Failure Scenario

A repo is behind origin/main and the checked script has local modifications. The helper logs the dirty warning earlier, then returns 2 for behind. Automation that branches on status 3 cannot detect the local modification state.

Scope

  • Define the public return-code precedence for combined behind and dirty states.
  • Implement the chosen behavior without losing useful log output for either condition.
  • Document return statuses in lib/bash/git/README.md.
  • Add BATS coverage for the combined behind plus dirty case.

Acceptance Criteria

  • The combined state has a documented and tested return status.
  • Existing up-to-date, behind-only, and dirty-only tests continue to pass or are updated to match the documented contract.
  • ./tests/validate.sh passes.

Validation

  • ./tests/validate.sh

Metadata

Metadata

Assignees

Labels

bugSomething is not working

Type

No type
No fields configured for issues without a type.

Projects

Status
Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions