git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Possible bug with git restore

From
SSSergii Shkarnikov <sergii.shkarnikov@globallogic.com>
Date
Aug 12, 2020, 18:51 UTC
Message-ID
<CAFvH=vsWyX79j-9pyC5gpxGu8rRxYyrXwywHjh-_T2opHjT8Xg@mail.gmail.com>
Hi.

I see some strange behavior of the "git restore" command. Here is a bug report template filled out:

********************************************************************* Thank you for filling out a Git bug report! Please answer the following questions to help us understand your issue.

What did you do before the bug happened? (Steps to reproduce your issue)
    I tried to restore a couple of files from an earlier commit
running the restore command with a wildcard:
    git restore -s HEAD~ -- */filename.*
    In my work tree those are .cpp and .hpp files stored in different folders.
What did you expect to happen? (Expected behavior)
    Both files are restored to what they were in HEAD~.
What happened instead? (Actual behavior)
    Both files were deleted (and got (delete) status).
What's different between what you expected and what actually happened?
    Files became deleted for no apparent reason instead of restoring
to expected revision.
Anything else you want to add:
    Running this command without wildcards for each file separately
works as expected.

Please review the rest of the bug report below. You can delete any lines you don't wish to share.

[System Info] git version: git version 2.27.0.windows.1 cpu: x86_64 built from commit: 907ab1011dce9112700498e034b974ba60f8b407 sizeof-long: 4 sizeof-size_t: 8 uname: Windows 10.0 18363 compiler info: gnuc: 10.1 libc info: no libc information available

[Enabled Hooks] post-commit post-checkout post-merge pre-push *************************************************************** Regards, Sergii Shkarnikov

Next: Eric Sunshine
Message 1 of 11 in “Possible bug with git restore”
  1. Sergii ShkarnikovAug 12, 2020
  2. Eric SunshineAug 14, 2020
  3. Sergii ShkarnikovAug 20, 2020
  4. Jeff KingAug 20, 2020
  5. René ScharfeAug 20, 2020
  6. Jeff KingAug 20, 2020
  7. checkout, restore: make pathspec recursiveRené Scharfe, Aug 22, 2020
  8. Jeff KingAug 24, 2020
  9. René ScharfeAug 22, 2020
  10. Jeff KingAug 24, 2020
  11. Junio C HamanoAug 22, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.