sameersbn / sameersbn/docker-gitlab

Unable to fetch commit when using --depth 1 mode

Open
#2,887 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Shell
Stars
8.1k
Forks
2.1k
Avg merge
17h 47m
Merged PRs (30d)
7

Description

Problem Statement

Whenever attempt to fetch commit that are neither tagged nor head of branch, the following error comes out.

error: Server does not allow request for unadvertised object <hash_number>
Fetched in submodule path '<path_to_submodule>', but it did not contain <hash_number>. Direct fetching of that commit failed.
Step to Reproduce
  1. git clone --depth 1 <any_repo_with_submodule_with_hash_neither_head_of_branch_nor_tagged>
  2. cd <repo_name> && git submodule update --init
Attempted solution

With GIT_TRACE_PACKET=1 GIT_TRACE=2 git submodule update --init --depth 1, we can trace the packet:
On GitLab Web, you can find allow-reachable-sha1-in-want:

HEAD\0multi_ack thin-pack side-band side-band-64k ofs-delta shallow deepen-since deepen-not deepen-relative no-progress include-tag multi_ack_detailed allow-tip-sha1-in-want allow-reachable-sha1-in-want no-done symref=HEAD:refs/heads/master filter object-format=sha1 agent=git/2.42.0

But this is not on my case (missing allow-tip-sha1-in-want and allow-reachable-sha1-in-want ):

HEAD\0multi_ack thin-pack side-band side-band-64k ofs-delta shallow deepen-since deepen-not deepen-relative no-progress include-tag multi_ack_detailed no-done symref=HEAD:refs/heads/master object-format=sha1 agent=git/2.42.0

On Gitlab Omnibus, it is configurable by setting in /etc/gitlab/gitlab.rb but that file not exist in our Docker, nor relevant variable (uploadpack, allowReachableSHA1InWant) exist at all (correct me if I oversight it).

Is there a way to turn that option on by default in our case?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting the Docker image's GitLab configuration and the /etc/gitlab/gitlab.rb setting referenced in the issue; compare it with the uploadpack and allowReachableSHA1InWant behavior described for Omnibus. Reproduce the shallow clone and submodule fetch with an unadvertised commit, then verify whether an equivalent image setting enables the fetch.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, git
Domain
devops, infrastructure
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.