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

Missing carriage returns? (lines start at the column that previous ended on) #2739

Closed
1 task done
krryan opened this issue Jul 8, 2020 · 9 comments
Closed
1 task done
Labels

Comments

@krryan
Copy link

krryan commented Jul 8, 2020

  • I was not able to find an open or closed issue matching what I'm seeing

Setup

  • Which version of Git for Windows are you using? Is it 32-bit or 64-bit?

Seen this across a few versions now:

$ git --version --build-options

git version 2.27.0.windows.1.18.g51f9af323b.20200707200701
cpu: x86_64
built from commit: 51f9af323b04dbe37018a40287071ef91b9546ac
sizeof-long: 4
sizeof-size_t: 8
$ git --version --build-options

git version 2.28.0.windows.1
cpu: x86_64
built from commit: 77982caf269b7ee713a76da2bcf260c34d3bf7a7
sizeof-long: 4
sizeof-size_t: 8
shell-path: /bin/sh

I am pretty sure I saw this problem on the release version of 2.27.0 as well.

  • Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?
$ cmd.exe /c ver

Microsoft Windows [Version 10.0.18362.900]
(c) 2019 Microsoft Corporation. All rights reserved.
  • What options did you set as part of the installation? Or did you choose the
    defaults?
# One of the following:
> type "C:\Program Files\Git\etc\install-options.txt"
> type "C:\Program Files (x86)\Git\etc\install-options.txt"
> type "%USERPROFILE%\AppData\Local\Programs\Git\etc\install-options.txt"
$ cat /etc/install-options.txt

Editor Option: VIM
Custom Editor Path:
Path Option: Cmd
SSH Option: OpenSSH
Tortoise Option: false
CURL Option: OpenSSL
CRLF Option: CRLFAlways
Bash Terminal Option: MinTTY
Git Pull Behavior Option: Merge
Use Credential Manager: Enabled
Performance Tweaks FSCache: Enabled
Enable Symlinks: Enabled
Enable Pseudo Console Support: Enabled
  • Any other interesting things about your environment that might be related
    to the issue you're seeing?

I have some customizations in ~/.bashrc which are probably irrelevant, though one comes up in the example:

PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\] $(__git_ps1 "(%s)")'$'\n$ '

This modifies my command prompt to include the current folder and git branch in the prompt, which is visible in the examples below.

Details

  • Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other

Git Bash

In this case, I was running git commit -a and git checkout - && git pull, but I have seen it sporadically with a number of commands (can’t recall offhand seeing it with non-git commands, but I’d be surprised if it had anything to do with git per se).

  • What did you expect to occur after running these commands?
KRyan@KRyanSpectre ~/Documents/repo/for/an-example-error (fix/editing/#####-this-is-some-branch-for-work)
$ git commit -a
[fix/editing/#####-this-is-some-branch-for-work] Task #60663: Double-click Save and Close crash
5 files changed, 27 insertions(+), 8 deletions(-)

KRyan@KRyanSpectre ~/Documents/repo/for/an-example-error (fix/editing/#####-this-is-some-branch-for-work)
$ git checkout - && git pull
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
Already up to date.
  • What actually happened instead?
KRyan@KRyanSpectre ~/Documents/repo/for/an-example-error (fix/editing/#####-this-is-some-branch-for-work)
$ git commit -a
[fix/editing/#####-this-is-some-branch-for-work 4a466815be] Task #60663: Double-click Save and Close crash
                                                                                                           5 files changed, 27 insertions(+), 8 deletions(-)

KRyan@KRyanSpectre ~/Documents/repo/for/an-example-error (fix/editing/#####-this-is-some-branch-for-work)
                                                                                                         $ git checkout - && git pull
                                                                                                                                     Switched to branch 'master'
Your branch is up to date with 'origin/master'.
Already up to date.

This seems to occur specifically when git commit triggers vim. Calling vim on its own does not trigger this behavior.

  • If the problem was occurring with a specific repository, can you provide the
    URL to that repository to help us with testing?

Doesn’t seem related to any repository, or even to git itself.

@krryan krryan changed the title Missing carriage returns? (subsequent lines start at the same horizontal line as previous) Missing carriage returns? (lines start at the column that previous ended on) Jul 9, 2020
@rosti-il
Copy link

I also experience this bug when amending a commit or running an interactive rebase. I use the default vi text editor.
In case of interactive rebase the whole terminal may stuck when printing some error. The error itself probably not related to this bug:

$ git rebase --edit-todo
error: cannot 'squash' without a previous commit
error: cannot 'squash' without a previous commit
                                                You can fix this with 'git rebase --edit-todo' and then run 'git rebase --continue'.
$ git --version --build-options
git version 2.27.0.windows.1
cpu: x86_64
built from commit: 907ab1011dce9112700498e034b974ba60f8b407
sizeof-long: 4
sizeof-size_t: 8
$ cmd.exe /c ver
Microsoft Windows [Version 10.0.19041.388]
(c) 2020 Microsoft Corporation. All rights reserved.

@rosti-il
Copy link

This bug seems to be triggered by the vi text editor or by the way it was ran by git. It happen when returned from vi that was started by git. Running the vi/vim editor manually doesn't trigger this bug, though.

@krryan
Copy link
Author

krryan commented Jul 18, 2020

Yeah, I agree that it seems to be (inconsistently) triggered by vim when started by git.

@krryan
Copy link
Author

krryan commented Jul 28, 2020

Updated this to indicate it is still a problem in 2.28.

@dscho
Copy link
Member

dscho commented Aug 10, 2020

... but it only happens when Pseudo Console support is enabled, correct?

@krryan
Copy link
Author

krryan commented Aug 10, 2020

@dscho I haven’t tested that; I believe I did in 2.27, but that was probably invalid due to the 2.27 bug that prevented disabling the pseudo-console support once it had been enabled, so those weren’t valid tests. I may try disabling it and doing some testing later today.

@dscho
Copy link
Member

dscho commented Aug 11, 2020

FWIW you can easily toggle the Pseudo Console support yourself, in the file /etc/git-bash.config: if you insert the contents MSYS=enable_pcon, Pseudo Console support is enabled, if you remove that line (or that file), it is disabled. (The bug in v2.27.0 was that it did not delete that file when uninstalling/reinstalling.)

@dscho
Copy link
Member

dscho commented Aug 24, 2020

Sadly, a local test with an early local version of the MSYS2 runtime v3.1.7 shows that this issue has not been fixed in Cygwin yet.

@dscho
Copy link
Member

dscho commented Mar 18, 2022

Closing as stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants