Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: peter@×××××.se
Subject: Re: [gentoo-dev] RFC: git-r3, additional clone types
Date: Mon, 24 Feb 2014 21:01:03
Message-Id: 20140224220044.52a010eb@pomiot.lan
In Reply to: Re: [gentoo-dev] RFC: git-r3, additional clone types by Peter Stuge
1 Dnia 2014-02-24, o godz. 21:13:15
2 Peter Stuge <peter@×××××.se> napisał(a):
3
4 > Michał Górny wrote:
5 > > Shallow clone
6 > > -------------
7 > > - EGIT_COMMIT can only name tags (using a hash auto-forces higher mode),
8 >
9 > Hm, why is that? This seems like an unfortunate and inconvenient
10 > limitation which might actually reduce usefulness of shallow mode
11 > quite severely? :\
12
13 Limitation of git design. You can only fetch remote refs, you can't
14 fetch an arbitrary hash. And since we don't download the whole history,
15 we can't use a hash that was past 'depth' of the branch/tag clone. So
16 in order to use an arbitrary hash, we actually have to download
17 the history.
18
19 > > - changing branches may be very inefficient (since it implies
20 > > re-fetching all objects implied by --depth 1),
21 >
22 > If it's the same local repo then at least in theory all existing
23 > blobs and trees don't strictly need to be transfered, only unseen
24 > ones and all the refs. But I'm not sure if git is so good at dealing
25 > with this - I haven't looked at exactly how packs are structured.
26
27 It's not good at all. In fact, if you try to update a shallow clone
28 with 'git fetch --depth 1', it's going to refetch all the objects
29 (while plain 'git fetch' only downloads new objects). It's just another
30 limitation of protocol that we can't do much about.
31
32 > > For example, if ebuilds sets EGIT_MIN_CLONE_MODE=single, and user sets
33 > > EGIT_CLONE_MODE=shallow, this single ebuild will be fetched
34 > > in single-branch mode. This can be used when build system operates
35 > > on repo history and doesn't work without it.
36 >
37 > I would prefer if I needed to allow such mode upgrades explicitly.
38
39 That sounds like a lot ebuilds failing, requesting you to explicitly
40 change the mode. For example, all Google Code hosted repositories
41 do not support shallow mode. Some projects may require single-branch
42 mode to handle their 'git log' play.
43
44 > > When mirror or single-branch mode is used on a shallow repository,
45 > > the repository is still marked 'shallow' even if the full history is
46 > > available. I don't know if this wouldn't break some of 'git foo' uses
47 > > in the checkout but that probably can't be predicted. Moreover, I don't
48 > > know if it is safe to remove 'shallow' after doing full-fetch in mirror
49 > > mode.
50 >
51 > If each mode uses a different remote name (but same URL) then I don't
52 > think anything can break.
53
54 Remote names are just aliases for URIs. They are meaningless and we
55 don't even bother using them. Well, actually I may add 'git remote'
56 since that doesn't hurt but it's a completely unrelated topic.
57
58 --
59 Best regards,
60 Michał Górny

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-dev] RFC: git-r3, additional clone types Alex Xu <alex_y_xu@×××××.ca>
Re: [gentoo-dev] RFC: git-r3, additional clone types Peter Stuge <peter@×××××.se>