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

git checkout hangs when its current working directory has no files in the target branch of the checkout command #1064

Closed
1 task done
wilbaker opened this issue Feb 15, 2017 · 1 comment
Assignees
Milestone

Comments

@wilbaker
Copy link

wilbaker commented Feb 15, 2017

  • 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?
$ git --version --build-options

git version 2.11.1.windows.1
built from commit: 1c1842bcba45569a84112ec64f72b08eb2d57c68
sizeof-long: 4
machine: x86_64

  • Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?

Windows 10, 64-bit

$ cmd.exe /c ver

Microsoft Windows [Version 10.0.14393]
  • 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

C:\Repos\gvfsGitTest\Scripts>type "C:\Program Files\Git\etc\install-options.txt"
Path Option: Cmd
SSH Option: OpenSSH
CRLF Option: CRLFCommitAsIs
Bash Terminal Option: MinTTY
Performance Tweaks FSCache: Enabled
Use Credential Manager: Enabled
Enable Symlinks: Disabled
Enable Builtin Difftool: Disabled

  • Any other interesting things about your environment that might be related
    to the issue you're seeing?

No

Details

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

CMD


C:\Repos>git clone https://github.com/git-for-windows/git
C:\Repos>cd git\xdiff
C:\Repos\git\xdiff>del *
C:\Repos\git\xdiff\*, Are you sure (Y/N)? Y

[NOTE: xdiff is a folder with no subfolders inside of it, only files]

C:\Repos\git\xdiff>git checkout -b b1
C:\Repos\git\xdiff>git commit -a -m "del"
C:\Repos\git\xdiff>git checkout master
C:\Repos\git\xdiff>git checkout b1

  • What did you expect to occur after running these commands?

The final "git checkout b1" command (see above) would complete

  • What actually happened instead?

The "git checkout b1" command hung

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

Not repo specific

@dscho
Copy link
Member

dscho commented Feb 15, 2017

@wilbaker thank you for your report!

Funnily enough, this is a duplicate of #1062, even if it does not look like it at all.

The reason why it hangs is that it actually failed to delete the directory xdiff. Which makes sense because this is the current directory, so it cannot be deleted. What Git did was to print an error message

Deletion of directory 'xdiff' failed. Should I try again? (y/n)

and now waits for your input.

Except for one little detail... There is a bug in v2.11.1 where the error output is buffered, i.e. it is not printed immediately but the C runtime waits for "enough" characters to be printed before actually printing anything. This is wrong, of course, as the error output should always be immediate, i.e. unbuffered.

This has been fixed in master: 87ad093

I plan to provide at least a prerelease by the end of the week, or even a v2.11.1(2).

@dscho dscho self-assigned this Feb 23, 2017
@dscho dscho added this to the v2.11.2 milestone Feb 23, 2017
@dscho dscho closed this as completed Feb 26, 2017
benpeart pushed a commit that referenced this issue Jan 18, 2018
Git for Windows v2.12.0

Changes since Git for Windows v2.11.1 (February 3rd 2017)

New Features

  • Comes with Git v2.12.0.
  • The builtin difftool is no longer opt-in, as it graduated to be
    officially adopted by the Git project.
  • Comes with v2.7.0 of the POSIX emulation layer based on the Cygwin
    runtime.
  • Includes cURL 7.53.1.
  • The Portable Git now defaults to using the included Git Credential
    Manager.

Bug Fixes

  • The stderr output is unbuffered again, i.e. errors are displayed
    immediately (this was reported on the Git mailing list as well as
    issues #1064, #1064, #1068).
  • Git can clone again from paths containing non-ASCII characters.
  • We no longer ship two different versions of curl.exe.
  • Hitting Ctrl+T in Git GUI even after all files have been (un)staged
    no longer throws an exception.
  • A couple of Git GUI bugs regarding the list of recent repositories
    have been fixed.
  • The git-bash.exe helper now waits again for the terminal to be
    closed before returning.
  • Git for Windows no longer attempts to send empty credentials to
    HTTP(S) servers that handle only Basic and/or Digest authentication
    .
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

No branches or pull requests

2 participants