Skip to content

Preserve Git command failure statuses - #352

Open
dajiaohuang wants to merge 2 commits into
RichiH:mainfrom
dajiaohuang:fix/propagate-command-status
Open

dajiaohuang wants to merge 2 commits into
RichiH:mainfrom
dajiaohuang:fix/propagate-command-status

Conversation

@dajiaohuang

@dajiaohuang dajiaohuang commented Oct 4, 2026 •

Copy link
Copy Markdown

Changes

  • Save the Git exit status immediately after commit, pull and push, before successful post-hooks can mask it.
  • In status_helper, capture the Git status exit code before formatting its output. This propagates through the named-repository status path; it does not fix aggregate status across repositories or change the existing last-repository behavior of commit/pull/push.
  • Emit the status formatter only for nonempty Git output, restoring zero-byte stdout for a clean named repository.
  • Return failure when clone finds no candidate branch.

Related to #251 and #307; these targeted status fixes do not resolve hook failure policy or dynamic default-branch detection.

Validation and limits

Generated the vcsh script from the exact vcsh.in source (configure substitution) and ran isolated Git-backed consumer checks: clean named-repository status emits zero bytes (one newline before the last commit), a dirty repository keeps the existing formatted output byte-for-byte unchanged, and a real Git status failure (corrupt HEAD) propagates exit 128. Shell syntax check and git diff --check passed.

The Perl/prove suite and full project suite were not run, and no build, install or CI execution was performed. These are isolated fixtures, not acceptance against real user dotfiles.

dajiaohuang and others added 2 commits October 4, 2026 10:19
status_helper now runs the printf/sed formatter only when Git produced
output, so an empty status contributes zero bytes instead of one newline
while the saved Git status code and nonempty formatting stay unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant