Skip to content

git checkout fails when recovering a deleted directory #1442

Closed
@orgads

Description

@orgads

If I delete a directory, then try to recover it using git checkout, it fails.

Running git checkout -f without providing the directory name works.

  • 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.16.0.windows.2
cpu: x86_64
built from commit: a56c4f9e2a9513d2be57dc4346e0e84887399cd9
sizeof-long: 4
  • 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 6.1.7601]
  • 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
Path Option: Cmd
SSH Option: OpenSSH
CURL Option: WinSSL
CRLF Option: CRLFAlways
Bash Terminal Option: MinTTY
Performance Tweaks FSCache: Enabled
Use Credential Manager: Enabled
Enable Symlinks: Enabled
  • Any other interesting things about your environment that might be related
    to the issue you're seeing?

** insert your response here **

Details

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

Bash

orgads@isr020134037 MINGW64 /f/git-sdk-64/usr/src/git ((v2.16.0.windows.2))
$ rm -rf t
git
orgads@isr020134037 MINGW64 /f/git-sdk-64/usr/src/git ((v2.16.0.windows.2))
$ git checkout -f t
Unlink of file 't' failed. Should I try again? (y/n) n
warning: unable to unlink 't': Directory not empty
fatal: cannot create directory at 't': Directory not empty

orgads@isr020134037 MINGW64 /f/git-sdk-64/usr/src/git ((v2.16.0.windows.2))
$ git checkout -f -- t
error: unable to stat just-written file t/.gitignore: No such file or directory
Unlink of file 't/Git-SVN' failed. Should I try again? (y/n) n
warning: unable to unlink 't/Git-SVN': Directory not empty
fatal: cannot create directory at 't/Git-SVN': Directory not empty

orgads@isr020134037 MINGW64 /f/git-sdk-64/usr/src/git ((v2.16.0.windows.2))
$ git checkout -f -- t
Unlink of file 't/Git-SVN/Utils' failed. Should I try again? (y/n) n
warning: unable to unlink 't/Git-SVN/Utils': Directory not empty
fatal: cannot create directory at 't/Git-SVN/Utils': Directory not empty

orgads@isr020134037 MINGW64 /f/git-sdk-64/usr/src/git ((v2.16.0.windows.2))
$ git checkout -f -- t
error: unable to stat just-written file t/Git-SVN/Utils/can_compress.t: No such file or directory
error: unable to stat just-written file t/Git-SVN/Utils/canonicalize_url.t: No such file or directory
error: unable to stat just-written file t/Git-SVN/Utils/collapse_dotdot.t: No such file or directory
error: unable to stat just-written file t/Git-SVN/Utils/fatal.t: No such file or directory
error: unable to stat just-written file t/Git-SVN/Utils/join_paths.t: No such file or directory
error: unable to stat just-written file t/Makefile: No such file or directory
error: unable to stat just-written file t/README: No such file or directory
error: unable to stat just-written file t/aggregate-results.sh: No such file or directory
error: unable to stat just-written file t/annotate-tests.sh: No such file or directory
error: unable to stat just-written file t/check-non-portable-shell.pl: No such file or directory
error: unable to stat just-written file t/diff-lib.sh: No such file or directory
Unlink of file 't/diff-lib' failed. Should I try again? (y/n) n
warning: unable to unlink 't/diff-lib': Directory not empty
fatal: cannot create directory at 't/diff-lib': Directory not empty
  • If the problem was occurring with a specific repository, can you provide the
    URL to that repository to help us with testing?

https://github.com/git-for-windows/git

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions