Skip to content

shell: Fix empty input_str being treated as no stdin redirect - #329

Merged
jerry-skydio merged 1 commit into
mainfrom
nikhil.marathe/revup/main/fix-absorb
Nov 13, 2026
Merged

jerry-skydio merged 1 commit into
mainfrom
nikhil.marathe/revup/main/fix-absorb

Conversation

@nikhil-marathe-skydio

Copy link
Copy Markdown
Contributor

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

`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
@nikhil-marathe-skydio

Copy link
Copy Markdown
Contributor Author

Reviews in this chain:
└#329 shell: Fix empty input_str being treated as no stdin redirect

@nikhil-marathe-skydio

Copy link
Copy Markdown
Contributor Author
# head base diff date summary
0 35fd4a05 8f5425ae diff Nov 10 18:12 PM 2 files changed, 120 insertions(+), 6 deletions(-)

@jerry-skydio
jerry-skydio merged commit 9d06e2d into main Nov 13, 2026
6 checks passed
@jerry-skydio
jerry-skydio deleted the nikhil.marathe/revup/main/fix-absorb branch November 13, 2026 03:11
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.

2 participants