Bug report - sparse-checkout ignores prefix when run in subdirectories

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx 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@xxxxxxxxxxxxxx/



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux