git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Bug report - sparse-checkout ignores prefix when run in subdirectories
@ 2022-01-05 20:13 Lessley Dennington
  2022-01-05 22:38 ` Junio C Hamano
  0 siblings, 1 reply; 10+ messages in thread
From: Lessley Dennington @ 2022-01-05 20:13 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Elijah Newren, Derrick Stolee, Junio C Hamano

Hello everyone! See the following bug report pertaining to sparse-checkout
when run outside top-level directories.

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)

$ git init -b main tmp
$ cd tmp
$ mkdir -p a/b/c
$ touch a/b/c/d a/b/c/e
$ git add a/
$ git commit -m "initial"
$ cd a/  # Not at the top level anymore
$ git sparse-checkout set --cone b/c
$ git -C .. sparse-checkout list

What did you expect to happen? (Expected behavior)

We expected the output sparsity path to be a/b/c.

What happened instead? (Actual behavior)

The output was b/c. Running $ cat ../.git/info/sparse-checkout
showed that the paths in this file were incorrect:
/*
!/*/
/b/
!/b/*/
/b/c/

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

The output path and the paths in the sparse-checkout file are missing the
expected 'a' prefix. This means that the `set` and `add` subcommands of
`sparse-checkout` can only be safely run from a repo's top-level directory.

Anything else you want to add:

This was discovered by newren@gmail.com in my recent tab-completion
series. You can find additional context at [1].

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.34.1.88.gcecf501e07.dirty (local build, based off
en/sparse-checkout-set)
cpu: x86_64
shell-path: /bin/zsh
uname: Darwin
compiler info:
Configured with: --prefix=/Library/Developer/CommandLineTools/usr
--with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
/usr/include/c++/4.2.1
Apple clang version 13.0.0 (clang-1300.0.29.3)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
$SHELL (typically, interactive shell): /bin/zsh

-Lessley

[1]: 
https://lore.kernel.org/git/CABPp-BGdr54XgCXw8k1xRCgkwBtDonyODS3O+_nS_QY3SOEFGQ@mail.gmail.com/

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

end of thread, other threads:[~2022-01-27 17:30 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-05 20:13 Bug report - sparse-checkout ignores prefix when run in subdirectories Lessley Dennington
2022-01-05 22:38 ` Junio C Hamano
2022-01-05 23:19   ` Elijah Newren
2022-01-05 23:29     ` Junio C Hamano
2022-01-06  0:08       ` Elijah Newren
2022-01-06  0:17         ` Junio C Hamano
2022-01-06  1:08           ` Elijah Newren
2022-01-06 19:25             ` Junio C Hamano
2022-01-27 16:43     ` Derrick Stolee
2022-01-27 17:30       ` Elijah Newren

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 NNTP newsgroup(s).