git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lessley Dennington <lessleydennington@gmail.com>
To: Git Mailing List <git@vger.kernel.org>
Cc: Elijah Newren <newren@gmail.com>,
	Derrick Stolee <stolee@gmail.com>,
	Junio C Hamano <gitster@pobox.com>
Subject: Bug report - sparse-checkout ignores prefix when run in subdirectories
Date: Wed, 5 Jan 2022 14:13:22 -0600	[thread overview]
Message-ID: <29f0410e-6dfa-2e86-394d-b1fb735e7608@gmail.com> (raw)

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/

             reply	other threads:[~2022-01-05 20:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-05 20:13 Lessley Dennington [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=29f0410e-6dfa-2e86-394d-b1fb735e7608@gmail.com \
    --to=lessleydennington@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=newren@gmail.com \
    --cc=stolee@gmail.com \
    --subject='Re: Bug report - sparse-checkout ignores prefix when run in subdirectories' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).