git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Shaun Case <warmsocks@gmail.com>
To: git@vger.kernel.org
Subject: Possible regression for sparse-checkout in git 2.27.0
Date: Tue, 2 Jun 2020 18:08:52 -0700	[thread overview]
Message-ID: <CAD3+_6CUX0RPr-dgfUnfGDNNfqu80SYCskioYnu=MS6aJv2dEQ@mail.gmail.com> (raw)

I'm seeing an unexpected change in behavior of git sparse-checkout
between 2.26.2 and 2.27.0 on CentOS 7.8.  Problem manifests with both
github and multiple recent versions of gitlab.

Sources came from
https://mirrors.edge.kernel.org/pub/software/scm/git/, I verified the
sha256 hashes for both 2.26.2 and 2.27.0 matched.

Built with
gcc (GCC) 8.3.1 20190311 (Red Hat 8.3.1-3)

By doing:

./configure \
    --prefix=/usr/local \
    --with-python=python3
make -j 10
sudo make -j 10 install install-doc install-html

Problem detail:

In 2.26.2, git sparse-checkout commands...

  init --cone
  set
  add

... all bring in files.  In 2.27.0, no files appear except the .git subdir
until I do:

git read-tree -mu HEAD

However, according to my reading of this, git read-tree should not be
necessary in 2.27.0:
https://stackoverflow.com/questions/28760940/why-does-one-call-git-read-tree-after-a-sparse-checkout/

When I do export GIT_TRACE_PACKET=1, I see that the init --cone, set
and add sparse-checkout commands all talk to the server.  In 2.27.0,
these commands do not result in any packets sent to the server.  It
sounds like they should be calling update_sparsity() themselves, but
aren't.  Is that wrong?  I couldn't find a git CLI client command to
invoke it directly except for read-tree.

Below is a small bash script and its output that shows the problem
with a small random public repo on github.

Best regards,
Shaun

Script:
==============================================
#!/bin/bash -x

export GIT_TRACE_PACKET=0
git --version
git clone --filter=blob:none --no-checkout
https://github.com/r-spacex/launch-timeline.git
cd launch-timeline

# Note no server traffic at from here...
export GIT_TRACE_PACKET=1
git sparse-checkout init --cone
git sparse-checkout set README.md
git sparse-checkout add css
# ... to here.

# There is nothing here yet except .git/
ls -las

# This brings in the files as expected, uncomment to verify.
# git read-tree -mu HEAD
==============================================


Output:
==============================================
3sc3396:/tmp>demo-git-sparse-checkout-bug.sh
+ export GIT_TRACE_PACKET=0
+ GIT_TRACE_PACKET=0
+ git --version
git version 2.27.0
+ git clone --filter=blob:none --no-checkout
https://github.com/r-spacex/launch-timeline.git
Cloning into 'launch-timeline'...
remote: Enumerating objects: 529, done.
remote: Total 529 (delta 0), reused 0 (delta 0), pack-reused 529
Receiving objects: 100% (529/529), 67.49 KiB | 987.00 KiB/s, done.
Resolving deltas: 100% (168/168), done.
+ cd launch-timeline
+ export GIT_TRACE_PACKET=1
+ GIT_TRACE_PACKET=1
+ git sparse-checkout init --cone
+ git sparse-checkout set README.md
+ git sparse-checkout add css
+ ls -las
total 68
 4 drwxrwxr-x   3 scase scase  4096 Jun  2 17:46 .
60 drwxrwxrwt. 34 root  root  57344 Jun  2 17:46 ..
 4 drwxrwxr-x   8 scase scase  4096 Jun  2 17:46 .git
==============================================

             reply	other threads:[~2020-06-03  1:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-03  1:08 Shaun Case [this message]
2020-06-03  4:37 ` Possible regression for sparse-checkout in git 2.27.0 Elijah Newren
2020-06-03 15:36   ` Derrick Stolee
2020-06-04  7:27     ` Elijah Newren
2020-06-04 20:50       ` Shaun Case
2020-06-05  0:32         ` Derrick Stolee
2020-06-05  0:56           ` Junio C Hamano
2020-06-05 13:07             ` Derrick Stolee

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to='CAD3+_6CUX0RPr-dgfUnfGDNNfqu80SYCskioYnu=MS6aJv2dEQ@mail.gmail.com' \
    --to=warmsocks@gmail.com \
    --cc=git@vger.kernel.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).