git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Bug report: `git restore --source --staged` deals poorly with sparse-checkout
@ 2022-10-03 22:05 Glen Choo
  2022-10-04 16:34 ` Victoria Dye
  0 siblings, 1 reply; 12+ messages in thread
From: Glen Choo @ 2022-10-03 22:05 UTC (permalink / raw)
  To: git, vdye, Derrick Stolee; +Cc: martinvonz

Filing a `git bugreport` on behalf of a user at $DAYJOB. I'm also pretty
surprised by this behavior, perhaps someone who knows more could shed
some light?

What did you do before the bug happened? (Steps to reproduce your issue)

  git clone git@github.com:git/git.git . &&
  git sparse-checkout set t &&
  git restore --source v2.38.0-rc1 --staged Documentation &&
  git status

What did you expect to happen? (Expected behavior)

I expected to see staged changes only, since I restored only paths
outside of my sparse spec (which was t/, plus the implicit root
directory).

What happened instead? (Actual behavior)

I saw a staged modification (Documentation/cmd-list.perl) and the same
file reported as deleted in the working copy. Specifically,

  $ git status

  On branch master
  Your branch is up to date with 'origin/master'.

  You are in a sparse checkout with 64% of tracked files present.

  Changes to be committed:
    (use "git restore --staged <file>..." to unstage)
          modified:   Documentation/cmd-list.perl

  Changes not staged for commit:
    (use "git add/rm <file>..." to update what will be committed)
    (use "git restore <file>..." to discard changes in working directory)
          deleted:    Documentation/cmd-list.perl

What's different between what you expected and what actually happened?

git status should not have said that the file was deleted in the
working copy

[System Info]
git version: git version 2.37.3.998.g577e59143f-goog
cpu: x86_64 no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Linux 5.17.11-1rodete2-amd64 #1 SMP PREEMPT Debian
5.17.11-1rodete2 (2022-06-09) x86_64
compiler info: gnuc: 12.2
libc info: glibc: 2.33
$SHELL (typically, interactive shell): /bin/bash

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-10-06 19:38 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-03 22:05 Bug report: `git restore --source --staged` deals poorly with sparse-checkout Glen Choo
2022-10-04 16:34 ` Victoria Dye
     [not found]   ` <CAESOdVAh68HoQoyicfZn4XbjGfiRFCu1zFQmUjMcSAg3tUzr4Q@mail.gmail.com>
2022-10-04 20:34     ` Victoria Dye
2022-10-05  4:53       ` Martin von Zweigbergk
2022-10-05  7:51         ` Elijah Newren
2022-10-05 20:00           ` Martin von Zweigbergk
2022-10-06  4:20             ` Elijah Newren
2022-10-05 16:11         ` Victoria Dye
2022-10-05  5:22       ` Elijah Newren
2022-10-06 19:30       ` Junio C Hamano
2022-10-06 19:38         ` Junio C Hamano
2022-10-05  5:00     ` Elijah Newren

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).