git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Possible regression for sparse-checkout in git 2.27.0
@ 2020-06-03  1:08 Shaun Case
  2020-06-03  4:37 ` Elijah Newren
  0 siblings, 1 reply; 8+ messages in thread
From: Shaun Case @ 2020-06-03  1:08 UTC (permalink / raw)
  To: git

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
==============================================

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

end of thread, other threads:[~2020-06-05 13:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-03  1:08 Possible regression for sparse-checkout in git 2.27.0 Shaun Case
2020-06-03  4:37 ` 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

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