Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird interaction with git add -p and Notepad++ (git hangs) #16553

Closed
klylesatepic opened this issue Jan 11, 2024 · 4 comments
Closed

Weird interaction with git add -p and Notepad++ (git hangs) #16553

klylesatepic opened this issue Jan 11, 2024 · 4 comments
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Attention The core contributors need to come back around and look at this ASAP. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting

Comments

@klylesatepic
Copy link

klylesatepic commented Jan 11, 2024

Windows Terminal version

1.18.3181.0

Windows build number

10.0.19044.3803
10.0.22621.2861

Other Software

Git (both versions 2.42.0.windows.2 and 2.43.0.windows.1)
Notepad++ (version 8.6)

Steps to reproduce

  1. Open Git Bash in Windows Terminal
  2. Navigate to a git repository
  3. Make changes in at least two separate places in a file
  4. Run GIT_EDITOR='"C:\Program Files\Notepad++\notepad++.exe" -multiInst -notabbar -nosession -noPlugin' git add -p to interactively stage parts of the file
    • Obviously you will need Notepad++ installed, and you may need to adjust the path to it
  5. Type e to edit the first hunk (Notepad++ will open)
  6. Make whatever change you like within one of the new lines (starting with a plus)
  7. Save and close Notepad++
  8. See that git moves on and prompts for the next hunk
  9. Try to type n to skip the next hunk (or anything else)
  10. See that git is stuck (Ctrl+C won't interrupt it)

The same issue happens with git add -i instead of git add -p, but requires more steps between steps 4/5.

The issue does not happen if any of the following are true:

  • You use vanilla Git Bash instead of Git Bash in Windows Terminal
  • You only edit the last hunk
  • You use a terminal editor instead of Notepad++ (I tried vim and nano)
  • You use /c/Windows/System32/notepad.exe instead of Notepad++
    • The bug still happens if you just use 'notepad', which is a shell script in Git Bash located at /usr/bin/notepad

Expected Behavior

Step 9 above would echo the character you typed, and git would not get stuck.

Actual Behavior

The character(s) you type are not echoed, nothing happens even after also pressing Enter, and even Ctrl+C will not interrupt git.

If you kill the git process with Task Manager, you do come back to a seemingly-working terminal.

@klylesatepic klylesatepic added Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Jan 11, 2024
@carlos-zamora
Copy link
Member

Thanks for filing! If you run conhost -- c:\Program Files\Git\bin\bash.exe -l -i from the Run dialog, does this reproduce the problem? Whether it reproduces in this scenario will help determine if this happens in the standard windows console vs WT.

@carlos-zamora carlos-zamora added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Jan 17, 2024
@klylesatepic
Copy link
Author

That does reproduce the issue. Everything seemed to work exactly the same way as in (Git Bash in) Windows Terminal.

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Jan 18, 2024
@DHowett
Copy link
Member

DHowett commented Jan 18, 2024

Excellent! Thanks for testing.

It looks like it's an msys2 (Cygwin) issue -- if it reproduces in the built-in Windows Console, it is likely to be something that they're doing differently in their mintty terminal integration versus their console integration. It may be worth filing a bug report on them. 🙂

@klylesatepic
Copy link
Author

I tried this workflow in a Cygwin shell and did not run into the issue. However, I've opened an msys2 issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Attention The core contributors need to come back around and look at this ASAP. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting
Projects
None yet
Development

No branches or pull requests

3 participants