Issue with clone-depth=1

922 views
Skip to first unread message

Moe

unread,
May 23, 2016, 9:08:55 PM5/23/16
to Repo and Gerrit Discussion
Hi,

We recently run into a issue, when a repo have the clone-depth=1 set, the fetch always fails.
And once we remove the clone-depth=1 from the manifest, the repo sync works again.


the section of the trace that errors out looks like this: (done with GIT_TRACE_PACKET=1 GIT_CURL_VERBOSE=1 GIT_TRACE=1)

(upload-pack started)
.... many lines later ...

08:02:43.491860 run-command.c:341       trace: run_command: 'fetch-pack' '--stateless-rpc' '--stdin' '--lock-pack' '--thin' '--no-progress' '--depth=1' 'http://me@our_mirror/repoA/'
08:02:43.492192 exec_cmd.c:134          trace: exec: 'git' 'fetch-pack' '--stateless-rpc' '--stdin' '--lock-pack' '--thin' '--no-progress' '--depth=1' '
http://me@our_mirror/repoA/'
08:02:43.493788 git.c:349               trace: built-in: git 'fetch-pack' '--stateless-rpc' '--stdin' '--lock-pack' '--thin' '--no-progress' '--depth=1' '
http://me@our_mirror/repoA/'
08:02:43.493847 pkt-line.c:46           packet:   fetch-pack< AAAAAAAA AAAAAAAA
08:02:43.493854 pkt-line.c:46           packet:   fetch-pack< 0000
08:02:43.493861 pkt-line.c:46           packet:   fetch-pack< BBBBBBBB HEAD\0 include-tag multi_ack_detailed multi_ack ofs-delta side-band side-band-64k thin-pack no-progress shallow no-done

... some hundred lines later, we saw the ref we want ...
08:02:43.483799 pkt-line.c:46           packet:          git< AAAAAAAA refs/heads/this_is_the_branche
... and we have a lot of tags ...

08:02:43.503086 pkt-line.c:46           packet:   fetch-pack< XXXXXXXX refs/tags/important_tag^{}
08:02:43.503090 pkt-line.c:46           packet:   fetch-pack< YYYYYYYY refs/tags/best_tag
08:02:43.503094 pkt-line.c:46           packet:   fetch-pack< ZZZZZZZZ refs/tags/awsome_tag^{}
08:02:43.503098 pkt-line.c:46           packet:   fetch-pack< 0000
08:02:43.523158 pkt-line.c:46           packet:   fetch-pack> 0000
08:02:43.523198 pkt-line.c:46           packet:          git< 0000
error: no such remote ref AAAAAAAA
: git pack-refs --all --prune 1>| 2>|
error: Cannot fetch repoA

error: Exited sync due to fetch errors
Fetching project repoA

So, compared to the fetch from partner-android.googlesource.com, our fetch does not attempt to "want" the AAAAAAA ref after it receives the ref list, and it simply ends the transaction and start throwing errors.

This is what was shown on the fetch from Google after it receives the ref list:

07:44:39.975529 pkt-line.c:46           packet:   fetch-pack< AAAAAAAA refs/heads/this_is_the_branch
07:44:39.975556 pkt-line.c:46           packet:   fetch-pack< ZZZZZZZZ refs/tags/my_only_tag ( they don't have much tags.. )
07:44:39.975566 pkt-line.c:46           packet:   fetch-pack< 0000
07:44:39.978010 pkt-line.c:46           packet:   fetch-pack> want AAAAAAAA multi_ack_detailed no-done side-band-64k thin-pack no-progress ofs-delta agent=git/2.1.3
07:44:39.978020 pkt-line.c:46           packet:   fetch-pack> deepen 1
07:44:39.978024 pkt-line.c:46           packet:   fetch-pack> 0000
07:44:39.978064 pkt-line.c:46           packet:          git< 008bwant AAAAAAAA multi_ack_detailed no-done side-band-64k thin-pack no-progress ofs-delta agent=git/2.1.3000cdeepen 10000
07:44:39.978080 pkt-line.c:46           packet:   fetch-pack> 0000
07:44:39.978093 pkt-line.c:46           packet:          git< 0000

And once we removed the clone-depth=1, the fetch went back to normal again as now the fetch simply wants every ref after the ref list is received:

08:10:00.374716 pkt-line.c:46           packet:   fetch-pack< YYYYYYYY refs/tags/second_to_last_tag
08:10:00.374721 pkt-line.c:46           packet:   fetch-pack< ZZZZZZZZ refs/tags/the_last_tag^{}
08:10:00.374725 pkt-line.c:46           packet:   fetch-pack< 0000
08:10:00.394606 pkt-line.c:46           packet:   fetch-pack> want BBBBBBB multi_ack_detailed no-done side-band-64k thin-pack no-progress ofs-delta
08:10:00.394617 pkt-line.c:46           packet:   fetch-pack> want AAAAAAA

... many many more lines later fetch finish without error


And the fetch is success and all is well.

It seems like somehow the clone-depth is causing issue on our server, but somehow working fine on google server? Have anyone seen this issue or have theory on what I should check?

Thanks a lot!



Martin Waitz

unread,
May 24, 2016, 11:21:53 AM5/24/16
to Repo and Gerrit Discussion
There's also a off-by-one bug for 'clone --depth' in Gerrit/jgit:
https://code.google.com/p/gerrit/issues/detail?id=3351

Leandro Fonseca

unread,
Jun 15, 2016, 3:36:04 PM6/15/16
to Repo and Gerrit Discussion
I'm experiencing the same issue.

Gerrit version 2.11.3

repo version v1.12.20

repo launcher version 1.21

git version 1.8.4.3

cao.z...@zte.com.cn

unread,
Aug 30, 2016, 5:25:31 AM8/30/16
to Repo and Gerrit Discussion
Hi Moe. Same issue here. Do you have a solution?

在 2016年5月24日星期二 UTC+8上午9:08:55,Moe写道:

Eric Montellese

unread,
Jun 13, 2017, 2:24:38 AM6/13/17
to Repo and Gerrit Discussion
I fought with this problem for a long time.

Check the documentation for git-fetch-pack

and the git config documentation:

You probably need to add some parts of this in your .gitconfig   *on the server*
[uploadpack]
    allowTipSHA1InWant = true
    allowReachableSHA1InWant = true
    allowAnySHA1InWant = true
    hiderefs = false

venkatakrishna...@gmail.com

unread,
Jul 5, 2017, 7:45:02 AM7/5/17
to Repo and Gerrit Discussion
Where on the server is this file ".gitconfig" found?
If it doesn't exist, where should it be created?
Is a gerrit restart necessary for the changes to reflect?

Cody Xie

unread,
Jul 12, 2017, 7:28:40 AM7/12/17
to Repo and Gerrit Discussion
The method works, thanks.

在 2017年6月13日星期二 UTC+8下午2:24:38,Eric Montellese写道:

Rahul Raj

unread,
Jul 1, 2018, 10:16:04 PM7/1/18
to Repo and Gerrit Discussion
I'm having this issue now. editing .gitconfig didn't solve my problem
Reply all
Reply to author
Forward
0 new messages