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

Re: Possible bug with git restore

From
SSSergii Shkarnikov <sergii.shkarnikov@globallogic.com>
Date
Aug 20, 2020, 12:59 UTC
Message-ID
<CAFvH=vuFg+kM2GkBaE7jRqHWWcTcZMrs36KLS+-VTy8tgNZXJw@mail.gmail.com>
In-Reply-To
<CAPig+cSCd_8YB90sypTe1bHMQhPgo+Tr2PHNucdqfCpEe+Dosg@mail.gmail.com>
Here is a script to reproduce the issue that works for me in Git Bash:

============================================= #!/bin/bash

#create repo with corresponding structure mkdir restore_bug_test cd restore_bug_test mkdir incl mkdir src touch incl/test_file.hpp touch src/test_file.cpp git init git add . git commit -m"initial"

#add a couple of commits echo "1" >> incl/test_file.hpp echo "1" >> src/test_file.cpp git commit -am"1" echo "2" >> incl/test_file.hpp echo "2" >> src/test_file.cpp git commit -am"2"

#reproduce bug git restore -s HEAD~ -- *test_file.* git status ===============================================

Haven't checked filenames explicitly, but they haven't been changed manually. And there are no explicit case changes in the attached script.

On Sat, Aug 15, 2020 at 1:42 AM Eric Sunshine <sunshine@sunshineco.com> wrote:
Show 19 quoted lines
>
> On Wed, Aug 12, 2020 at 2:51 PM Sergii Shkarnikov
> <sergii.shkarnikov@globallogic.com> wrote:
> >     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.
> >     Both files were deleted (and got (delete) status).
> >     Running this command without wildcards for each file separately
> > works as expected.
>
> Thanks for the report. Can you provide a complete recipe in the form
> of shell command to make this happen so others can reproduce the
> behavior? Doing so will help track down the issue. Also, since this is
> Windows, do the cases of the filenames in the referenced commit match
> the cases actually on the filesystem (and have the cases changed
> between commits)?
Previous: Eric SunshineNext: Jeff King
Message 3 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.