Skip to content

git restore --source=HEAD :/ advice after failed git clone has no effect #3411

@Marcono1234

Description

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

Originally asked this as StackOverflow question, but was told it might be a Git for Windows bug.

Related to the advice observed in #2438 (comment).

Setup

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

    $ git --version --build-options
    
    git version 2.33.0.windows.2
    cpu: x86_64
    built from commit: 8735530946cced809cc6cc4c2ca3b078cdb3dfc8
    sizeof-long: 4
    sizeof-size_t: 8
    shell-path: /bin/sh
    feature: fsmonitor--daemon
    
  • 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.19043.1165]
    
  • What options did you set as part of the installation? Or did you choose the
    defaults?

    $ cat /etc/install-options.txt
    
    Editor Option: Notepad++
    Custom Editor Path:
    Default Branch Option: main
    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: Core
    Performance Tweaks FSCache: Enabled
    Enable Symlinks: Disabled
    Enable Pseudo Console Support: Disabled
    Enable FSMonitor: Disabled
    
  • Any other interesting things about your environment that might be related
    to the issue you're seeing?

    • Long Windows file paths have not been enabled explicitly.
    • git config core.longpaths is not set (neither for system nor globally).

Details

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

    PowerShell, Git Bash

  • What commands did you run to trigger this issue? If you can provide a
    Minimal, Complete, and Verifiable example
    this will help us understand the issue.

    1. git clone https://github.com/dependabot/dependabot-core --depth=1 file-name-test
      ℹ️ Cloning fails due to "Filename too long"; Git suggests to run git restore --source=HEAD :/
    2. cd file-name-test
    3. git config core.longpaths true
    4. Run command suggested by Git:
      git restore --source=HEAD :/
    5. git status
      ❌ Changes are reported; running git restore had no effect
  • What did you expect to occur after running these commands?

    Either:

    • After running git restore --source=HEAD :/ no changes should be reported anymore
    • OR Git should not suggest running git restore --source=HEAD :/ if it would have no effect
  • What actually happened instead?

    Git suggested to run git restore --source=HEAD :/; it had no effect.

    Note that checkout succeeds when running git restore --source=HEAD -SW :/ or git reset --hard.

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

    any repository with long file paths

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions