Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git "expected shallow list" error when shallow had tested as true

Tags:

travis-ci

I have a repo that, when tested on Travis, consistently gives an error like:

$ if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
fatal: git fetch-pack: expected shallow list
The command "if [[ -a .git/shallow ]]; then git fetch --unshallow; fi" failed and exited with 128 during .
Your build has been stopped.

You can see an example here, although it's possible that link requires authorization.

What I find strange about this that it seems the git fetch --unshallow should run only if it's already determined that it is shallow. I should add that I've used this construct in many other repositories and never had a problem.

On my local machine, the contents of .git are:

myrepo.git$ ls -a
.   branches        config       FETCH_HEAD  HEAD   index  logs     ORIG_HEAD                                                        
..  COMMIT_EDITMSG  description  gitk.cache  hooks  info   objects  refs
like image 670
tholy Avatar asked Nov 21 '22 03:11

tholy


1 Answers

I am not hip to the internals of Git, nor do I really understand what git fetch --unshallow is actually supposed to do, but one possibility: check which version of git you have available to your Travis test runners.

I see the same fatal: git fetch-pack: expected shallow list error message with a GitLab CI/CD shell runner on CentOS 7 VMs. CentOS 7 only has Git 1.8.something in the official repos.

This blog post is where I initially became aware of this error message being related to an old version of Git. That post suggests upgrading the OS-default version of git with third-party repos, which I didn't want to do.

What I ended up doing instead, as advised here, was setting:

variables:
  GIT_STRATEGY: clone

in the .gitlab-ci.yml. This is, of course, a GitLab-specific thing, but I'm pretty positive Travis gives you some option for setting environment variables for your test environment.


See also:

  1. gitlab runner doesn`t work on a specific project (Ryan Daniels' answer)
like image 55
TheDudeAbides Avatar answered Dec 20 '22 14:12

TheDudeAbides