1 |
Dnia 2014-02-24, o godz. 16:10:15 |
2 |
Alex Xu <alex_y_xu@×××××.ca> napisał(a): |
3 |
|
4 |
> On 24/02/14 04:00 PM, Michał Górny wrote: |
5 |
> > Dnia 2014-02-24, o godz. 21:13:15 |
6 |
> > Peter Stuge <peter@×××××.se> napisał(a): |
7 |
> > |
8 |
> >> Michał Górny wrote: |
9 |
> >>> Shallow clone |
10 |
> >>> ------------- |
11 |
> >>> - EGIT_COMMIT can only name tags (using a hash auto-forces higher mode), |
12 |
> >> |
13 |
> >> Hm, why is that? This seems like an unfortunate and inconvenient |
14 |
> >> limitation which might actually reduce usefulness of shallow mode |
15 |
> >> quite severely? :\ |
16 |
> > |
17 |
> > Limitation of git design. You can only fetch remote refs, you can't |
18 |
> > fetch an arbitrary hash. And since we don't download the whole history, |
19 |
> > we can't use a hash that was past 'depth' of the branch/tag clone. So |
20 |
> > in order to use an arbitrary hash, we actually have to download |
21 |
> > the history. |
22 |
> |
23 |
> Perhaps you could have EGIT_FETCH_REF and EGIT_CHECKOUT? |
24 |
|
25 |
I don't understand what you mean and I think you miss the point. If you |
26 |
want to checkout an arbitrary commit, you need to 'fetch --depth N' |
27 |
the branch it's in, with N chosen so that the requested commit will |
28 |
actually be downloaded. Since we don't know how many commits we need to |
29 |
download, we need to download the whole branch. |
30 |
|
31 |
> >>> - changing branches may be very inefficient (since it implies |
32 |
> >>> re-fetching all objects implied by --depth 1), |
33 |
> >> |
34 |
> >> If it's the same local repo then at least in theory all existing |
35 |
> >> blobs and trees don't strictly need to be transfered, only unseen |
36 |
> >> ones and all the refs. But I'm not sure if git is so good at dealing |
37 |
> >> with this - I haven't looked at exactly how packs are structured. |
38 |
> > |
39 |
> > It's not good at all. In fact, if you try to update a shallow clone |
40 |
> > with 'git fetch --depth 1', it's going to refetch all the objects |
41 |
> > (while plain 'git fetch' only downloads new objects). It's just another |
42 |
> > limitation of protocol that we can't do much about. |
43 |
> |
44 |
> Can't you use `git fetch` as usual to download old..new commits only? |
45 |
> This wouldn't help with switching branches though. |
46 |
|
47 |
I do. Here I was referring purely to the branch switching situation. |
48 |
|
49 |
> >> I would prefer if I needed to allow such mode upgrades explicitly. |
50 |
> > |
51 |
> > That sounds like a lot ebuilds failing, requesting you to explicitly |
52 |
> > change the mode. For example, all Google Code hosted repositories |
53 |
> > do not support shallow mode. Some projects may require single-branch |
54 |
> > mode to handle their 'git log' play. |
55 |
> |
56 |
> Perhaps EGIT_CLONE_MODE could be a USE_EXPAND (yes, another one)? |
57 |
|
58 |
USE flags are not supposed to be used to control internal behavior that |
59 |
does not affect resulting install. |
60 |
|
61 |
> >>> When mirror or single-branch mode is used on a shallow repository, |
62 |
> >>> the repository is still marked 'shallow' even if the full history is |
63 |
> >>> available. I don't know if this wouldn't break some of 'git foo' uses |
64 |
> >>> in the checkout but that probably can't be predicted. Moreover, I don't |
65 |
> >>> know if it is safe to remove 'shallow' after doing full-fetch in mirror |
66 |
> >>> mode. |
67 |
> |
68 |
> git fetch --unshallow according to |
69 |
> https://stackoverflow.com/questions/6802145/convert-shallow-clone-to-full-clone |
70 |
|
71 |
Oh, yes, I forgot about that. One issue likely solved, then. |
72 |
|
73 |
-- |
74 |
Best regards, |
75 |
Michał Górny |