Skip to content

fix(update): keep gitoxide's fetch report off stdout, name each submodule#78

Merged
bashandbone merged 1 commit into
mainfrom
fix/update-output-contract
Jul 26, 2026
Merged

fix(update): keep gitoxide's fetch report off stdout, name each submodule#78
bashandbone merged 1 commit into
mainfrom
fix/update-output-contract

Conversation

@bashandbone

Copy link
Copy Markdown
Owner

Problem

submod update printed gitoxide's own CLI-shaped fetch report straight to stdout:

+refs/heads/*:refs/remotes/origin/*
	4cb4d59d… refs/heads/main -> refs/remotes/origin/main [up-to-date]
Updated 1 submodule(s)

Two things wrong with that. The refspec mapping is gix fetch's output, not ours — it is narration for someone running gitoxide directly, and it lands on the stream callers parse. And the only thing submod itself said was a bare count that never named which submodules it touched.

That combination is what left test_update_command unable to assert anything but a number, which is where the wide || disjunction flagged in #62 P2 came from.

Fix

simple_gix::get_progress was writing its captured out buffer to this process's stdout unconditionally. It now returns the captured buffers and lets the caller decide.

fetch_repo gained a verbose flag and routes the report to stderr when the caller asked for it, or when the fetch failed and it is the only detail explaining why. The diagnostic is preserved rather than discarded — it just stops colliding with submod's output contract.

GitManager::update_submodule now names each submodule unconditionally instead of only under --verbose.

Verbose reaches GixOperations through a with_verbose builder rather than a new new() parameter, so the ~35 existing single-argument GixOperations::new call sites in the test suite are untouched and stay quiet by default.

Behavior

$ submod update                     # stdout
✅ Updated mylib
Updated 1 submodule(s)

$ submod update 2>&1 >/dev/null     # stderr — quiet
$ submod --verbose update 2>&1 >/dev/null
+refs/heads/*:refs/remotes/origin/*
	4cb4d59d… refs/heads/main -> refs/remotes/origin/main [up-to-date]
no negotiation was necessary

Tests

test_update_command now asserts the submodule is named, the count is reported, and the refspec report does not reach stdout.

569/569 passing locally, cargo fmt --check clean, no new clippy warnings (the single too_long_first_doc_paragraph warning in the lib is pre-existing on main — verified by stashing).

🤖 Generated with Claude Code

https://claude.ai/code/session_01XocU6NjgZricrRWMLyLXDn

…dule

`submod update` printed gitoxide's own CLI-shaped fetch report — the refspec
mapping and a per-ref status line — straight to stdout, then a bare
"Updated N submodule(s)" summary that never said which submodules were
touched. The plumbing narration was the only per-submodule detail on stdout,
and it is gitoxide's output, not ours.

`simple_gix::get_progress` was writing the captured `out` buffer to this
process's stdout unconditionally. It now returns the captured buffers and
lets the caller decide. `fetch_repo` takes a `verbose` flag and routes the
report to stderr when the caller asked for it, or when the fetch failed and
it is the only detail explaining why — so the diagnostic is preserved, not
discarded. stdout is left to carry submod's own output, which callers parse.

`GitManager::update_submodule` now names each submodule unconditionally
rather than only under --verbose, so a multi-submodule update reports what
it did rather than just how many.

Verbose is plumbed through `GixOperations` via a `with_verbose` builder so
the ~35 existing single-argument `GixOperations::new` call sites in the test
suite are untouched and stay quiet by default.

test_update_command now asserts the submodule is named and that the refspec
report does not reach stdout — the leak is what made the per-submodule line
unassertable in the first place, and left the wide `||` disjunction that
#62 P2 flagged.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XocU6NjgZricrRWMLyLXDn
@bashandbone
bashandbone merged commit 9bac978 into main Jul 26, 2026
8 checks passed
@bashandbone
bashandbone deleted the fix/update-output-contract branch July 26, 2026 03:10
@codecov

codecov Bot commented Jul 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.61905% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/git_ops/gix_ops.rs 93.33% 1 Missing ⚠️
Files with missing lines Coverage Δ
src/git_manager.rs 90.90% <100.00%> (-0.02%) ⬇️
src/git_ops/mod.rs 92.38% <100.00%> (+1.09%) ⬆️
src/git_ops/simple_gix.rs 98.83% <100.00%> (+0.22%) ⬆️
src/git_ops/gix_ops.rs 67.80% <93.33%> (+0.68%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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