Repository navigation
shell: Fix empty input_str being treated as no stdin redirect - #329
Merged
Merged
Conversation
`create_sh_task` and `feed_input` checked `input_str`'s truthiness,
which can't tell "no stdin redirect requested" (None) apart from "pipe
zero bytes then close stdin" (""). git.Git.empty_tree() relies on the
latter when it calls git_stdout("mktree", input_str=""), expecting git
mktree to see immediate EOF and hand back the empty tree hash.
Because "" is falsy, create_sh_task never set stdin=PIPE, so the mktree
child inherited the real parent stdin instead. Under pytest that fd is
already at EOF, so the existing suite never caught it. At a real
terminal
it's a live pty: `revup amend --last-touched` (which calls empty_tree
via
rebuild_stack_last_touched on essentially every ordinary amend) hangs
waiting for a keystroke, and pressing Enter feeds mktree a line it can't
parse as a tree entry, which it reports as a failure.
Fix the assertion and the check, to pipe `input_str` when specified, even
when empty. Fix `feed_input` to close the writer even when `input_str`
is empty.
Add tests/test_shell.py covering these possibilities.
Topic: fix-absorb
Reviewers: jerry
Contributor
Author
|
Reviews in this chain: |
Contributor
Author
jerry-skydio
approved these changes
Nov 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
create_sh_taskandfeed_inputcheckedinput_str's truthiness,which can't tell "no stdin redirect requested" (None) apart from "pipe
zero bytes then close stdin" (""). git.Git.empty_tree() relies on the
latter when it calls git_stdout("mktree", input_str=""), expecting git
mktree to see immediate EOF and hand back the empty tree hash.
Because "" is falsy, create_sh_task never set stdin=PIPE, so the mktree
child inherited the real parent stdin instead. Under pytest that fd is
already at EOF, so the existing suite never caught it. At a real
terminal
it's a live pty:
revup amend --last-touched(which calls empty_treevia
rebuild_stack_last_touched on essentially every ordinary amend) hangs
waiting for a keystroke, and pressing Enter feeds mktree a line it can't
parse as a tree entry, which it reports as a failure.
Fix the assertion and the check, to pipe
input_strwhen specified, evenwhen empty. Fix
feed_inputto close the writer even wheninput_stris empty.
Add tests/test_shell.py covering these possibilities.
Topic: fix-absorb
Reviewers: jerry