Michal
Michal

Reputation: 15669

Google Cloud Source Repository makes only a shallow clone?

Our code is hosted on GitHub. We are using Google Cloud Container Builder in order to build and package our software. In order to do that, we had to connect our private repo to Google Cloud Source Repository. Unfortunately it seems that the mirror is a shallow clone, because our dev tools are complaining about it. e.g. SonarQube cannot fetch blame for certain files.

Documentation:

Connected repositories

If you already have a repository on GitHub or Bitbucket, you can connect it to your Cloud Source Repository. Connected repositories are synchronized with the Cloud Source Repository automatically.

Is there a way how to increase the depth of the clone? Or how to make a full clone?

Upvotes: 4

Views: 2430

Answers (2)

ALOToverflow
ALOToverflow

Reputation: 2699

As described here

To build your source on a Git repo, Cloud Build performs a shallow clone of the repo. This means that only the single commit that started the build is checked out in the workspace to build. Cloud Build does not check out any other branches or history. This is done for efficiency, so that builds don't have to wait to fetch the whole repository and history just to build a single commit.

If you want to include more of your repo's history in the build, add a build step in your build config file to "unshallow" the clone. For example

steps:
- name: gcr.io/cloud-builders/git
  args: ['fetch', '--unshallow']
...

Upvotes: 4

Shawn Pearce
Shawn Pearce

Reputation: 11

Google Cloud Source Repository only supports full clones. Your repository does contain the full history for all branches (refs/heads/*) and tags (refs/tags/*).

If a commit is missing, my first guess is the commit is only found under a namespace such as refs/pulls/*, which CSR does not mirror.

Upvotes: 1

Related Questions